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/SurfaceFlinger.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'services/surfaceflinger/SurfaceFlinger.cpp') diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 5c8579cb4d..f842de1440 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3863,7 +3863,7 @@ void SurfaceFlinger::commitOffscreenLayers() { for (Layer* offscreenLayer : mOffscreenLayers) { offscreenLayer->traverse(LayerVector::StateSet::Drawing, [](Layer* layer) { if (layer->clearTransactionFlags(eTransactionNeeded)) { - layer->doTransaction(0, 0); + layer->doTransaction(0); layer->commitChildList(); } }); @@ -3899,7 +3899,7 @@ bool SurfaceFlinger::latchBuffers() { // second frame. But layer 0's second frame could be waiting on display. mDrawingState.traverse([&](Layer* layer) { if (layer->clearTransactionFlags(eTransactionNeeded) || mForceTransactionDisplayChange) { - const uint32_t flags = layer->doTransaction(0, latchTime); + const uint32_t flags = layer->doTransaction(0); if (flags & Layer::eVisibleRegion) { mVisibleRegionsDirty = true; } @@ -3910,6 +3910,8 @@ bool SurfaceFlinger::latchBuffers() { mLayersWithQueuedFrames.emplace(sp::fromExisting(layer)); } else { layer->useEmptyDamage(); + // If the layer has frames we will update the latch time when latching the buffer. + layer->updateLastLatchTime(latchTime); } }); mForceTransactionDisplayChange = false; -- cgit v1.2.3-59-g8ed1b