Fix some missed frame reporting issues
* Distinguish between HWC and GL missed frames in systrace
* Report missed frames before performSetActiveConfig
Bug: 124383894
Test: systrace
Change-Id: I54f1bd6074e27fb6e00d8397a704fc1d5f1ddd35
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index b44f69d..9887c20 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1582,6 +1582,18 @@
ATRACE_CALL();
switch (what) {
case MessageQueue::INVALIDATE: {
+ bool frameMissed = mPreviousPresentFence != Fence::NO_FENCE &&
+ (mPreviousPresentFence->getStatus() == Fence::Status::Unsignaled);
+ bool hwcFrameMissed = mHadDeviceComposition && frameMissed;
+ bool gpuFrameMissed = mHadClientComposition && frameMissed;
+ ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
+ ATRACE_INT("HwcFrameMissed", static_cast<int>(hwcFrameMissed));
+ ATRACE_INT("GpuFrameMissed", static_cast<int>(gpuFrameMissed));
+ if (frameMissed) {
+ mFrameMissedCount++;
+ mTimeStats->incrementMissedFrames();
+ }
+
if (mUseSmart90ForVideo) {
// This call is made each time SF wakes up and creates a new frame. It is part
// of video detection feature.
@@ -1592,14 +1604,6 @@
break;
}
- bool frameMissed = mPreviousPresentFence != Fence::NO_FENCE &&
- (mPreviousPresentFence->getStatus() == Fence::Status::Unsignaled);
- bool hwcFrameMissed = !mHadClientComposition && frameMissed;
- if (frameMissed) {
- ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
- mFrameMissedCount++;
- mTimeStats->incrementMissedFrames();
- }
// For now, only propagate backpressure when missing a hwc frame.
if (hwcFrameMissed) {
if (mPropagateBackpressure) {
@@ -1680,11 +1684,14 @@
postComposition();
mHadClientComposition = false;
+ mHadDeviceComposition = false;
for (const auto& [token, displayDevice] : mDisplays) {
auto display = displayDevice->getCompositionDisplay();
const auto displayId = display->getId();
mHadClientComposition =
mHadClientComposition || getHwComposer().hasClientComposition(displayId);
+ mHadDeviceComposition =
+ mHadDeviceComposition || getHwComposer().hasDeviceComposition(displayId);
}
mVsyncModulator.onRefreshed(mHadClientComposition);