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

Commit a91605e0 authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: turn off kernel idle timer when refresh rate switching is disabled

Previously we had an optimization to keep the timer state as is if
the lowest refresh rate setting is the refresh rate the device is locked
at and refresh rate switching is disabled. Removing this optimization
as it is confusing and doesn't provide a lot of added value.

Bug: 191435579
Test: SF unit tests
Change-Id: I206d625c2fafd27623e2c1353a48d56a3b771c7b
parent 899dcdb6
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -859,11 +859,6 @@ RefreshRateConfigs::KernelIdleTimerAction RefreshRateConfigs::getIdleTimerAction
        return RefreshRateConfigs::KernelIdleTimerAction::TurnOff;
    }
    if (minByPolicy == maxByPolicy) {
        // Do not sent the call to toggle off kernel idle timer if the device min and policy min and
        // max are all the same. This saves us extra unnecessary calls to sysprop.
        if (deviceMin == minByPolicy) {
            return RefreshRateConfigs::KernelIdleTimerAction::NoChange;
        }
        return RefreshRateConfigs::KernelIdleTimerAction::TurnOff;
    }
    // Turn on the timer in all other cases.
+0 −1
Original line number Diff line number Diff line
@@ -318,7 +318,6 @@ public:
    // Class to enumerate options around toggling the kernel timer on and off. We have an option
    // for no change to avoid extra calls to kernel.
    enum class KernelIdleTimerAction {
        NoChange, // Do not change the idle timer.
        TurnOff,  // Turn off the idle timer.
        TurnOn    // Turn on the idle timer.
    };
+0 −2
Original line number Diff line number Diff line
@@ -5808,8 +5808,6 @@ void SurfaceFlinger::toggleKernelIdleTimer() {
                mKernelIdleTimerEnabled = true;
            }
            break;
        case KernelIdleTimerAction::NoChange:
            break;
    }
}

+2 −2
Original line number Diff line number Diff line
@@ -1864,10 +1864,10 @@ TEST_F(RefreshRateConfigsTest, testKernelIdleTimerAction) {
              0);
    EXPECT_EQ(KernelIdleTimerAction::TurnOn, refreshRateConfigs->getIdleTimerAction());

    // SetPolicy(60, 60), current 60Hz => NoChange, avoid extra calls.
    // SetPolicy(60, 60), current 60Hz => TurnOff
    ASSERT_GE(refreshRateConfigs->setDisplayManagerPolicy({HWC_CONFIG_ID_60, {Fps(60), Fps(60)}}),
              0);
    EXPECT_EQ(KernelIdleTimerAction::NoChange, refreshRateConfigs->getIdleTimerAction());
    EXPECT_EQ(KernelIdleTimerAction::TurnOff, refreshRateConfigs->getIdleTimerAction());

    // SetPolicy(90, 90), current 90Hz => TurnOff.
    ASSERT_GE(refreshRateConfigs->setDisplayManagerPolicy({HWC_CONFIG_ID_90, {Fps(90), Fps(90)}}),