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

Commit 1047e5ef authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: Update RefreshRateOverlay before SF applies transactions

The current implementation of RefreshRateOverlay changes it's buffer
to reflect the upcoming refresh rate after SF applies transaction.
This is causing SF to see a layer update and reset the idle timer,
entering a live loop of refresh rate switches.

Instead, we update the RefreshRateOverlay when the refresh rate change is
done and before SF applies transactions for the next frame.

Bug: 192204776
Test: Enable RefreshRateOverlay on a device with idle timer enabled
Change-Id: Ie904d6f37b7a02126d52a6267246afaf33982eff
parent e89521f7
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -1189,6 +1189,10 @@ void SurfaceFlinger::setActiveModeInternal() {
    updatePhaseConfiguration(refreshRate);
    updatePhaseConfiguration(refreshRate);
    ATRACE_INT("ActiveConfigFPS", refreshRate.getValue());
    ATRACE_INT("ActiveConfigFPS", refreshRate.getValue());


    if (mRefreshRateOverlay) {
        mRefreshRateOverlay->changeRefreshRate(upcomingMode->getFps());
    }

    if (mUpcomingActiveMode.event != Scheduler::ModeEvent::None) {
    if (mUpcomingActiveMode.event != Scheduler::ModeEvent::None) {
        const nsecs_t vsyncPeriod = refreshRate.getPeriodNsecs();
        const nsecs_t vsyncPeriod = refreshRate.getPeriodNsecs();
        const auto physicalId = display->getPhysicalId();
        const auto physicalId = display->getPhysicalId();
@@ -1271,9 +1275,6 @@ void SurfaceFlinger::performSetActiveMode() {
    }
    }


    mScheduler->onNewVsyncPeriodChangeTimeline(outTimeline);
    mScheduler->onNewVsyncPeriodChangeTimeline(outTimeline);
    if (mRefreshRateOverlay) {
        mRefreshRateOverlay->changeRefreshRate(desiredMode->getFps());
    }


    // Scheduler will submit an empty frame to HWC if needed.
    // Scheduler will submit an empty frame to HWC if needed.
    mSetActiveModePending = true;
    mSetActiveModePending = true;