Send transaction callbacks earlier
As soon as layers finish post composition, we can send our transaction
callback so that the client can handle the callback information earlier
before the next SF cycle. Reduces missed frames. Also prevents missed
callback if display is not on.
Bug: 152709895
Test: build, boot, SurfaceFlinger_test, libsurfaceflinger_unittest,
manual
Change-Id: I9eff815270f43d1a3b6a0bf7a9c46e17194bd933
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 6ec521a..6547577 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2164,6 +2164,9 @@
}
});
+ mTransactionCompletedThread.addPresentFence(mPreviousPresentFences[0]);
+ mTransactionCompletedThread.sendCallbacks();
+
if (displayDevice && displayDevice->isPrimary() &&
displayDevice->getPowerMode() == HWC_POWER_MODE_NORMAL && presentFenceTime->isValid()) {
mScheduler->addPresentFence(presentFenceTime);
@@ -2244,9 +2247,6 @@
}
}
- mTransactionCompletedThread.addPresentFence(mPreviousPresentFences[0]);
- mTransactionCompletedThread.sendCallbacks();
-
if (mLumaSampling && mRegionSamplingThread) {
mRegionSamplingThread->notifyNewContent();
}