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

Commit 1afa8b0f authored by David Sodman's avatar David Sodman
Browse files

Revert "SF: enable high refresh rate virtual mode"

This reverts commit 6d46c1e2.

Test: None
Change-Id: Ib0dffc67508398316bea4bc5d5613ffd69226011
parent d36dc025
Loading
Loading
Loading
Loading
+1 −11
Original line number Original line Diff line number Diff line
@@ -23,7 +23,6 @@
#undef HWC2_INCLUDE_STRINGIFICATION
#undef HWC2_INCLUDE_STRINGIFICATION
#undef HWC2_USE_CPP11
#undef HWC2_USE_CPP11


#include <cutils/properties.h>
#include <gui/HdrMetadata.h>
#include <gui/HdrMetadata.h>
#include <math/mat4.h>
#include <math/mat4.h>
#include <ui/GraphicTypes.h>
#include <ui/GraphicTypes.h>
@@ -161,8 +160,6 @@ public:
            }
            }
            Builder& setVsyncPeriod(int32_t vsyncPeriod) {
            Builder& setVsyncPeriod(int32_t vsyncPeriod) {
                mConfig->mVsyncPeriod = vsyncPeriod;
                mConfig->mVsyncPeriod = vsyncPeriod;
                mConfig->mPeriodMultiplier = 1;
                mConfig->mPeriodDivisor = 1;
                return *this;
                return *this;
            }
            }
            Builder& setDpiX(int32_t dpiX) {
            Builder& setDpiX(int32_t dpiX) {
@@ -192,12 +189,7 @@ public:


        int32_t getWidth() const { return mWidth; }
        int32_t getWidth() const { return mWidth; }
        int32_t getHeight() const { return mHeight; }
        int32_t getHeight() const { return mHeight; }
        nsecs_t getVsyncPeriod() const {
        nsecs_t getVsyncPeriod() const { return mVsyncPeriod; }
            return mVsyncPeriod * mPeriodMultiplier / mPeriodDivisor; }
        void scalePanelFrequency(int32_t multiplier, int32_t divisor) const {
            mPeriodMultiplier = multiplier;
            mPeriodDivisor = divisor;
        }
        float getDpiX() const { return mDpiX; }
        float getDpiX() const { return mDpiX; }
        float getDpiY() const { return mDpiY; }
        float getDpiY() const { return mDpiY; }


@@ -210,8 +202,6 @@ public:
        int32_t mWidth;
        int32_t mWidth;
        int32_t mHeight;
        int32_t mHeight;
        nsecs_t mVsyncPeriod;
        nsecs_t mVsyncPeriod;
        mutable int32_t mPeriodMultiplier;
        mutable int32_t mPeriodDivisor;
        float mDpiX;
        float mDpiX;
        float mDpiY;
        float mDpiY;
    };
    };
+3 −15
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include <algorithm>
#include <algorithm>


#include <log/log.h>
#include <log/log.h>
#include <cutils/properties.h>
#include <utils/String8.h>
#include <utils/String8.h>
#include <utils/Thread.h>
#include <utils/Thread.h>
#include <utils/Trace.h>
#include <utils/Trace.h>
@@ -520,25 +521,12 @@ status_t DispSync::changePhaseOffset(Callback* callback, nsecs_t phase) {


void DispSync::setPeriod(nsecs_t period) {
void DispSync::setPeriod(nsecs_t period) {
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);
    mPeriodBase = mPeriod = period;
    mPeriod = period;
    mPhase = 0;
    mPhase = 0;
    mReferenceTime = 0;
    mReferenceTime = 0;
    mThread->updateModel(mPeriod, mPhase, mReferenceTime);
    mThread->updateModel(mPeriod, mPhase, mReferenceTime);
}
}


void DispSync::scalePeriod(uint32_t multiplier, uint32_t divisor) {
    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;

    mPeriod = mPeriodBase * multiplier / divisor;
    mThread->updateModel(mPeriod, mPhase, mReferenceTime);
}

nsecs_t DispSync::getPeriod() {
nsecs_t DispSync::getPeriod() {
    // lock mutex as mPeriod changes multiple times in updateModelLocked
    // lock mutex as mPeriod changes multiple times in updateModelLocked
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);
@@ -563,7 +551,7 @@ void DispSync::updateModelLocked() {


        // Exclude the min and max from the average
        // Exclude the min and max from the average
        durationSum -= minDuration + maxDuration;
        durationSum -= minDuration + maxDuration;
        mPeriodBase = mPeriod = durationSum / (mNumResyncSamples - 3);
        mPeriod = durationSum / (mNumResyncSamples - 3);


        ALOGV("[%s] mPeriod = %" PRId64, mName, ns2us(mPeriod));
        ALOGV("[%s] mPeriod = %" PRId64, mName, ns2us(mPeriod));


+0 −8
Original line number Original line Diff line number Diff line
@@ -48,7 +48,6 @@ public:
    virtual bool addResyncSample(nsecs_t timestamp) = 0;
    virtual bool addResyncSample(nsecs_t timestamp) = 0;
    virtual void endResync() = 0;
    virtual void endResync() = 0;
    virtual void setPeriod(nsecs_t period) = 0;
    virtual void setPeriod(nsecs_t period) = 0;
    virtual void scalePeriod(const uint32_t multiplier, uint32_t divisor) = 0;
    virtual nsecs_t getPeriod() = 0;
    virtual nsecs_t getPeriod() = 0;
    virtual void setRefreshSkipCount(int count) = 0;
    virtual void setRefreshSkipCount(int count) = 0;
    virtual status_t addEventListener(const char* name, nsecs_t phase, Callback* callback) = 0;
    virtual status_t addEventListener(const char* name, nsecs_t phase, Callback* callback) = 0;
@@ -119,12 +118,6 @@ public:
    // turned on.  It should NOT be used after that.
    // turned on.  It should NOT be used after that.
    void setPeriod(nsecs_t period) override;
    void setPeriod(nsecs_t period) override;


    // The scalePeriod method applies the multiplier and divisor to
    // 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);

    // The getPeriod method returns the current vsync period.
    // The getPeriod method returns the current vsync period.
    nsecs_t getPeriod() override;
    nsecs_t getPeriod() override;


@@ -187,7 +180,6 @@ private:
    // mPeriod is the computed period of the modeled vsync events in
    // mPeriod is the computed period of the modeled vsync events in
    // nanoseconds.
    // nanoseconds.
    nsecs_t mPeriod;
    nsecs_t mPeriod;
    nsecs_t mPeriodBase;


    // mPhase is the phase offset of the modeled vsync events.  It is the
    // mPhase is the phase offset of the modeled vsync events.  It is the
    // number of nanoseconds from time 0 to the first vsync event.
    // number of nanoseconds from time 0 to the first vsync event.
+0 −36
Original line number Original line Diff line number Diff line
@@ -5031,42 +5031,6 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                reply->writeBool(getBE().mHwc->isUsingVrComposer());
                reply->writeBool(getBE().mHwc->isUsingVrComposer());
                return NO_ERROR;
                return NO_ERROR;
            }
            }
            case 1029: {
                // Code 1029 is an experimental feature that allows applications to
                // simulate a high frequency panel by setting a multiplier and divisor
                // on the VSYNC-sf clock.  If either the multiplier or divisor are
                // 0, then the code will set both to 1 to return the VSYNC-sf clock
                // to it's normal frequency.
                int multiplier = data.readInt32();
                int divisor = data.readInt32();

                if ((multiplier == 0) || (divisor == 0)) {
                    multiplier = 1;
                    divisor = 1;
                }

                if ((multiplier == 1) && (divisor == 1)) {
                    if (mUseScheduler) {
                        mScheduler->enableHardwareVsync();
                    } else {
                        enableHardwareVsync();
                    }
                    enableHardwareVsync();
                } else {
                    if (mUseScheduler) {
                        mScheduler->disableHardwareVsync(true);
                    } else {
                        disableHardwareVsync(true);
                    }
                }
                getBE().mHwc->getActiveConfig(DisplayDevice::DISPLAY_PRIMARY)
                    ->scalePanelFrequency(multiplier, divisor);
                mPrimaryDispSync->scalePeriod(multiplier, divisor);

                ATRACE_INT("PeriodMultiplier", multiplier);
                ATRACE_INT("PeriodDivisor", divisor);
                return NO_ERROR;
            }
            // Is device color managed?
            // Is device color managed?
            case 1030: {
            case 1030: {
                reply->writeBool(useColorManagement);
                reply->writeBool(useColorManagement);
+0 −1
Original line number Original line Diff line number Diff line
@@ -35,7 +35,6 @@ public:
    MOCK_METHOD1(addResyncSample, bool(nsecs_t));
    MOCK_METHOD1(addResyncSample, bool(nsecs_t));
    MOCK_METHOD0(endResync, void());
    MOCK_METHOD0(endResync, void());
    MOCK_METHOD1(setPeriod, void(nsecs_t));
    MOCK_METHOD1(setPeriod, void(nsecs_t));
    MOCK_METHOD2(scalePeriod, void(uint32_t, uint32_t));
    MOCK_METHOD0(getPeriod, nsecs_t());
    MOCK_METHOD0(getPeriod, nsecs_t());
    MOCK_METHOD1(setRefreshSkipCount, void(int));
    MOCK_METHOD1(setRefreshSkipCount, void(int));
    MOCK_METHOD3(addEventListener, status_t(const char*, nsecs_t, Callback*));
    MOCK_METHOD3(addEventListener, status_t(const char*, nsecs_t, Callback*));