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

Commit 95c4eccc authored by Dominic Lemire's avatar Dominic Lemire
Browse files

SF TimeStats: remove timeRecord of dropped buffers

Prevent TimeStats from getting stuck waiting on a stale time record
after multiple setBuffer/setPostTime occurred for the same layer within
the same commit.

For example:
V TimeStats: [109]-[1]-[SurfaceView[...](BLAST)#109]-PostTime[...]
V TimeStats: [109]-[2]-[SurfaceView[...](BLAST)#109]-PostTime[...]
... 62 frames later ...
V TimeStats: [109]-[64]-PresentFenceTime[...]
V TimeStats: [109]-flushAvailableRecordsToStatsLocked
V TimeStats: [109]-[1]-presentFence is still not received

Bug: 351133405
Test: run TvtsJankHostTestCases and compare the presentToPresent
histograms between the UI and video layers (missing lots of video
frames), or watch for
logcat -s TimeStats | grep "timeRecords is at its maximum size"

Change-Id: I3de44250d5eb919f58d60976d7c33bd8394c0f0c
parent f5883db7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3178,6 +3178,8 @@ void Layer::releasePreviousBuffer() {
        callReleaseBufferCallback(mDrawingState.releaseBufferListener,
                                  mDrawingState.buffer->getBuffer(), mDrawingState.frameNumber,
                                  mDrawingState.acquireFence);
        const int32_t layerId = getSequence();
        mFlinger->mTimeStats->removeTimeRecord(layerId, mDrawingState.frameNumber);
        decrementPendingBufferCount();
        if (mDrawingState.bufferSurfaceFrameTX != nullptr &&
            mDrawingState.bufferSurfaceFrameTX->getPresentState() != PresentState::Presented) {