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 | #pragma once |
| 18 | |
| 19 | #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> |
| 20 | #include <aidl/android/hardware/graphics/composer3/BnComposerClient.h> |
| 21 | #include <utils/Mutex.h> |
| 22 | |
| 23 | #include <memory> |
| 24 | |
| 25 | using AidlPixelFormat = aidl::android::hardware::graphics::common::PixelFormat; |
| 26 | using AidlNativeHandle = aidl::android::hardware::common::NativeHandle; |
| 27 | |
| 28 | namespace aidl::android::hardware::graphics::composer3::impl { |
| 29 | |
| 30 | class ComposerClient : public BnComposerClient { |
| 31 | public: |
| 32 | ComposerClient() = default; |
| 33 | ~ComposerClient() override; |
| 34 | |
| 35 | // composer3 interface |
| 36 | ndk::ScopedAStatus createLayer(int64_t display, int32_t buffer_slot_count, |
| 37 | int64_t* layer) override; |
| 38 | ndk::ScopedAStatus createVirtualDisplay(int32_t width, int32_t height, |
| 39 | AidlPixelFormat format_hint, |
| 40 | int32_t output_buffer_slot_count, |
| 41 | VirtualDisplay* display) override; |
| 42 | ndk::ScopedAStatus destroyLayer(int64_t display, int64_t layer) override; |
| 43 | ndk::ScopedAStatus destroyVirtualDisplay(int64_t display) override; |
| 44 | ndk::ScopedAStatus executeCommands( |
| 45 | const std::vector<DisplayCommand>& commands, |
| 46 | std::vector<CommandResultPayload>* results) override; |
| 47 | ndk::ScopedAStatus getActiveConfig(int64_t display, int32_t* config) override; |
| 48 | ndk::ScopedAStatus getColorModes( |
| 49 | int64_t display, std::vector<ColorMode>* color_modes) override; |
| 50 | ndk::ScopedAStatus getDataspaceSaturationMatrix( |
| 51 | common::Dataspace dataspace, std::vector<float>* matrix) override; |
| 52 | ndk::ScopedAStatus getDisplayAttribute(int64_t display, int32_t config, |
| 53 | DisplayAttribute attribute, |
| 54 | int32_t* value) override; |
| 55 | ndk::ScopedAStatus getDisplayCapabilities( |
| 56 | int64_t display, std::vector<DisplayCapability>* caps) override; |
| 57 | ndk::ScopedAStatus getDisplayConfigs(int64_t display, |
| 58 | std::vector<int32_t>* configs) override; |
| 59 | ndk::ScopedAStatus getDisplayConnectionType( |
| 60 | int64_t display, DisplayConnectionType* type) override; |
| 61 | ndk::ScopedAStatus getDisplayIdentificationData( |
| 62 | int64_t display, DisplayIdentification* id) override; |
| 63 | ndk::ScopedAStatus getDisplayName(int64_t display, |
| 64 | std::string* name) override; |
| 65 | ndk::ScopedAStatus getDisplayVsyncPeriod(int64_t display, |
| 66 | int32_t* vsync_period) override; |
| 67 | ndk::ScopedAStatus getDisplayedContentSample( |
| 68 | int64_t display, int64_t max_frames, int64_t timestamp, |
| 69 | DisplayContentSample* samples) override; |
| 70 | ndk::ScopedAStatus getDisplayedContentSamplingAttributes( |
| 71 | int64_t display, DisplayContentSamplingAttributes* attrs) override; |
| 72 | ndk::ScopedAStatus getDisplayPhysicalOrientation( |
| 73 | int64_t display, common::Transform* orientation) override; |
| 74 | ndk::ScopedAStatus getHdrCapabilities(int64_t display, |
| 75 | HdrCapabilities* caps) override; |
| 76 | ndk::ScopedAStatus getMaxVirtualDisplayCount(int32_t* count) override; |
| 77 | ndk::ScopedAStatus getPerFrameMetadataKeys( |
| 78 | int64_t display, std::vector<PerFrameMetadataKey>* keys) override; |
| 79 | ndk::ScopedAStatus getReadbackBufferAttributes( |
| 80 | int64_t display, ReadbackBufferAttributes* attrs) override; |
| 81 | ndk::ScopedAStatus getReadbackBufferFence( |
| 82 | int64_t display, ndk::ScopedFileDescriptor* acquire_fence) override; |
| 83 | ndk::ScopedAStatus getRenderIntents( |
| 84 | int64_t display, ColorMode mode, |
| 85 | std::vector<RenderIntent>* intents) override; |
| 86 | ndk::ScopedAStatus getSupportedContentTypes( |
| 87 | int64_t display, std::vector<ContentType>* types) override; |
| 88 | ndk::ScopedAStatus getDisplayDecorationSupport( |
| 89 | int64_t display, |
| 90 | std::optional<common::DisplayDecorationSupport>* support) override; |
| 91 | ndk::ScopedAStatus registerCallback( |
| 92 | const std::shared_ptr<IComposerCallback>& callback) override; |
| 93 | ndk::ScopedAStatus setActiveConfig(int64_t display, int32_t config) override; |
| 94 | ndk::ScopedAStatus setActiveConfigWithConstraints( |
| 95 | int64_t display, int32_t config, |
| 96 | const VsyncPeriodChangeConstraints& constraints, |
| 97 | VsyncPeriodChangeTimeline* timeline) override; |
| 98 | ndk::ScopedAStatus setBootDisplayConfig(int64_t display, |
| 99 | int32_t config) override; |
| 100 | ndk::ScopedAStatus clearBootDisplayConfig(int64_t display) override; |
| 101 | ndk::ScopedAStatus getPreferredBootDisplayConfig(int64_t display, |
| 102 | int32_t* config) override; |
| 103 | ndk::ScopedAStatus setAutoLowLatencyMode(int64_t display, bool on) override; |
| 104 | ndk::ScopedAStatus setClientTargetSlotCount(int64_t display, |
| 105 | int32_t count) override; |
| 106 | ndk::ScopedAStatus setColorMode(int64_t display, ColorMode mode, |
| 107 | RenderIntent intent) override; |
| 108 | ndk::ScopedAStatus setContentType(int64_t display, ContentType type) override; |
| 109 | ndk::ScopedAStatus setDisplayedContentSamplingEnabled( |
| 110 | int64_t display, bool enable, FormatColorComponent component_mask, |
| 111 | int64_t max_frames) override; |
| 112 | ndk::ScopedAStatus setPowerMode(int64_t display, PowerMode mode) override; |
| 113 | ndk::ScopedAStatus setReadbackBuffer( |
| 114 | int64_t display, const AidlNativeHandle& buffer, |
| 115 | const ndk::ScopedFileDescriptor& release_fence) override; |
| 116 | ndk::ScopedAStatus setVsyncEnabled(int64_t display, bool enabled) override; |
| 117 | ndk::ScopedAStatus setIdleTimerEnabled(int64_t display, |
| 118 | int32_t timeout) override; |
| 119 | |
| 120 | protected: |
| 121 | ::ndk::SpAIBinder createBinder() override; |
| 122 | }; |
| 123 | |
| 124 | } // namespace aidl::android::hardware::graphics::composer3::impl |