blob: 82a33f6a4e385016c40ab20f192a388553529349 [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
Iliyan Malchevf140afe2017-04-05 13:13:09 -070031 android::ProcessState::initWithDriver("/dev/vndbinder");
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080032 android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
33 android::ProcessState::self()->startThreadPool();
34
Chia-I Wu4a71a732017-02-10 08:11:55 -080035 // same as SF main thread
36 struct sched_param param = {0};
37 param.sched_priority = 2;
38 if (sched_setscheduler(0, SCHED_FIFO | SCHED_RESET_ON_FORK,
39 &param) != 0) {
40 ALOGE("Couldn't set SCHED_FIFO: %d", errno);
41 }
42
Chia-I Wuec71f002017-05-11 15:20:10 -070043 return defaultPassthroughServiceImplementation<IComposer>(4);
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080044}