surfaceflinger: make critical threads SCHED_FIFO
Sets the main thread, EventThread, and SFEventThread to SCHED_FIFO to
minimize jitter.
bug 24503801
Change-Id: I3751c00c79482842f5c0bdaec92b6cbfe62328a0
diff --git a/services/surfaceflinger/main_surfaceflinger.cpp b/services/surfaceflinger/main_surfaceflinger.cpp
index 97a1e8b..543d0c7 100644
--- a/services/surfaceflinger/main_surfaceflinger.cpp
+++ b/services/surfaceflinger/main_surfaceflinger.cpp
@@ -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 @@
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, ¶m) != 0) {
+ ALOGE("Couldn't set SCHED_FIFO");
+ }
+
// run surface flinger in this thread
flinger->run();