Dennis Tsiang | 33f0ece | 2023-11-29 12:45:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 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 ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL) |
| 18 | |
| 19 | #include "Composer.h" |
| 20 | |
| 21 | #include <android-base/logging.h> |
| 22 | #include <android/binder_ibinder_platform.h> |
| 23 | |
| 24 | #include "utils/log.h" |
| 25 | |
| 26 | namespace aidl::android::hardware::graphics::composer3::impl { |
| 27 | |
| 28 | // NOLINTNEXTLINE |
| 29 | #define DEBUG_FUNC() ALOGV("%s", __func__) |
| 30 | |
| 31 | ndk::ScopedAStatus Composer::createClient( |
| 32 | std::shared_ptr<IComposerClient>* out_client) { |
| 33 | DEBUG_FUNC(); |
| 34 | |
| 35 | auto client = ndk::SharedRefBase::make<ComposerClient>(); |
| 36 | if (!client) { |
| 37 | *out_client = nullptr; |
| 38 | return ndk::ScopedAStatus::fromServiceSpecificError(EX_NO_RESOURCES); |
| 39 | } |
| 40 | |
| 41 | *out_client = client; |
| 42 | |
| 43 | return ndk::ScopedAStatus::ok(); |
| 44 | } |
| 45 | |
| 46 | binder_status_t Composer::dump(int fd, const char** /*args*/, |
| 47 | uint32_t /*numArgs*/) { |
| 48 | auto output = std::string("hwc3-drm"); |
| 49 | write(fd, output.c_str(), output.size()); |
| 50 | return STATUS_OK; |
| 51 | } |
| 52 | |
| 53 | ndk::ScopedAStatus Composer::getCapabilities( |
| 54 | std::vector<Capability>* /*caps*/) { |
| 55 | DEBUG_FUNC(); |
| 56 | return ndk::ScopedAStatus::ok(); |
| 57 | } |
| 58 | |
| 59 | ::ndk::SpAIBinder Composer::createBinder() { |
| 60 | auto binder = BnComposer::createBinder(); |
| 61 | AIBinder_setInheritRt(binder.get(), true); |
| 62 | return binder; |
| 63 | } |
| 64 | |
| 65 | } // namespace aidl::android::hardware::graphics::composer3::impl |