Loading services/surfaceflinger/Scheduler/DispSync.cpp +4 −19 Original line number Diff line number Diff line Loading @@ -617,13 +617,6 @@ status_t DispSync::addEventListener(const char* name, nsecs_t phase, Callback* c 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); Loading Loading @@ -706,9 +699,6 @@ void DispSync::updateModelLocked() { ALOGV("[%s] Adjusting mPhase -> %" PRId64, mName, ns2us(mPhase)); } // Artificially inflate the period if requested. mPeriod += mPeriod * mRefreshSkipCount; mThread->updateModel(mPeriod, mPhase, mReferenceTime); mModelUpdated = true; } Loading @@ -719,10 +709,6 @@ void DispSync::updateErrorLocked() { 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; Loading @@ -741,9 +727,9 @@ void DispSync::updateErrorLocked() { 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++; Loading Loading @@ -798,8 +784,7 @@ void DispSync::setIgnorePresentFences(bool ignore) { 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", Loading services/surfaceflinger/Scheduler/DispSync.h +0 −9 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ public: 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; Loading Loading @@ -137,12 +136,6 @@ public: // 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 Loading Loading @@ -251,8 +244,6 @@ private: 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; Loading services/surfaceflinger/Scheduler/Scheduler.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -268,10 +268,6 @@ void Scheduler::VsyncState::resync(const GetVsyncPeriod& getVsyncPeriod) { } } void Scheduler::setRefreshSkipCount(int count) { mPrimaryDispSync->setRefreshSkipCount(count); } void Scheduler::setVsyncPeriod(nsecs_t period) { std::lock_guard<std::mutex> lock(mHWVsyncLock); mPrimaryDispSync->setPeriod(period); Loading services/surfaceflinger/Scheduler/Scheduler.h +0 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,6 @@ public: // 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. Loading services/surfaceflinger/SurfaceFlinger.cpp +2 −7 Original line number Diff line number Diff line Loading @@ -4996,13 +4996,8 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r 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(); Loading Loading
services/surfaceflinger/Scheduler/DispSync.cpp +4 −19 Original line number Diff line number Diff line Loading @@ -617,13 +617,6 @@ status_t DispSync::addEventListener(const char* name, nsecs_t phase, Callback* c 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); Loading Loading @@ -706,9 +699,6 @@ void DispSync::updateModelLocked() { ALOGV("[%s] Adjusting mPhase -> %" PRId64, mName, ns2us(mPhase)); } // Artificially inflate the period if requested. mPeriod += mPeriod * mRefreshSkipCount; mThread->updateModel(mPeriod, mPhase, mReferenceTime); mModelUpdated = true; } Loading @@ -719,10 +709,6 @@ void DispSync::updateErrorLocked() { 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; Loading @@ -741,9 +727,9 @@ void DispSync::updateErrorLocked() { 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++; Loading Loading @@ -798,8 +784,7 @@ void DispSync::setIgnorePresentFences(bool ignore) { 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", Loading
services/surfaceflinger/Scheduler/DispSync.h +0 −9 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ public: 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; Loading Loading @@ -137,12 +136,6 @@ public: // 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 Loading Loading @@ -251,8 +244,6 @@ private: 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; Loading
services/surfaceflinger/Scheduler/Scheduler.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -268,10 +268,6 @@ void Scheduler::VsyncState::resync(const GetVsyncPeriod& getVsyncPeriod) { } } void Scheduler::setRefreshSkipCount(int count) { mPrimaryDispSync->setRefreshSkipCount(count); } void Scheduler::setVsyncPeriod(nsecs_t period) { std::lock_guard<std::mutex> lock(mHWVsyncLock); mPrimaryDispSync->setPeriod(period); Loading
services/surfaceflinger/Scheduler/Scheduler.h +0 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,6 @@ public: // 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. Loading
services/surfaceflinger/SurfaceFlinger.cpp +2 −7 Original line number Diff line number Diff line Loading @@ -4996,13 +4996,8 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r 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(); Loading