Account for refresh rate in sf adpf hint session rate limiter
Currently, the SurfaceFlinger hint session rate limiter will send hints
after 80ms of inactivity regardless of refresh rate, which can lead to
issues at lower rates (eg: 30fps) where we skip the window that we
should send the hint in and go stale. This patch addresses that
oversight.
Bug: b/240473968
Test: manual
Change-Id: I27ce9229537e445f202e948ab201cc0242882667
diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
index b9d4753..62078ba 100644
--- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
+++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
@@ -759,9 +759,10 @@
}
bool AidlPowerHalWrapper::shouldReportActualDurations() {
- // Report if we have never reported before or are approaching a stale session
+ // Report if we have never reported before or will go stale next frame
if (!mLastActualDurationSent.has_value() ||
- (systemTime() - mLastActualReportTimestamp) > kStaleTimeout.count()) {
+ (mLastTargetDurationSent + systemTime() - mLastActualReportTimestamp) >
+ kStaleTimeout.count()) {
return true;
}