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 Original line Diff line number Diff line
@@ -67,6 +67,14 @@ public:
        mAppEventThread = appEventThread;
        mAppEventThread = appEventThread;
    }
    }


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

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


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


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


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

    std::atomic<Offsets> mOffsets;
    std::atomic<Offsets> mOffsets;


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


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