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

Commit 5945161b authored by Rachel Lee's avatar Rachel Lee Committed by Automerger Merge Worker
Browse files

Merge "Return frame period from vsynctracker." into tm-dev am: 4d035493 am: 90f91173

parents a9fd1bf2 90f91173
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -167,18 +167,19 @@ impl::EventThread::ThrottleVsyncCallback Scheduler::makeThrottleVsyncCallback()
impl::EventThread::GetVsyncPeriodFunction Scheduler::makeGetVsyncPeriodFunction() const {
    return [this](uid_t uid) {
        const Fps refreshRate = holdRefreshRateConfigs()->getActiveMode()->getFps();
        const nsecs_t basePeriod = refreshRate.getPeriodNsecs();
        const auto currentPeriod =
                mVsyncSchedule->getTracker().currentPeriod() ?: refreshRate.getPeriodNsecs();

        const auto frameRate = getFrameRateOverride(uid);
        if (!frameRate.has_value()) {
            return basePeriod;
            return currentPeriod;
        }

        const auto divisor = RefreshRateConfigs::getFrameRateDivisor(refreshRate, *frameRate);
        if (divisor <= 1) {
            return basePeriod;
            return currentPeriod;
        }
        return basePeriod * divisor;
        return currentPeriod * divisor;
    };
}