graphics: use FIFO scheduler in IComposer

Make IComposer default implementation use the same process scheduler
as SurfaceFlinger does.

Bug: 35210697
Test: manual
Change-Id: Ie2ebe1d3fd26505984d9f6c33d63b5db36b0b64a
This commit is contained in:
Chia-I Wu 2017-02-10 08:11:55 -08:00
parent 71b3bafa59
commit 4a71a73843
2 changed files with 11 additions and 0 deletions

View file

@ -2,4 +2,5 @@ service hwcomposer-2-1 /system/bin/hw/android.hardware.graphics.composer@2.1-ser
class hal
user system
group graphics drmrpc readproc
capabilities SYS_NICE
onrestart restart surfaceflinger

View file

@ -16,6 +16,8 @@
#define LOG_TAG "android.hardware.graphics.composer@2.1-service"
#include <sched.h>
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <binder/ProcessState.h>
@ -29,5 +31,13 @@ int main() {
android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
android::ProcessState::self()->startThreadPool();
// same as SF main thread
struct sched_param param = {0};
param.sched_priority = 2;
if (sched_setscheduler(0, SCHED_FIFO | SCHED_RESET_ON_FORK,
&param) != 0) {
ALOGE("Couldn't set SCHED_FIFO: %d", errno);
}
return defaultPassthroughServiceImplementation<IComposer>("hwcomposer");
}