SF: Remove Scheduler::setRefreshSkipCount
This is an obsolete experiment dating back to L.
Bug: 130554049
Test: Build
Change-Id: Ib8dfb51177d72ebca1972dd294618b9685542180
diff --git a/services/surfaceflinger/Scheduler/DispSync.cpp b/services/surfaceflinger/Scheduler/DispSync.cpp
index ae776a0..4bdfad9 100644
--- a/services/surfaceflinger/Scheduler/DispSync.cpp
+++ b/services/surfaceflinger/Scheduler/DispSync.cpp
@@ -617,13 +617,6 @@
return mThread->addEventListener(name, phase, callback, lastCallbackTime);
}
-void DispSync::setRefreshSkipCount(int count) {
- Mutex::Autolock lock(mMutex);
- ALOGD("setRefreshSkipCount(%d)", count);
- mRefreshSkipCount = count;
- updateModelLocked();
-}
-
status_t DispSync::removeEventListener(Callback* callback, nsecs_t* outLastCallbackTime) {
Mutex::Autolock lock(mMutex);
return mThread->removeEventListener(callback, outLastCallbackTime);
@@ -706,9 +699,6 @@
ALOGV("[%s] Adjusting mPhase -> %" PRId64, mName, ns2us(mPhase));
}
- // Artificially inflate the period if requested.
- mPeriod += mPeriod * mRefreshSkipCount;
-
mThread->updateModel(mPeriod, mPhase, mReferenceTime);
mModelUpdated = true;
}
@@ -719,10 +709,6 @@
return;
}
- // Need to compare present fences against the un-adjusted refresh period,
- // since they might arrive between two events.
- nsecs_t period = mPeriod / (1 + mRefreshSkipCount);
-
int numErrSamples = 0;
nsecs_t sqErrSum = 0;
@@ -741,9 +727,9 @@
continue;
}
- nsecs_t sampleErr = (sample - mPhase) % period;
- if (sampleErr > period / 2) {
- sampleErr -= period;
+ nsecs_t sampleErr = (sample - mPhase) % mPeriod;
+ if (sampleErr > mPeriod / 2) {
+ sampleErr -= mPeriod;
}
sqErrSum += sampleErr * sampleErr;
numErrSamples++;
@@ -798,8 +784,7 @@
void DispSync::dump(std::string& result) const {
Mutex::Autolock lock(mMutex);
StringAppendF(&result, "present fences are %s\n", mIgnorePresentFences ? "ignored" : "used");
- StringAppendF(&result, "mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n", mPeriod,
- 1000000000.0 / mPeriod, mRefreshSkipCount);
+ StringAppendF(&result, "mPeriod: %" PRId64 " ns (%.3f fps)\n", mPeriod, 1000000000.0 / mPeriod);
StringAppendF(&result, "mPhase: %" PRId64 " ns\n", mPhase);
StringAppendF(&result, "mError: %" PRId64 " ns (sqrt=%.1f)\n", mError, sqrt(mError));
StringAppendF(&result, "mNumResyncSamplesSincePresent: %d (limit %d)\n",
diff --git a/services/surfaceflinger/Scheduler/DispSync.h b/services/surfaceflinger/Scheduler/DispSync.h
index f5175ba..c6aadbb 100644
--- a/services/surfaceflinger/Scheduler/DispSync.h
+++ b/services/surfaceflinger/Scheduler/DispSync.h
@@ -53,7 +53,6 @@
virtual void endResync() = 0;
virtual void setPeriod(nsecs_t period) = 0;
virtual nsecs_t getPeriod() = 0;
- virtual void setRefreshSkipCount(int count) = 0;
virtual status_t addEventListener(const char* name, nsecs_t phase, Callback* callback,
nsecs_t lastCallbackTime) = 0;
virtual status_t removeEventListener(Callback* callback, nsecs_t* outLastCallback) = 0;
@@ -137,12 +136,6 @@
// The getPeriod method returns the current vsync period.
nsecs_t getPeriod() override;
- // setRefreshSkipCount specifies an additional number of refresh
- // cycles to skip. For example, on a 60Hz display, a skip count of 1
- // will result in events happening at 30Hz. Default is zero. The idea
- // is to sacrifice smoothness for battery life.
- void setRefreshSkipCount(int count) override;
-
// addEventListener registers a callback to be called repeatedly at the
// given phase offset from the hardware vsync events. The callback is
// called from a separate thread and it should return reasonably quickly
@@ -251,8 +244,6 @@
std::shared_ptr<FenceTime> mPresentFences[NUM_PRESENT_SAMPLES]{FenceTime::NO_FENCE};
size_t mPresentSampleOffset;
- int mRefreshSkipCount = 0;
-
// mThread is the thread from which all the callbacks are called.
sp<DispSyncThread> mThread;
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 7f1fb3b..8d9357a 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -268,10 +268,6 @@
}
}
-void Scheduler::setRefreshSkipCount(int count) {
- mPrimaryDispSync->setRefreshSkipCount(count);
-}
-
void Scheduler::setVsyncPeriod(nsecs_t period) {
std::lock_guard<std::mutex> lock(mHWVsyncLock);
mPrimaryDispSync->setPeriod(period);
diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h
index f733317..c15f793 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.h
+++ b/services/surfaceflinger/Scheduler/Scheduler.h
@@ -94,7 +94,6 @@
// DispSync detected that the vsync period changed, and false otherwise.
void addResyncSample(nsecs_t timestamp, bool* periodFlushed);
void addPresentFence(const std::shared_ptr<FenceTime>&);
- void setRefreshSkipCount(int count);
void setIgnorePresentFences(bool ignore);
nsecs_t getDispSyncExpectedPresentTime();
// Registers the layer in the scheduler, and returns the handle for future references.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index bf03b13..e804923 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4996,13 +4996,8 @@
updateColorMatrixLocked();
return NO_ERROR;
}
- // This is an experimental interface
- // Needs to be shifted to proper binder interface when we productize
- case 1016: {
- n = data.readInt32();
- // TODO(b/113612090): Evaluate if this can be removed.
- mScheduler->setRefreshSkipCount(n);
- return NO_ERROR;
+ case 1016: { // Unused.
+ return NAME_NOT_FOUND;
}
case 1017: {
n = data.readInt32();