diff options
| author | 2023-05-19 14:42:24 -0400 | |
|---|---|---|
| committer | 2023-05-19 15:02:23 -0400 | |
| commit | 61dfca4bedbdee697ae07f2e660fa0eb4fab17cf (patch) | |
| tree | 1a26718a526d0c90c4aa31df0233f472d1a9f721 | |
| parent | b94c02682fe56e2548690c80c0f98c411191c502 (diff) | |
SF: Fix ADPF regression due to wrong present fence
Partially revert Ib114ffc1866aa32e6d493e06dcf5a27652d19a39.
PowerAdvisor needs the present fence of the previous frame, as the query
happens after presenting the current frame so should not be adjusted for
targeting 2 VSYNCs ahead.
Fixes: 283189729
Test: Perfetto
Change-Id: Ifbd6aa961bc92fe1d2f4de1247413fcd49330645
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 5d96fc45be..0612f5a24f 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2674,12 +2674,15 @@ void SurfaceFlinger::composite(TimePoint frameTime, VsyncId vsyncId) mTimeStats->recordFrameDuration(frameTime.ns(), systemTime()); - // Send a power hint hint after presentation is finished + // Send a power hint after presentation is finished. if (mPowerHintSessionEnabled) { - const nsecs_t pastPresentTime = - getPreviousPresentFence(frameTime, vsyncPeriod)->getSignalTime(); + // Now that the current frame has been presented above, PowerAdvisor needs the present time + // of the previous frame (whose fence is signaled by now) to determine how long the HWC had + // waited on that fence to retire before presenting. + const auto& previousPresentFence = mPreviousPresentFences[0].fenceTime; - mPowerAdvisor->setSfPresentTiming(TimePoint::fromNs(pastPresentTime), TimePoint::now()); + mPowerAdvisor->setSfPresentTiming(TimePoint::fromNs(previousPresentFence->getSignalTime()), + TimePoint::now()); mPowerAdvisor->reportActualWorkDuration(); } |