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

Commit 2e153088 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: VSyncReactor add period modification functions"

parents b8fb471b ee2ad9f4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -87,4 +87,12 @@ nsecs_t VSyncReactor::expectedPresentTime() {
    return mTracker->nextAnticipatedVSyncTimeFrom(mClock->now());
}

void VSyncReactor::setPeriod(nsecs_t period) {
    mTracker->setPeriod(period);
}

nsecs_t VSyncReactor::getPeriod() {
    return mTracker->currentPeriod();
}

} // namespace android::scheduler
+3 −0
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@ public:
    nsecs_t computeNextRefresh(int periodOffset) const;
    nsecs_t expectedPresentTime();

    void setPeriod(nsecs_t period);
    nsecs_t getPeriod();

private:
    std::unique_ptr<Clock> const mClock;
    std::unique_ptr<VSyncDispatch> const mDispatch;
+7 −0
Original line number Diff line number Diff line
@@ -54,6 +54,13 @@ public:
     */
    virtual nsecs_t currentPeriod() const = 0;

    /*
     * Inform the tracker that the period is changing and the tracker needs to recalibrate itself.
     *
     * \param [in] period   The period that the system is changing into.
     */
    virtual void setPeriod(nsecs_t period) = 0;

protected:
    VSyncTracker(VSyncTracker const&) = delete;
    VSyncTracker& operator=(VSyncTracker const&) = delete;
+4 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ public:

    nsecs_t currentPeriod() const final { return mPeriod; }

    void setPeriod(nsecs_t) final {}

private:
    nsecs_t const mPeriod;
};
@@ -80,6 +82,8 @@ public:
        return mPeriod;
    }

    void setPeriod(nsecs_t) final {}

private:
    std::mutex mutable mMutex;
    nsecs_t mPeriod;
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public:
    MOCK_METHOD1(addVsyncTimestamp, void(nsecs_t));
    MOCK_CONST_METHOD1(nextAnticipatedVSyncTimeFrom, nsecs_t(nsecs_t));
    MOCK_CONST_METHOD0(currentPeriod, nsecs_t());
    MOCK_METHOD1(setPeriod, void(nsecs_t));

    nsecs_t nextVSyncTime(nsecs_t timePoint) const {
        if (timePoint % mPeriod == 0) {
Loading