blob: c2a2b191ed5a5dbc1857a38b68b6b55b9920e4f6 [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
17#define LOG_TAG "HWComposerService"
18
19#include <binder/ProcessState.h>
Martijn Coenen02822372016-12-29 14:03:41 +010020#include <hidl/HidlTransportSupport.h>
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080021#include <utils/StrongPointer.h>
22#include "Hwc.h"
23
Martijn Coenen02822372016-12-29 14:03:41 +010024using android::hardware::configureRpcThreadpool;
25using android::hardware::joinRpcThreadpool;
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080026using android::sp;
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080027using android::hardware::graphics::composer::V2_1::IComposer;
28using android::hardware::graphics::composer::V2_1::implementation::HIDL_FETCH_IComposer;
29
30int main()
31{
32 const char instance[] = "hwcomposer";
33
34 ALOGI("Service is starting.");
35
Martijn Coenen02822372016-12-29 14:03:41 +010036 configureRpcThreadpool(1, true /* callerWillJoin */);
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080037 sp<IComposer> service = HIDL_FETCH_IComposer(instance);
38 if (service == nullptr) {
39 ALOGI("getService returned NULL");
40 return -1;
41 }
42
43 LOG_FATAL_IF(service->isRemote(), "Service is REMOTE!");
44
45 service->registerAsService(instance);
46
47 // the conventional HAL might start binder services
48 android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
49 android::ProcessState::self()->startThreadPool();
50
Martijn Coenen02822372016-12-29 14:03:41 +010051 joinRpcThreadpool();
Chia-I Wub0b5a4d2016-10-17 14:56:15 +080052
53 return 0;
54}