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

Commit 795e0b1d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "SF: Tie main thread priority to active display" into udc-dev am: b270da4e am: a498067c

parents dc51fa8d a498067c
Loading
Loading
Loading
Loading
+27 −16
Original line number Diff line number Diff line
@@ -5396,14 +5396,19 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
            onActiveDisplayChangedLocked(activeDisplay.get(), *display);
        }

        // Keep uclamp in a separate syscall and set it before changing to RT due to b/190237315.
        // We can merge the syscall later.
        if (SurfaceFlinger::setSchedAttr(true) != NO_ERROR) {
            ALOGW("Couldn't set uclamp.min on display on: %s\n", strerror(errno));
        if (displayId == mActiveDisplayId) {
            // TODO(b/281692563): Merge the syscalls. For now, keep uclamp in a separate syscall and
            // set it before SCHED_FIFO due to b/190237315.
            if (setSchedAttr(true) != NO_ERROR) {
                ALOGW("Failed to set uclamp.min after powering on active display: %s",
                      strerror(errno));
            }
            if (setSchedFifo(true) != NO_ERROR) {
                ALOGW("Failed to set SCHED_FIFO after powering on active display: %s",
                      strerror(errno));
            }
        if (SurfaceFlinger::setSchedFifo(true) != NO_ERROR) {
            ALOGW("Couldn't set SCHED_FIFO on display on: %s\n", strerror(errno));
        }

        getHwComposer().setPowerMode(displayId, mode);
        if (displayId == mActiveDisplayId && mode != hal::PowerMode::DOZE_SUSPEND) {
            setHWCVsyncEnabled(displayId,
@@ -5417,16 +5422,22 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
        scheduleComposite(FrameHint::kActive);
    } else if (mode == hal::PowerMode::OFF) {
        // Turn off the display
        if (SurfaceFlinger::setSchedFifo(false) != NO_ERROR) {
            ALOGW("Couldn't set SCHED_OTHER on display off: %s\n", strerror(errno));

        if (displayId == mActiveDisplayId) {
            if (setSchedFifo(false) != NO_ERROR) {
                ALOGW("Failed to set SCHED_OTHER after powering off active display: %s",
                      strerror(errno));
            }
        if (SurfaceFlinger::setSchedAttr(false) != NO_ERROR) {
            ALOGW("Couldn't set uclamp.min on display off: %s\n", strerror(errno));
            if (setSchedAttr(false) != NO_ERROR) {
                ALOGW("Failed set uclamp.min after powering off active display: %s",
                      strerror(errno));
            }
        if (displayId == mActiveDisplayId && *currentModeOpt != hal::PowerMode::DOZE_SUSPEND) {

            if (*currentModeOpt != hal::PowerMode::DOZE_SUSPEND) {
                mScheduler->disableHardwareVsync(displayId, true);
                mScheduler->enableSyntheticVsync();
            }
        }

        // Make sure HWVsync is disabled before turning off the display
        setHWCVsyncEnabled(displayId, false);
+2 −2
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ int main(int, char**) {
    // Set uclamp.min setting on all threads, maybe an overkill but we want
    // to cover important threads like RenderEngine.
    if (SurfaceFlinger::setSchedAttr(true) != NO_ERROR) {
        ALOGW("Couldn't set uclamp.min: %s\n", strerror(errno));
        ALOGW("Failed to set uclamp.min during boot: %s", strerror(errno));
    }

    // The binder threadpool we start will inherit sched policy and priority
@@ -155,7 +155,7 @@ int main(int, char**) {
    startDisplayService(); // dependency on SF getting registered above

    if (SurfaceFlinger::setSchedFifo(true) != NO_ERROR) {
        ALOGW("Couldn't set to SCHED_FIFO: %s", strerror(errno));
        ALOGW("Failed to set SCHED_FIFO during boot: %s", strerror(errno));
    }

    // run surface flinger in this thread