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

Commit 4833e210 authored by Zhao Wei Liew's avatar Zhao Wei Liew
Browse files

sf: hwc1: Set SF EventThread to SCHED_FIFO in all cases

Previously, we were only setting the SF EventThread to SCHED_FIFO
when the phase offsets aren't the same. This would probably result
in more jitter for devices whose phase offsets are the same.

This was the result of the Android 7.1 mismerge.

This essentially reverts commit 12f58910
and fixes the Android 7.1 mismerge.

Change-Id: I73594001e381c176410e06865352dff74019ff27
parent c2c32407
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -479,18 +479,23 @@ void SurfaceFlinger::init() {
                sfVsyncPhaseOffsetNs, true, "sf");
        mSFEventThread = new EventThread(sfVsyncSrc, *this);
        mEventQueue.setEventThread(mSFEventThread);

       // set 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");
       }
    } else {
        sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
                         vsyncPhaseOffsetNs, true, "sf-app");
        mEventThread = new EventThread(vsyncSrc, *this);
        mEventQueue.setEventThread(mEventThread);
    }

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