Reduce number of binders from SurfaceFlinger for ADPF
Currently, SF is using the wrong vsync value when calculating the
target for ADPF, causing it to send a binder every frame instead of
every vsync change. This patch fixes that to reduce the binder
frequency from SF, and also adds a debug option to disable reportActual
to reduce the amount of binders even more in certain cases.
Bug: 284357218
Test: manual
Change-Id: I8435b170016c5af8219d8ed8cc9ed65a0a2cb0e7
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5d96fc4..bbfed8a 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2485,7 +2485,10 @@
mPowerAdvisor->setFrameDelay(frameDelay);
mPowerAdvisor->setTotalFrameTargetWorkDuration(idealSfWorkDuration);
- mPowerAdvisor->updateTargetWorkDuration(vsyncPeriod);
+
+ const auto& display = FTL_FAKE_GUARD(mStateLock, getDefaultDisplayDeviceLocked()).get();
+ const Period idealVsyncPeriod = display->getActiveMode().fps.getPeriod();
+ mPowerAdvisor->updateTargetWorkDuration(idealVsyncPeriod);
}
if (mRefreshRateOverlaySpinner) {