Jason Macnak | 1de7f66 | 2020-01-24 15:05:57 -0800 | [diff] [blame] | 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/gralloc3/CrosGralloc3Allocator.h" |
| 12 | |
| 13 | using android::sp; |
| 14 | using android::hardware::configureRpcThreadpool; |
| 15 | using android::hardware::joinRpcThreadpool; |
| 16 | using android::hardware::graphics::allocator::V3_0::IAllocator; |
| 17 | |
| 18 | int main(int, char**) { |
| 19 | sp<IAllocator> allocator = new CrosGralloc3Allocator(); |
| 20 | configureRpcThreadpool(4, true /* callerWillJoin */); |
| 21 | if (allocator->registerAsService() != android::NO_ERROR) { |
| 22 | ALOGE("failed to register graphics IAllocator 3.0 service"); |
| 23 | return -EINVAL; |
| 24 | } |
| 25 | |
| 26 | ALOGI("graphics IAllocator 3.0 service is initialized"); |
| 27 | android::hardware::joinRpcThreadpool(); |
| 28 | ALOGI("graphics IAllocator 3.0 service is terminating"); |
| 29 | return 0; |
| 30 | } |