1 /*
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 */
17 #define LOG_TAG "android.hardware.graphics.composer@2.1-service"
19 #include <sched.h>
21 #include <android/hardware/graphics/composer/2.1/IComposer.h>
23 #include <binder/ProcessState.h>
24 #include <hidl/LegacySupport.h>
26 using android::hardware::graphics::composer::V2_1::IComposer;
27 using android::hardware::defaultPassthroughServiceImplementation;
29 int main() {
30 // the conventional HAL might start binder services
31 android::ProcessState::initWithDriver("/dev/vndbinder");
32 android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
33 android::ProcessState::self()->startThreadPool();
35 // 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 ¶m) != 0) {
40 ALOGE("Couldn't set SCHED_FIFO: %d", errno);
41 }
43 return defaultPassthroughServiceImplementation<IComposer>(4);
44 }