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

Commit f32ff9bc authored by Vishnu Nair's avatar Vishnu Nair
Browse files

[sf-newfe] Update latch time correctly for buffer less layers

Bug: b/296951485, 238781169
Test: android-crystalball-eng/health/microbench/systemui/main/systemui-bubble-1-jank-suite
Change-Id: I0700250936a7d50186cbf4c58f9c2f548f6ea860
parent 0109d3d3
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -2308,11 +2308,22 @@ bool SurfaceFlinger::updateLayerSnapshots(VsyncId vsyncId, nsecs_t frameTimeNs,
                mLegacyLayers[bgColorLayer->sequence] = bgColorLayer;
            }
            const bool willReleaseBufferOnLatch = layer->willReleaseBufferOnLatch();
            if (!layer->hasReadyFrame() && !willReleaseBufferOnLatch) continue;

            auto it = mLegacyLayers.find(layer->id);
            LOG_ALWAYS_FATAL_IF(it == mLegacyLayers.end(), "Couldnt find layer object for %s",
                                layer->getDebugString().c_str());
            if (!layer->hasReadyFrame() && !willReleaseBufferOnLatch) {
                if (!it->second->hasBuffer()) {
                    // The last latch time is used to classify a missed frame as buffer stuffing
                    // instead of a missed frame. This is used to identify scenarios where we
                    // could not latch a buffer or apply a transaction due to backpressure.
                    // We only update the latch time for buffer less layers here, the latch time
                    // is updated for buffer layers when the buffer is latched.
                    it->second->updateLastLatchTime(latchTime);
                }
                continue;
            }

            const bool bgColorOnly =
                    !layer->externalTexture && (layer->bgColorLayerId != UNASSIGNED_LAYER_ID);
            if (willReleaseBufferOnLatch) {