diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index 6a6547bdf..4f288402b 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -21,6 +21,7 @@ #include "InputManager.h" #include +#include namespace android { @@ -51,13 +52,15 @@ void InputManager::initialize() { } status_t InputManager::start() { - status_t result = mDispatcherThread->run("InputDispatcher", PRIORITY_URGENT_DISPLAY); + status_t result = mDispatcherThread->run("InputDispatcher", + PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); if (result) { ALOGE("Could not start InputDispatcher thread due to error %d.", result); return result; } - result = mReaderThread->run("InputReader", PRIORITY_URGENT_DISPLAY); + result = mReaderThread->run("InputReader", + PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); if (result) { ALOGE("Could not start InputReader thread due to error %d.", result); @@ -65,6 +68,9 @@ status_t InputManager::start() { return result; } + android_set_rt_ioprio(mDispatcherThread->getTid(), 1); + android_set_rt_ioprio(mReaderThread->getTid(), 1); + return OK; } diff --git a/services/surfaceflinger/DispSync.cpp b/services/surfaceflinger/DispSync.cpp index 3738a5548..73b389730 100644 --- a/services/surfaceflinger/DispSync.cpp +++ b/services/surfaceflinger/DispSync.cpp @@ -21,6 +21,7 @@ #include +#include #include #include @@ -292,6 +293,7 @@ DispSync::DispSync() : mThread(new DispSyncThread()) { mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); + android_set_rt_ioprio(mThread->getTid(), 1); reset(); beginResync(); diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index f76020000..973a8bc4c 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -91,6 +92,7 @@ void EventThread::sendVsyncHintOnLocked() { void EventThread::onFirstRef() { run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); + android_set_rt_ioprio(getTid(), 1); } sp EventThread::createEventConnection() const { diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 8e928120e..08769c901 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -512,6 +513,7 @@ void SurfaceFlinger::init() { mEventControlThread = new EventControlThread(this); mEventControlThread->run("EventControl", PRIORITY_URGENT_DISPLAY); + android_set_rt_ioprio(mEventControlThread->getTid(), 1); // set a fake vsync period if there is no HWComposer if (mHwc->initCheck() != NO_ERROR) {