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

Commit 0356d4bf authored by Ady Abraham's avatar Ady Abraham Committed by android-build-merger
Browse files

SurfaceFlinger: correct negative offset when refresh rate changes am: 11b6a70c

am: a3e5aa30

Change-Id: I32bc763302fe5766805a87cb1a71d5195d21ca0e
parents 55ab3976 a3e5aa30
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -78,6 +78,10 @@ void DispSyncSource::setPhaseOffset(nsecs_t phaseOffset) {
    // Normalize phaseOffset to [-period, period)
    const int numPeriods = phaseOffset / period;
    phaseOffset -= numPeriods * period;
    if (mPhaseOffset == phaseOffset) {
        return;
    }

    mPhaseOffset = phaseOffset;
    tracePhaseOffset();

+7 −20
Original line number Diff line number Diff line
@@ -129,30 +129,17 @@ void VSyncModulator::updateOffsets() {

void VSyncModulator::updateOffsetsLocked() {
    const Offsets desired = getNextOffsets();
    const Offsets current = mOffsets;

    bool changed = false;
    if (desired.sf != current.sf) {
    if (mSfConnectionHandle != nullptr) {
        mScheduler->setPhaseOffset(mSfConnectionHandle, desired.sf);
        } else if (mSfEventThread != nullptr) {
            mSfEventThread->setPhaseOffset(desired.sf);
    }
        changed = true;
    }
    if (desired.app != current.app) {

    if (mAppConnectionHandle != nullptr) {
        mScheduler->setPhaseOffset(mAppConnectionHandle, desired.app);
        } else if (mAppEventThread != nullptr) {
            mAppEventThread->setPhaseOffset(desired.app);
        }
        changed = true;
    }

    if (changed) {
    flushOffsets();
}
}

void VSyncModulator::flushOffsets() {
    OffsetType type = getNextOffsetType();
+0 −9
Original line number Diff line number Diff line
@@ -68,12 +68,6 @@ public:
    void setPhaseOffsets(Offsets early, Offsets earlyGl, Offsets late,
                         nsecs_t thresholdForNextVsync) EXCLUDES(mMutex);

    // Sets handles to the SF and app event threads.
    void setEventThreads(EventThread* sfEventThread, EventThread* appEventThread) {
        mSfEventThread = sfEventThread;
        mAppEventThread = appEventThread;
    }

    // Sets the scheduler and vsync connection handlers.
    void setSchedulerAndHandles(Scheduler* scheduler,
                                Scheduler::ConnectionHandle* appConnectionHandle,
@@ -121,9 +115,6 @@ private:
    std::unordered_map<OffsetType, Offsets> mOffsetMap GUARDED_BY(mMutex);
    nsecs_t mThresholdForNextVsync;

    EventThread* mSfEventThread = nullptr;
    EventThread* mAppEventThread = nullptr;

    Scheduler* mScheduler = nullptr;
    Scheduler::ConnectionHandle* mAppConnectionHandle = nullptr;
    Scheduler::ConnectionHandle* mSfConnectionHandle = nullptr;