summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Buckley <mattbuckley@google.com>2022-07-29 00:13:27 +0000
committerMatt Buckley <mattbuckley@google.com>2022-07-31 01:36:05 +0000
commit672e526d76b2a7835455030e9efc80e78da10a22 (patch)
treeb2690c31500b5c2c275d65cc31a5587c3524e7b5
parent9bcb646d88037abe9df9114509f6b9f309b4bdd6 (diff)
downloadnative-672e526d76b2a7835455030e9efc80e78da10a22.tar.gz
Get vsync period for ADPF CPU hints in SF using display mode
Replace the existing implementation using getVsyncPeriodFromHWC with vsync data from the current display mode Bug: b/240621816 Test: manual Change-Id: Ie70d17400481eed31595a5f1ae4296c4df9d4071 (cherry picked from commit 1151f4677dc80ab2acf09af7586798e974244ca1)
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index cbc068f2bb..8621d31d91 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2087,11 +2087,9 @@ bool SurfaceFlinger::commit(nsecs_t frameTime, int64_t vsyncId, nsecs_t expected
// Save this once per commit + composite to ensure consistency
mPowerHintSessionEnabled = mPowerAdvisor->usePowerHintSession();
if (mPowerHintSessionEnabled) {
- nsecs_t vsyncPeriod;
- {
- Mutex::Autolock lock(mStateLock);
- vsyncPeriod = getVsyncPeriodFromHWC();
- }
+ const auto& display = FTL_FAKE_GUARD(mStateLock, getDefaultDisplayDeviceLocked()).get();
+ // get stable vsync period from display mode
+ const nsecs_t vsyncPeriod = display->getActiveMode()->getVsyncPeriod();
mPowerAdvisor->setCommitStart(frameTime);
mPowerAdvisor->setExpectedPresentTime(mExpectedPresentTime);
const nsecs_t idealSfWorkDuration =