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

Commit ce680f8b authored by Tim Murray's avatar Tim Murray Committed by android-build-merger
Browse files

surfaceflinger: make critical threads SCHED_FIFO

am: 41a3853c

Change-Id: I06eaa71412abb10e6149fb0fed8ab1824f48e09f
parents ecc4a4ed 41a3853c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -462,6 +462,18 @@ void SurfaceFlinger::init() {
        mSFEventThread = new EventThread(sfVsyncSrc, *this);
        mEventQueue.setEventThread(mSFEventThread);

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

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


        // Get a RenderEngine for the given display / config (can't fail)
        mRenderEngine = RenderEngine::create(mEGLDisplay,
                HAL_PIXEL_FORMAT_RGBA_8888);
+12 −0
Original line number Diff line number Diff line
@@ -459,6 +459,18 @@ void SurfaceFlinger::init() {
    mSFEventThread = new EventThread(sfVsyncSrc, *this);
    mEventQueue.setEventThread(mSFEventThread);

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

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


    // Initialize the H/W composer object.  There may or may not be an
    // actual hardware composer underneath.
    mHwc = new HWComposer(this,
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#include <sys/resource.h>

#include <sched.h>

#include <cutils/sched_policy.h>
#include <binder/IServiceManager.h>
#include <binder/IPCThreadState.h>
@@ -61,6 +63,12 @@ int main(int, char**) {
    sp<GpuService> gpuservice = new GpuService();
    sm->addService(String16(GpuService::SERVICE_NAME), gpuservice, false);

    struct sched_param param = {0};
    param.sched_priority = 1;
    if (sched_setscheduler(0, SCHED_FIFO, &param) != 0) {
        ALOGE("Couldn't set SCHED_FIFO");
    }

    // run surface flinger in this thread
    flinger->run();