From 2f43b20dcfd50faec4dc6f55ed55471f4bc7db99 Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Fri, 12 Mar 2021 12:34:52 -0800 Subject: SF: add traces to transactionIsReadyToBeApplied Add more trace points to understand why a transaction is not ready to be applied. Bug: 182587984 Test: systrace Change-Id: I78faf93cd0f360fb4939445a02f7cbc1843c307f --- services/surfaceflinger/SurfaceFlinger.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 593855ec17..3b0e5944af 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3376,12 +3376,14 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied( const FrameTimelineInfo& info, bool isAutoTimestamp, int64_t desiredPresentTime, const Vector& states, std::unordered_set, ISurfaceComposer::SpHash>& pendingBuffers) { + ATRACE_CALL(); const nsecs_t expectedPresentTime = mExpectedPresentTime.load(); bool ready = true; // Do not present if the desiredPresentTime has not passed unless it is more than one second // in the future. We ignore timestamps more than 1 second in the future for stability reasons. if (!isAutoTimestamp && desiredPresentTime >= expectedPresentTime && desiredPresentTime < expectedPresentTime + s2ns(1)) { + ATRACE_NAME("not current"); ready = false; } @@ -3404,6 +3406,8 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied( continue; } + ATRACE_NAME(layer->getName().c_str()); + const bool frameTimelineInfoChanged = (s.what & layer_state_t::eFrameTimelineInfoChanged); const auto vsyncId = frameTimelineInfoChanged ? s.frameTimelineInfo.vsyncId : info.vsyncId; if (isAutoTimestamp && layer->frameIsEarly(expectedPresentTime, vsyncId)) { @@ -3421,6 +3425,7 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied( // transaction in the queue. const bool hasPendingBuffer = pendingBuffers.find(s.surface) != pendingBuffers.end(); if (layer->backpressureEnabled() && hasPendingBuffer && isAutoTimestamp) { + ATRACE_NAME("hasPendingBuffer"); ready = false; } pendingBuffers.insert(s.surface); -- cgit v1.2.3-59-g8ed1b