SF: Pass latch time for bufferless surface frames
Latch time is used to classify jank type as BufferStuffing.
This jank classification does not count as missed frames.
Layers without buffers do not pass in a latch time to the
frametimeline logic. Fix this inconsistency so we do not
incorrectly report missed frames for missed layer updates
due to buffer stuffing.
Test: check perfetto traces and see leashes are also classified as
buffer stuffing
Fixes: 266666415
Change-Id: Ie211aa3bd5821f6052cf84a62a2e245132a19d90
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 62e31b9..f2a8d44 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -772,7 +772,7 @@
// transaction
// ----------------------------------------------------------------------------
-uint32_t Layer::doTransaction(uint32_t flags) {
+uint32_t Layer::doTransaction(uint32_t flags, nsecs_t latchTime) {
ATRACE_CALL();
// TODO: This is unfortunate.
@@ -800,23 +800,24 @@
mFlinger->mUpdateInputInfo = true;
}
- commitTransaction(mDrawingState);
+ commitTransaction(mDrawingState, latchTime);
return flags;
}
-void Layer::commitTransaction(State&) {
+void Layer::commitTransaction(State&, nsecs_t currentLatchTime) {
// Set the present state for all bufferlessSurfaceFramesTX to Presented. The
// bufferSurfaceFrameTX will be presented in latchBuffer.
for (auto& [token, surfaceFrame] : mDrawingState.bufferlessSurfaceFramesTX) {
if (surfaceFrame->getPresentState() != PresentState::Presented) {
// With applyPendingStates, we could end up having presented surfaceframes from previous
// states
- surfaceFrame->setPresentState(PresentState::Presented);
+ surfaceFrame->setPresentState(PresentState::Presented, mLastLatchTime);
mFlinger->mFrameTimeline->addSurfaceFrame(surfaceFrame);
}
}
mDrawingState.bufferlessSurfaceFramesTX.clear();
+ mLastLatchTime = currentLatchTime;
}
uint32_t Layer::clearTransactionFlags(uint32_t mask) {