Skip to content

Commit 95c4ecc

Browse files
committed
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
1 parent f5883db commit 95c4ecc

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

services/surfaceflinger/Layer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,6 +3178,8 @@ void Layer::releasePreviousBuffer() {
31783178
callReleaseBufferCallback(mDrawingState.releaseBufferListener,
31793179
mDrawingState.buffer->getBuffer(), mDrawingState.frameNumber,
31803180
mDrawingState.acquireFence);
3181+
const int32_t layerId = getSequence();
3182+
mFlinger->mTimeStats->removeTimeRecord(layerId, mDrawingState.frameNumber);
31813183
decrementPendingBufferCount();
31823184
if (mDrawingState.bufferSurfaceFrameTX != nullptr &&
31833185
mDrawingState.bufferSurfaceFrameTX->getPresentState() != PresentState::Presented) {

0 commit comments

Comments
 (0)