Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b877579d authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Dump vSync id in layers trace

Used to figure out which transactions where applied in a given layers trace entry to synchronize a transition (through the start/finish transactions) with the layers trace for FaaS.

Bug: 230462538

Test: Check vSyncId is dumped in layers trace
Change-Id: Ib59311f3ae29196316a064ced98445857e45c5b9
parent cd9c96eb
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2168,7 +2168,7 @@ bool SurfaceFlinger::commit(nsecs_t frameTime, int64_t vsyncId, nsecs_t expected

    if (mLayerTracingEnabled && !mLayerTracing.flagIsSet(LayerTracing::TRACE_COMPOSITION)) {
        // This will block and tracing should only be enabled for debugging.
        mLayerTracing.notify(mVisibleRegionsDirty, frameTime);
        mLayerTracing.notify(mVisibleRegionsDirty, frameTime, vsyncId);
    }

    persistDisplayBrightness(mustComposite);
@@ -2295,7 +2295,7 @@ void SurfaceFlinger::composite(nsecs_t frameTime, int64_t vsyncId)
    mLayersWithQueuedFrames.clear();
    if (mLayerTracingEnabled && mLayerTracing.flagIsSet(LayerTracing::TRACE_COMPOSITION)) {
        // This will block and should only be used for debugging.
        mLayerTracing.notify(mVisibleRegionsDirty, frameTime);
        mLayerTracing.notify(mVisibleRegionsDirty, frameTime, vsyncId);
    }

    mVisibleRegionsWereDirtyThisFrame = mVisibleRegionsDirty; // Cache value for use in post-comp
@@ -5846,7 +5846,8 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                                (fixedStartingTime) ? fixedStartingTime : systemTime();
                        mScheduler
                                ->schedule([&]() FTL_FAKE_GUARD(mStateLock) {
                                    mLayerTracing.notify("start", startingTime);
                                    mLayerTracing.notify(true /* visibleRegionDirty */,
                                                         startingTime, -1 /* vsyncId */);
                                })
                                .wait();
                    }
+2 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ void LayerTracing::dump(std::string& result) const {
    mBuffer->dump(result);
}

void LayerTracing::notify(bool visibleRegionDirty, int64_t time) {
void LayerTracing::notify(bool visibleRegionDirty, int64_t time, int64_t vsyncId) {
    std::scoped_lock lock(mTraceLock);
    if (!mEnabled) {
        return;
@@ -130,6 +130,7 @@ void LayerTracing::notify(bool visibleRegionDirty, int64_t time) {
    }
    mFlinger.dumpDisplayProto(entry);
    mBuffer->emplace(std::move(entry));
    entry.set_vsync_id(vsyncId);
}

} // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public:
    bool isEnabled() const;
    status_t writeToFile();
    LayersTraceFileProto createTraceFileProto() const;
    void notify(bool visibleRegionDirty, int64_t time);
    void notify(bool visibleRegionDirty, int64_t time, int64_t vsyncId);

    enum : uint32_t {
        TRACE_INPUT = 1 << 1,
+3 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ message LayersTraceFileProto {
    repeated LayersTraceProto entry = 2;
}

/* one window manager trace entry. */
/* one layers trace entry. */
message LayersTraceProto {
    /* required: elapsed realtime in nanos since boot of when this entry was logged */
    optional sfixed64 elapsed_realtime_nanos = 1;
@@ -60,4 +60,6 @@ message LayersTraceProto {
    optional uint32 missed_entries = 6;

    repeated DisplayProto displays = 7;

    optional int64 vsync_id = 8;
}