diff options
author | Matt Buckley <mattbuckley@google.com> | 2023-05-31 23:59:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-05-31 23:59:05 +0000 |
commit | e2d955548639f22de77e7acb60395790da5469b7 (patch) | |
tree | ca5af7aeaeb89b3020ee4cc35e81569991130af4 | |
parent | 6bd58d4d045fab777551175e0d16fb9c5f22c0cb (diff) | |
parent | 676e4390c3dc26910edfb6c6a3c52ffe4b898bf3 (diff) | |
download | native-e2d955548639f22de77e7acb60395790da5469b7.tar.gz |
Merge "Reduce number of binders from SurfaceFlinger for ADPF" into udc-dev
-rw-r--r-- | services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp | 5 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/PowerAdvisor.h | 3 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp index 37b68c865e..f8b466c93c 100644 --- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp +++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp @@ -223,7 +223,7 @@ void PowerAdvisor::updateTargetWorkDuration(Duration targetDuration) { } void PowerAdvisor::reportActualWorkDuration() { - if (!mBootFinished || !usePowerHintSession()) { + if (!mBootFinished || !sUseReportActualDuration || !usePowerHintSession()) { ALOGV("Actual work duration power hint cannot be sent, skipping"); return; } @@ -564,6 +564,9 @@ const Duration PowerAdvisor::sTargetSafetyMargin = std::chrono::microseconds( base::GetIntProperty<int64_t>("debug.sf.hint_margin_us", ticks<std::micro>(PowerAdvisor::kDefaultTargetSafetyMargin))); +const bool PowerAdvisor::sUseReportActualDuration = + base::GetBoolProperty(std::string("debug.adpf.use_report_actual_duration"), true); + power::PowerHalController& PowerAdvisor::getPowerHal() { static std::once_flag halFlag; std::call_once(halFlag, [this] { mPowerHal->init(); }); diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.h b/services/surfaceflinger/DisplayHardware/PowerAdvisor.h index 7a0d4267fe..f0d3fd8518 100644 --- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.h +++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.h @@ -269,6 +269,9 @@ private: static const Duration sTargetSafetyMargin; static constexpr const Duration kDefaultTargetSafetyMargin{1ms}; + // Whether we should send reportActualWorkDuration calls + static const bool sUseReportActualDuration; + // How long we expect hwc to run after the present call until it waits for the fence static constexpr const Duration kFenceWaitStartDelayValidated{150us}; static constexpr const Duration kFenceWaitStartDelaySkippedValidate{250us}; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 2ac1db961f..79378befcc 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2485,7 +2485,10 @@ bool SurfaceFlinger::commit(TimePoint frameTime, VsyncId vsyncId, TimePoint expe 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) { |