SF: Revamp frequencyScale backdoor
Update the frequencyScale backdoor (1029) to do a primary
display hot unplug-plug so that the updated frequency makes
it to the DisplayManager
Test: adb shell service call SurfaceFlinger 1029 i32 2 i32 3
Change-Id: Id93a5946ee19fbe9925789ba3294cbf213a52c30
diff --git a/services/surfaceflinger/Scheduler/DispSync.cpp b/services/surfaceflinger/Scheduler/DispSync.cpp
index 9d9acd3..54a1b51 100644
--- a/services/surfaceflinger/Scheduler/DispSync.cpp
+++ b/services/surfaceflinger/Scheduler/DispSync.cpp
@@ -521,16 +521,18 @@
mThread->updateModel(mPeriod, mPhase, mReferenceTime);
}
-void DispSync::scalePeriod(uint32_t multiplier, uint32_t divisor) {
+void DispSync::scalePeriod(HWC2::Device::FrequencyScaler frequencyScaler) {
Mutex::Autolock lock(mMutex);
// if only 1 of the properties is updated, we will get to this
// point "attempting" to set the scale to 1 when it is already
// 1. Check that special case so that we don't do a useless
// update of the model.
- if ((multiplier == 1) && (divisor == 1) && (mPeriod == mPeriodBase)) return;
+ if ((frequencyScaler.multiplier == 1) &&
+ (frequencyScaler.divisor == 1) &&
+ (mPeriod == mPeriodBase)) return;
- mPeriod = mPeriodBase * multiplier / divisor;
+ mPeriod = mPeriodBase * frequencyScaler.multiplier / frequencyScaler.divisor;
mThread->updateModel(mPeriod, mPhase, mReferenceTime);
}
diff --git a/services/surfaceflinger/Scheduler/DispSync.h b/services/surfaceflinger/Scheduler/DispSync.h
index 183966f..b3aef2d 100644
--- a/services/surfaceflinger/Scheduler/DispSync.h
+++ b/services/surfaceflinger/Scheduler/DispSync.h
@@ -24,6 +24,7 @@
#include <utils/Timers.h>
#include <ui/FenceTime.h>
+#include <DisplayHardware/HWC2.h>
#include <memory>
@@ -48,7 +49,7 @@
virtual bool addResyncSample(nsecs_t timestamp) = 0;
virtual void endResync() = 0;
virtual void setPeriod(nsecs_t period) = 0;
- virtual void scalePeriod(const uint32_t multiplier, uint32_t divisor) = 0;
+ virtual void scalePeriod(HWC2::Device::FrequencyScaler) = 0;
virtual nsecs_t getPeriod() = 0;
virtual void setRefreshSkipCount(int count) = 0;
virtual status_t addEventListener(const char* name, nsecs_t phase, Callback* callback) = 0;
@@ -122,7 +123,7 @@
// scale the vsync event model's period. The function is added
// for an experimental test mode and should not be used outside
// of that purpose.
- void scalePeriod(const uint32_t multiplier, uint32_t divisor);
+ void scalePeriod(HWC2::Device::FrequencyScaler frequencyScaler);
// The getPeriod method returns the current vsync period.
nsecs_t getPeriod() override;