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

Commit e9316b7f authored by Ady Abraham's avatar Ady Abraham Committed by Wiwit Rifa'i
Browse files

SF: query RefreshRateConfigs for kernel idle timer support

Use the per-display idle timer configuration instead of the global one.

Bug: 188838426
Test: check graphics.display.kernel_idle_timer.enabled can only be
      toggled when the active display is a display that supports kernel
      idle timer.
Change-Id: I4b2258723ed52eb6e94daaff04f65b80d9d0c9d5
parent 6d885930
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -503,9 +503,6 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI

    useFrameRateApi = use_frame_rate_api(true);

    mKernelIdleTimerEnabled = mSupportKernelIdleTimer = sysprop::support_kernel_idle_timer(false);
    base::SetProperty(KERNEL_IDLE_TIMER_PROP, mKernelIdleTimerEnabled ? "true" : "false");

    mRefreshRateOverlaySpinner = property_get_bool("sf.debug.show_refresh_rate_overlay_spinner", 0);

    // Debug property overrides ro. property
@@ -5913,16 +5910,18 @@ void SurfaceFlinger::kernelTimerChanged(bool expired) {
void SurfaceFlinger::toggleKernelIdleTimer() {
    using KernelIdleTimerAction = scheduler::RefreshRateConfigs::KernelIdleTimerAction;

    // If the support for kernel idle timer is disabled in SF code, don't do anything.
    if (!mSupportKernelIdleTimer) {
        return;
    }
    const auto display = getDefaultDisplayDeviceLocked();
    if (!display) {
        ALOGW("%s: default display is null", __func__);
        return;
    }

    // If the support for kernel idle timer is disabled for the active display,
    // don't do anything.
    if (!display->refreshRateConfigs().supportsKernelIdleTimer()) {
        return;
    }

    const KernelIdleTimerAction action = display->refreshRateConfigs().getIdleTimerAction();
    switch (action) {
        case KernelIdleTimerAction::TurnOff:
+0 −2
Original line number Diff line number Diff line
@@ -759,8 +759,6 @@ private:
    // Keeps track of whether the kernel idle timer is currently enabled, so we don't have to
    // make calls to sys prop each time.
    bool mKernelIdleTimerEnabled = false;
    // Keeps track of whether the kernel timer is supported on the SF side.
    bool mSupportKernelIdleTimer = false;
    // Show spinner with refresh rate overlay
    bool mRefreshRateOverlaySpinner = false;