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

Commit f9d4e44f authored by Tim Murray's avatar Tim Murray
Browse files

Disable SCHED_FIFO when turning off the display.

There can be long SF runtimes when turning the display on or off. Only
use SCHED_FIFO when we are actively going to be rendering frames, not
when turning the display on or off.

bug 30375418

Change-Id: Ibef8e5f3bba0bafc36f92f9f1b299f015fc335f9
parent acff43dc
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2613,6 +2613,7 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
    }

    if (currentMode == HWC_POWER_MODE_OFF) {
        // Turn on the display
        getHwComposer().setPowerMode(type, mode);
        if (type == DisplayDevice::DISPLAY_PRIMARY) {
            // FIXME: eventthread only knows about the main display right now
@@ -2623,7 +2624,19 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
        mVisibleRegionsDirty = true;
        mHasPoweredOff = true;
        repaintEverything();

        struct sched_param param = {0};
        param.sched_priority = 1;
        if (sched_setscheduler(0, SCHED_FIFO, &param) != 0) {
            ALOGW("Couldn't set SCHED_FIFO on display on");
        }
    } else if (mode == HWC_POWER_MODE_OFF) {
        // Turn off the display
        struct sched_param param = {0};
        if (sched_setscheduler(0, SCHED_OTHER, &param) != 0) {
            ALOGW("Couldn't set SCHED_OTHER on display off");
        }

        if (type == DisplayDevice::DISPLAY_PRIMARY) {
            disableHardwareVsync(true); // also cancels any in-progress resync

+13 −0
Original line number Diff line number Diff line
@@ -2530,6 +2530,7 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
    }

    if (currentMode == HWC_POWER_MODE_OFF) {
        // Turn on the display
        getHwComposer().setPowerMode(type, mode);
        if (type == DisplayDevice::DISPLAY_PRIMARY) {
            // FIXME: eventthread only knows about the main display right now
@@ -2540,7 +2541,19 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
        mVisibleRegionsDirty = true;
        mHasPoweredOff = true;
        repaintEverything();

        struct sched_param param = {0};
        param.sched_priority = 1;
        if (sched_setscheduler(0, SCHED_FIFO, &param) != 0) {
            ALOGW("Couldn't set SCHED_FIFO on display on");
        }
    } else if (mode == HWC_POWER_MODE_OFF) {
        // Turn off the display
        struct sched_param param = {0};
        if (sched_setscheduler(0, SCHED_OTHER, &param) != 0) {
            ALOGW("Couldn't set SCHED_OTHER on display off");
        }

        if (type == DisplayDevice::DISPLAY_PRIMARY) {
            disableHardwareVsync(true); // also cancels any in-progress resync