From a156f48c32eac7e11d37700fdbfcdc3a54d65b78 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Wed, 22 Feb 2023 00:23:38 +0000 Subject: [sf] update latch time only for layers that will not be latched Latching happens after the transactions are committed, so fix an issue where we passed in the incorrect latch time for buffer layers that was used to classify jank. Note: this will probably cause a perf regression but this is fixing an incorrect jank classification caused by Ie211aa3bd5821f6052cf84a62a2e245132a19d90 Bug: 270041584 Test: presubmit Change-Id: I632a8ee6a1ed804a17a001e87c06e617ae361b25 --- services/surfaceflinger/Layer.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index dac09169c8..a29be22aa8 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -790,7 +790,7 @@ void Layer::transferAvailableJankData(const std::deque>& hand // transaction // ---------------------------------------------------------------------------- -uint32_t Layer::doTransaction(uint32_t flags, nsecs_t latchTime) { +uint32_t Layer::doTransaction(uint32_t flags) { ATRACE_CALL(); // TODO: This is unfortunate. @@ -818,12 +818,12 @@ uint32_t Layer::doTransaction(uint32_t flags, nsecs_t latchTime) { mFlinger->mUpdateInputInfo = true; } - commitTransaction(mDrawingState, latchTime); + commitTransaction(mDrawingState); return flags; } -void Layer::commitTransaction(State&, nsecs_t currentLatchTime) { +void Layer::commitTransaction(State&) { // Set the present state for all bufferlessSurfaceFramesTX to Presented. The // bufferSurfaceFrameTX will be presented in latchBuffer. for (auto& [token, surfaceFrame] : mDrawingState.bufferlessSurfaceFramesTX) { @@ -835,7 +835,6 @@ void Layer::commitTransaction(State&, nsecs_t currentLatchTime) { } } mDrawingState.bufferlessSurfaceFramesTX.clear(); - mLastLatchTime = currentLatchTime; } uint32_t Layer::clearTransactionFlags(uint32_t mask) { @@ -1381,7 +1380,7 @@ void Layer::addSurfaceFramePresentedForBuffer( surfaceFrame->setAcquireFenceTime(acquireFenceTime); surfaceFrame->setPresentState(PresentState::Presented, mLastLatchTime); mFlinger->mFrameTimeline->addSurfaceFrame(surfaceFrame); - mLastLatchTime = currentLatchTime; + updateLastLatchTime(currentLatchTime); } std::shared_ptr Layer::createSurfaceFrameForTransaction( @@ -4077,6 +4076,10 @@ void Layer::setTrustedPresentationInfo(TrustedPresentationThresholds const& thre } } +void Layer::updateLastLatchTime(nsecs_t latchTime) { + mLastLatchTime = latchTime; +} + // --------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& stream, const Layer::FrameRate& rate) { -- cgit v1.2.3-59-g8ed1b