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

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

surfaceflinger: make EventThread FIFO

Jitter in EventThread scheduling was contributing to SystemUI jank.

Test: thread is FIFO
bug 36631902

Change-Id: I930c729b27403ef8941e9a1e0ef8ec57a3d323a0
parent 8bba03d3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -548,12 +548,15 @@ void SurfaceFlinger::init() {
        mSFEventThread = new EventThread(sfVsyncSrc, *this, true);
        mEventQueue.setEventThread(mSFEventThread);

        // set SFEventThread to SCHED_FIFO to minimize jitter
        // set EventThread and SFEventThread to SCHED_FIFO to minimize jitter
        struct sched_param param = {0};
        param.sched_priority = 2;
        if (sched_setscheduler(mSFEventThread->getTid(), SCHED_FIFO, &param) != 0) {
            ALOGE("Couldn't set SCHED_FIFO for SFEventThread");
        }
        if (sched_setscheduler(mEventThread->getTid(), SCHED_FIFO, &param) != 0) {
            ALOGE("Couldn't set SCHED_FIFO for EventThread");
        }

        // Get a RenderEngine for the given display / config (can't fail)
        mRenderEngine = RenderEngine::create(mEGLDisplay,
+4 −2
Original line number Diff line number Diff line
@@ -520,13 +520,15 @@ void SurfaceFlinger::init() {
    mSFEventThread = new EventThread(sfVsyncSrc, *this, true);
    mEventQueue.setEventThread(mSFEventThread);

    // set SFEventThread to SCHED_FIFO to minimize jitter
    // set EventThread and SFEventThread to SCHED_FIFO to minimize jitter
    struct sched_param param = {0};
    param.sched_priority = 2;
    if (sched_setscheduler(mSFEventThread->getTid(), SCHED_FIFO, &param) != 0) {
        ALOGE("Couldn't set SCHED_FIFO for SFEventThread");
    }

    if (sched_setscheduler(mEventThread->getTid(), SCHED_FIFO, &param) != 0) {
        ALOGE("Couldn't set SCHED_FIFO for EventThread");
    }

    // Initialize the H/W composer object.  There may or may not be an
    // actual hardware composer underneath.