OSDN Git Service

Merge Android R
[android-x86/external-minigbm.git] / cros_gralloc / gralloc4 / CrosGralloc4AllocatorService.cc
1 /*
2  * Copyright 2020 The Chromium OS Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 #define LOG_TAG "AllocatorService"
8
9 #include <hidl/LegacySupport.h>
10
11 #include "cros_gralloc/gralloc4/CrosGralloc4Allocator.h"
12
13 using android::sp;
14 using android::hardware::configureRpcThreadpool;
15 using android::hardware::joinRpcThreadpool;
16 using android::hardware::graphics::allocator::V4_0::IAllocator;
17
18 int main(int, char**) {
19     sp<IAllocator> allocator = new CrosGralloc4Allocator();
20     configureRpcThreadpool(4, true /* callerWillJoin */);
21     if (allocator->registerAsService() != android::NO_ERROR) {
22         ALOGE("failed to register graphics IAllocator 4.0 service");
23         return -EINVAL;
24     }
25
26     ALOGI("graphics IAllocator 4.0 service is initialized");
27     android::hardware::joinRpcThreadpool();
28     ALOGI("graphics IAllocator 4.0 service is terminating");
29     return 0;
30 }