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

Commit 2a8f3d2a authored by Ana Krulec's avatar Ana Krulec Committed by Android (Google) Code Review
Browse files

Merge "SF: Moving Vsync modulator away from threads."

parents 6afb474a 12096d05
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -67,6 +67,14 @@ public:
        mAppEventThread = appEventThread;
    }

    void setSchedulerAndHandles(Scheduler* scheduler,
                                Scheduler::ConnectionHandle* appConnectionHandle,
                                Scheduler::ConnectionHandle* sfConnectionHandle) {
        mScheduler = scheduler;
        mAppConnectionHandle = appConnectionHandle;
        mSfConnectionHandle = sfConnectionHandle;
    }

    void setTransactionStart(TransactionStart transactionStart) {
        if (transactionStart == TransactionStart::EARLY) {
            mRemainingEarlyFrameCount = MIN_EARLY_FRAME_COUNT;
@@ -108,11 +116,19 @@ private:

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

@@ -138,6 +154,10 @@ private:
    EventThread* mSfEventThread = nullptr;
    EventThread* mAppEventThread = nullptr;

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

    std::atomic<Offsets> mOffsets;

    std::atomic<TransactionStart> mTransactionStart = TransactionStart::NORMAL;
+2 −2
Original line number Diff line number Diff line
@@ -632,8 +632,8 @@ void SurfaceFlinger::init() {
                                             });

        mEventQueue->setEventConnection(mScheduler->getEventConnection(mSfConnectionHandle));
        mVsyncModulator.setEventThreads(mScheduler->getEventThread(mSfConnectionHandle),
                                        mScheduler->getEventThread(mAppConnectionHandle));
        mVsyncModulator.setSchedulerAndHandles(mScheduler.get(), mAppConnectionHandle.get(),
                                               mSfConnectionHandle.get());
    } else {
        mEventThreadSource =
                std::make_unique<DispSyncSource>(mPrimaryDispSync.get(),