Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d32ddc1 authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Remove Scheduler::setRefreshSkipCount

This is an obsolete experiment dating back to L.

Bug: 130554049
Test: Build
Change-Id: Ib8dfb51177d72ebca1972dd294618b9685542180
parent 98041835
Loading
Loading
Loading
Loading
+4 −19
Original line number Diff line number Diff line
@@ -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);
@@ -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;
    }
@@ -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;

@@ -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++;
@@ -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",
+0 −9
Original line number Diff line number Diff line
@@ -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;
@@ -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
@@ -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;

+0 −4
Original line number Diff line number Diff line
@@ -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);
+0 −1
Original line number Diff line number Diff line
@@ -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.
+2 −7
Original line number Diff line number Diff line
@@ -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();