blob: 656673e672fe466193bd0526a03e9e86aeb35fd0 [file] [log] [blame]
Chia-I Wub0b5a4d2016-10-17 14:56:15 +08001/*
2 * Copyright 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Chia-I Wu16624b62017-02-02 09:03:20 -080017#define LOG_TAG "android.hardware.graphics.composer@2.1-service"
18
Chia-I Wu4a71a732017-02-10 08:11:55 -080019#include <sched.h>
20
Chia-I Wu16624b62017-02-02 09:03:20 -080021#include <android/hardware/graphics/composer/2.1/IComposer.h>
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080022
23#include <binder/ProcessState.h>
Chia-I Wu16624b62017-02-02 09:03:20 -080024#include <hidl/LegacySupport.h>
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080025
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080026using android::hardware::graphics::composer::V2_1::IComposer;
Chia-I Wu16624b62017-02-02 09:03:20 -080027using android::hardware::defaultPassthroughServiceImplementation;
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080028
Chia-I Wu16624b62017-02-02 09:03:20 -080029int main() {
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080030 // the conventional HAL might start binder services
31 android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
32 android::ProcessState::self()->startThreadPool();
33
Chia-I Wu4a71a732017-02-10 08:11:55 -080034 // same as SF main thread
35 struct sched_param param = {0};
36 param.sched_priority = 2;
37 if (sched_setscheduler(0, SCHED_FIFO | SCHED_RESET_ON_FORK,
38 &param) != 0) {
39 ALOGE("Couldn't set SCHED_FIFO: %d", errno);
40 }
41
Chia-I Wu16624b62017-02-02 09:03:20 -080042 return defaultPassthroughServiceImplementation<IComposer>("hwcomposer");
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080043}