From c09c023a9bfc3c34be38cf95d1691fd712af2d68 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 2 Mar 2023 03:22:35 +0000 Subject: [sf] only update the last latch time if the layer has a buffer If we apply a transaction that does not latch a buffer, we incorrectly updated the last latch time. In the next vsync, if we presented a buffer late, we would misclassify the jank as buffer stuffing. Fix this by only updating the latch time if the layer has a buffer. Test: verify in perfetto traces Fixes: 270041584 Change-Id: I423a28803a2660ada80ef554469f3977c389fbfa --- services/surfaceflinger/Layer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 433606a732..ded607eb49 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -3037,6 +3037,10 @@ bool Layer::setBuffer(std::shared_ptr& buffer, mLastClientCompositionFence); mLastClientCompositionFence = nullptr; } + } else { + // if we are latching a buffer for the first time then clear the mLastLatchTime since + // we don't want to incorrectly classify a frame if we miss the desired present time. + updateLastLatchTime(0); } mDrawingState.producerId = bufferData.producerId; -- cgit v1.2.3-59-g8ed1b