Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 1 | /* |
| 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 | |
Ady Abraham | 9fc2805 | 2021-10-14 17:21:38 -0700 | [diff] [blame] | 17 | #pragma once |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 18 | |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 19 | #include <memory> |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 20 | |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 21 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 22 | #pragma clang diagnostic push |
| 23 | #pragma clang diagnostic ignored "-Wconversion" |
Marin Shalamanov | bed7fd3 | 2020-12-21 20:02:20 +0100 | [diff] [blame] | 24 | #pragma clang diagnostic ignored "-Wextra" |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 25 | |
Peiyong Lin | afa0f57 | 2020-01-13 16:35:02 -0800 | [diff] [blame] | 26 | #include <composer-command-buffer/2.4/ComposerCommandBuffer.h> |
Alec Mouri | e7cc1c2 | 2021-04-27 15:23:26 -0700 | [diff] [blame] | 27 | #include <gui/BufferQueue.h> |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame] | 28 | #include <gui/HdrMetadata.h> |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 29 | #include <math/mat4.h> |
Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 30 | #include <ui/DisplayedFrameStats.h> |
Lloyd Pique | d0094aa | 2017-12-20 16:43:28 -0800 | [diff] [blame] | 31 | #include <ui/GraphicBuffer.h> |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 32 | #include <utils/StrongPointer.h> |
| 33 | |
Leon Scroggins III | e7c51c6 | 2022-02-01 15:53:54 -0500 | [diff] [blame] | 34 | #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> |
Kriti Dang | 674b937 | 2022-11-18 10:58:44 +0100 | [diff] [blame] | 35 | #include <aidl/android/hardware/graphics/common/HdrConversionCapability.h> |
| 36 | #include <aidl/android/hardware/graphics/common/HdrConversionStrategy.h> |
Ady Abraham | de549d4 | 2022-01-26 19:19:17 -0800 | [diff] [blame] | 37 | #include <aidl/android/hardware/graphics/composer3/Capability.h> |
Alec Mouri | 8506569 | 2022-03-18 00:58:26 +0000 | [diff] [blame] | 38 | #include <aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.h> |
Ady Abraham | 6e60b14 | 2022-01-06 18:10:35 -0800 | [diff] [blame] | 39 | #include <aidl/android/hardware/graphics/composer3/Color.h> |
Leon Scroggins III | 2e1aa18 | 2021-12-01 17:33:12 -0500 | [diff] [blame] | 40 | #include <aidl/android/hardware/graphics/composer3/Composition.h> |
Leon Scroggins III | 5967aec | 2021-12-29 11:14:22 -0500 | [diff] [blame] | 41 | #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> |
Yichi Chen | 3401b56 | 2022-01-17 15:42:35 +0800 | [diff] [blame] | 42 | #include <aidl/android/hardware/graphics/composer3/IComposerCallback.h> |
Sally Qi | 0cbd08b | 2022-08-17 12:12:28 -0700 | [diff] [blame] | 43 | #include <aidl/android/hardware/graphics/composer3/OverlayProperties.h> |
Leon Scroggins III | 2e1aa18 | 2021-12-01 17:33:12 -0500 | [diff] [blame] | 44 | |
ramindani | 06e518e | 2022-03-14 18:47:53 +0000 | [diff] [blame] | 45 | #include <aidl/android/hardware/graphics/common/Transform.h> |
Leon Scroggins III | e7c51c6 | 2022-02-01 15:53:54 -0500 | [diff] [blame] | 46 | #include <optional> |
| 47 | |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 48 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
Marin Shalamanov | bed7fd3 | 2020-12-21 20:02:20 +0100 | [diff] [blame] | 49 | #pragma clang diagnostic pop // ignored "-Wconversion -Wextra" |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 50 | |
Yichi Chen | 3401b56 | 2022-01-17 15:42:35 +0800 | [diff] [blame] | 51 | namespace android { |
| 52 | namespace HWC2 { |
| 53 | struct ComposerCallback; |
| 54 | } // namespace HWC2 |
| 55 | |
| 56 | namespace Hwc2 { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 57 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 58 | namespace types = hardware::graphics::common; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 59 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 60 | namespace V2_1 = hardware::graphics::composer::V2_1; |
| 61 | namespace V2_2 = hardware::graphics::composer::V2_2; |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 62 | namespace V2_3 = hardware::graphics::composer::V2_3; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 63 | namespace V2_4 = hardware::graphics::composer::V2_4; |
Yichi Chen | 3401b56 | 2022-01-17 15:42:35 +0800 | [diff] [blame] | 64 | namespace V3_0 = ::aidl::android::hardware::graphics::composer3; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 65 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 66 | using types::V1_0::ColorTransform; |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 67 | using types::V1_0::Transform; |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 68 | using types::V1_1::RenderIntent; |
Valerie Hau | 9758ae0 | 2018-10-09 16:05:09 -0700 | [diff] [blame] | 69 | using types::V1_2::ColorMode; |
| 70 | using types::V1_2::Dataspace; |
Kevin DuBois | 73d0f48 | 2019-01-25 11:18:03 -0800 | [diff] [blame] | 71 | using types::V1_2::PixelFormat; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 72 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 73 | using V2_1::Config; |
| 74 | using V2_1::Display; |
| 75 | using V2_1::Error; |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 76 | using V2_1::Layer; |
Peiyong Lin | afa0f57 | 2020-01-13 16:35:02 -0800 | [diff] [blame] | 77 | using V2_4::CommandReaderBase; |
| 78 | using V2_4::CommandWriterBase; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 79 | using V2_4::IComposer; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 80 | using V2_4::IComposerCallback; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 81 | using V2_4::IComposerClient; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 82 | using V2_4::VsyncPeriodChangeTimeline; |
| 83 | using V2_4::VsyncPeriodNanos; |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 84 | using PerFrameMetadata = IComposerClient::PerFrameMetadata; |
| 85 | using PerFrameMetadataKey = IComposerClient::PerFrameMetadataKey; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 86 | using PerFrameMetadataBlob = IComposerClient::PerFrameMetadataBlob; |
ramindani | 06e518e | 2022-03-14 18:47:53 +0000 | [diff] [blame] | 87 | using AidlTransform = ::aidl::android::hardware::graphics::common::Transform; |
Marc Kassis | bdf7e4b | 2022-11-04 17:26:48 +0100 | [diff] [blame] | 88 | using aidl::android::hardware::graphics::common::Hdr; |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 89 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 90 | class Composer { |
| 91 | public: |
Ady Abraham | 9fc2805 | 2021-10-14 17:21:38 -0700 | [diff] [blame] | 92 | static std::unique_ptr<Composer> create(const std::string& serviceName); |
| 93 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 94 | virtual ~Composer() = 0; |
| 95 | |
Ady Abraham | 4d211cf | 2021-12-14 16:19:03 -0800 | [diff] [blame] | 96 | enum class OptionalFeature { |
| 97 | RefreshRateSwitching, |
Ady Abraham | 43065bd | 2021-12-10 17:22:15 -0800 | [diff] [blame] | 98 | ExpectedPresentTime, |
Alec Mouri | cdf1679 | 2021-12-10 13:16:06 -0800 | [diff] [blame] | 99 | // Whether setDisplayBrightness is able to be applied as part of a display command. |
| 100 | DisplayBrightnessCommand, |
ramindani | 32cf060 | 2022-03-02 02:30:29 +0000 | [diff] [blame] | 101 | KernelIdleTimer, |
ramindani | 06e518e | 2022-03-14 18:47:53 +0000 | [diff] [blame] | 102 | PhysicalDisplayOrientation, |
Ady Abraham | 4d211cf | 2021-12-14 16:19:03 -0800 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | virtual bool isSupported(OptionalFeature) const = 0; |
| 106 | |
Ady Abraham | de549d4 | 2022-01-26 19:19:17 -0800 | [diff] [blame] | 107 | virtual std::vector<aidl::android::hardware::graphics::composer3::Capability> |
| 108 | getCapabilities() = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 109 | virtual std::string dumpDebugInfo() = 0; |
| 110 | |
Yichi Chen | 3401b56 | 2022-01-17 15:42:35 +0800 | [diff] [blame] | 111 | virtual void registerCallback(HWC2::ComposerCallback& callback) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 112 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 113 | // Reset all pending commands in the command buffer. Useful if you want to |
| 114 | // skip a frame but have already queued some commands. |
Leon Scroggins III | e24d78f | 2022-09-20 16:38:19 -0400 | [diff] [blame] | 115 | virtual void resetCommands(Display) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 116 | |
| 117 | // Explicitly flush all pending commands in the command buffer. |
Leon Scroggins III | e24d78f | 2022-09-20 16:38:19 -0400 | [diff] [blame] | 118 | virtual Error executeCommands(Display) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 119 | |
| 120 | virtual uint32_t getMaxVirtualDisplayCount() = 0; |
Dominik Laskowski | 1394860 | 2021-03-08 20:48:28 -0800 | [diff] [blame] | 121 | virtual Error createVirtualDisplay(uint32_t width, uint32_t height, PixelFormat*, |
Dominik Laskowski | 263eec4 | 2021-07-21 23:13:24 -0700 | [diff] [blame] | 122 | Display* outDisplay) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 123 | virtual Error destroyVirtualDisplay(Display display) = 0; |
| 124 | |
| 125 | virtual Error acceptDisplayChanges(Display display) = 0; |
| 126 | |
| 127 | virtual Error createLayer(Display display, Layer* outLayer) = 0; |
| 128 | virtual Error destroyLayer(Display display, Layer layer) = 0; |
| 129 | |
| 130 | virtual Error getActiveConfig(Display display, Config* outConfig) = 0; |
Yichi Chen | 3401b56 | 2022-01-17 15:42:35 +0800 | [diff] [blame] | 131 | virtual Error getChangedCompositionTypes(Display display, std::vector<Layer>* outLayers, |
| 132 | std::vector<V3_0::Composition>* outTypes) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 133 | virtual Error getColorModes(Display display, std::vector<ColorMode>* outModes) = 0; |
| 134 | virtual Error getDisplayAttribute(Display display, Config config, |
| 135 | IComposerClient::Attribute attribute, int32_t* outValue) = 0; |
| 136 | virtual Error getDisplayConfigs(Display display, std::vector<Config>* outConfigs) = 0; |
| 137 | virtual Error getDisplayName(Display display, std::string* outName) = 0; |
| 138 | |
| 139 | virtual Error getDisplayRequests(Display display, uint32_t* outDisplayRequestMask, |
| 140 | std::vector<Layer>* outLayers, |
| 141 | std::vector<uint32_t>* outLayerRequestMasks) = 0; |
| 142 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 143 | virtual Error getDozeSupport(Display display, bool* outSupport) = 0; |
ramindani | 32cf060 | 2022-03-02 02:30:29 +0000 | [diff] [blame] | 144 | virtual Error hasDisplayIdleTimerCapability(Display display, bool* outSupport) = 0; |
Marc Kassis | bdf7e4b | 2022-11-04 17:26:48 +0100 | [diff] [blame] | 145 | virtual Error getHdrCapabilities(Display display, std::vector<Hdr>* outHdrTypes, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 146 | float* outMaxLuminance, float* outMaxAverageLuminance, |
| 147 | float* outMinLuminance) = 0; |
| 148 | |
| 149 | virtual Error getReleaseFences(Display display, std::vector<Layer>* outLayers, |
| 150 | std::vector<int>* outReleaseFences) = 0; |
| 151 | |
| 152 | virtual Error presentDisplay(Display display, int* outPresentFence) = 0; |
| 153 | |
| 154 | virtual Error setActiveConfig(Display display, Config config) = 0; |
| 155 | |
| 156 | /* |
| 157 | * The composer caches client targets internally. When target is nullptr, |
| 158 | * the composer uses slot to look up the client target from its cache. |
| 159 | * When target is not nullptr, the cache is updated with the new target. |
| 160 | */ |
| 161 | virtual Error setClientTarget(Display display, uint32_t slot, const sp<GraphicBuffer>& target, |
| 162 | int acquireFence, Dataspace dataspace, |
| 163 | const std::vector<IComposerClient::Rect>& damage) = 0; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 164 | virtual Error setColorMode(Display display, ColorMode mode, RenderIntent renderIntent) = 0; |
Ady Abraham | dc011a9 | 2021-12-21 14:06:44 -0800 | [diff] [blame] | 165 | virtual Error setColorTransform(Display display, const float* matrix) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 166 | virtual Error setOutputBuffer(Display display, const native_handle_t* buffer, |
| 167 | int releaseFence) = 0; |
| 168 | virtual Error setPowerMode(Display display, IComposerClient::PowerMode mode) = 0; |
| 169 | virtual Error setVsyncEnabled(Display display, IComposerClient::Vsync enabled) = 0; |
| 170 | |
| 171 | virtual Error setClientTargetSlotCount(Display display) = 0; |
| 172 | |
Ady Abraham | 43065bd | 2021-12-10 17:22:15 -0800 | [diff] [blame] | 173 | virtual Error validateDisplay(Display display, nsecs_t expectedPresentTime, |
| 174 | uint32_t* outNumTypes, uint32_t* outNumRequests) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 175 | |
Ady Abraham | 43065bd | 2021-12-10 17:22:15 -0800 | [diff] [blame] | 176 | virtual Error presentOrValidateDisplay(Display display, nsecs_t expectedPresentTime, |
| 177 | uint32_t* outNumTypes, uint32_t* outNumRequests, |
| 178 | int* outPresentFence, uint32_t* state) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 179 | |
| 180 | virtual Error setCursorPosition(Display display, Layer layer, int32_t x, int32_t y) = 0; |
| 181 | /* see setClientTarget for the purpose of slot */ |
| 182 | virtual Error setLayerBuffer(Display display, Layer layer, uint32_t slot, |
| 183 | const sp<GraphicBuffer>& buffer, int acquireFence) = 0; |
Brian Lindahl | b158a5c | 2022-12-15 15:21:13 -0700 | [diff] [blame] | 184 | virtual Error setLayerBufferSlotsToClear(Display display, Layer layer, |
| 185 | const std::vector<uint32_t>& slotsToClear, |
| 186 | uint32_t activeBufferSlot) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 187 | virtual Error setLayerSurfaceDamage(Display display, Layer layer, |
| 188 | const std::vector<IComposerClient::Rect>& damage) = 0; |
| 189 | virtual Error setLayerBlendMode(Display display, Layer layer, |
| 190 | IComposerClient::BlendMode mode) = 0; |
Ady Abraham | 6e60b14 | 2022-01-06 18:10:35 -0800 | [diff] [blame] | 191 | virtual Error setLayerColor( |
| 192 | Display display, Layer layer, |
| 193 | const aidl::android::hardware::graphics::composer3::Color& color) = 0; |
Leon Scroggins III | 2e1aa18 | 2021-12-01 17:33:12 -0500 | [diff] [blame] | 194 | virtual Error setLayerCompositionType( |
| 195 | Display display, Layer layer, |
| 196 | aidl::android::hardware::graphics::composer3::Composition type) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 197 | virtual Error setLayerDataspace(Display display, Layer layer, Dataspace dataspace) = 0; |
| 198 | virtual Error setLayerDisplayFrame(Display display, Layer layer, |
| 199 | const IComposerClient::Rect& frame) = 0; |
| 200 | virtual Error setLayerPlaneAlpha(Display display, Layer layer, float alpha) = 0; |
| 201 | virtual Error setLayerSidebandStream(Display display, Layer layer, |
| 202 | const native_handle_t* stream) = 0; |
| 203 | virtual Error setLayerSourceCrop(Display display, Layer layer, |
| 204 | const IComposerClient::FRect& crop) = 0; |
| 205 | virtual Error setLayerTransform(Display display, Layer layer, Transform transform) = 0; |
| 206 | virtual Error setLayerVisibleRegion(Display display, Layer layer, |
| 207 | const std::vector<IComposerClient::Rect>& visible) = 0; |
| 208 | virtual Error setLayerZOrder(Display display, Layer layer, uint32_t z) = 0; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 209 | |
| 210 | // Composer HAL 2.2 |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 211 | virtual Error setLayerPerFrameMetadata( |
| 212 | Display display, Layer layer, |
| 213 | const std::vector<IComposerClient::PerFrameMetadata>& perFrameMetadatas) = 0; |
Chia-I Wu | d7e01d7 | 2018-06-21 13:39:09 +0800 | [diff] [blame] | 214 | virtual std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys( |
| 215 | Display display) = 0; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 216 | virtual Error getRenderIntents(Display display, ColorMode colorMode, |
| 217 | std::vector<RenderIntent>* outRenderIntents) = 0; |
| 218 | virtual Error getDataspaceSaturationMatrix(Dataspace dataspace, mat4* outMatrix) = 0; |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 219 | |
| 220 | // Composer HAL 2.3 |
| 221 | virtual Error getDisplayIdentificationData(Display display, uint8_t* outPort, |
| 222 | std::vector<uint8_t>* outData) = 0; |
Peiyong Lin | 698147a | 2018-09-14 13:27:18 -0700 | [diff] [blame] | 223 | virtual Error setLayerColorTransform(Display display, Layer layer, |
| 224 | const float* matrix) = 0; |
Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 225 | virtual Error getDisplayedContentSamplingAttributes(Display display, PixelFormat* outFormat, |
| 226 | Dataspace* outDataspace, |
| 227 | uint8_t* outComponentMask) = 0; |
Kevin DuBois | 74e5377 | 2018-11-19 10:52:38 -0800 | [diff] [blame] | 228 | virtual Error setDisplayContentSamplingEnabled(Display display, bool enabled, |
| 229 | uint8_t componentMask, uint64_t maxFrames) = 0; |
Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 230 | virtual Error getDisplayedContentSample(Display display, uint64_t maxFrames, uint64_t timestamp, |
| 231 | DisplayedFrameStats* outStats) = 0; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 232 | virtual Error setLayerPerFrameMetadataBlobs( |
| 233 | Display display, Layer layer, const std::vector<PerFrameMetadataBlob>& metadata) = 0; |
Alec Mouri | cdf1679 | 2021-12-10 13:16:06 -0800 | [diff] [blame] | 234 | // Options for setting the display brightness |
| 235 | struct DisplayBrightnessOptions { |
| 236 | // If true, then immediately submits a brightness change request to composer. Otherwise, |
| 237 | // submission of the brightness change may be deferred until presenting the next frame. |
| 238 | // applyImmediately should only be false if OptionalFeature::DisplayBrightnessCommand is |
| 239 | // supported. |
| 240 | bool applyImmediately = true; |
Alec Mouri | cdf1679 | 2021-12-10 13:16:06 -0800 | [diff] [blame] | 241 | |
| 242 | bool operator==(const DisplayBrightnessOptions& other) const { |
Alec Mouri | 90a1927 | 2021-12-30 14:11:38 -0800 | [diff] [blame] | 243 | return applyImmediately == other.applyImmediately; |
Alec Mouri | cdf1679 | 2021-12-10 13:16:06 -0800 | [diff] [blame] | 244 | } |
| 245 | }; |
Alec Mouri | 4d8a05d | 2022-03-23 18:14:26 +0000 | [diff] [blame] | 246 | virtual Error setDisplayBrightness(Display display, float brightness, float brightnessNits, |
Alec Mouri | cdf1679 | 2021-12-10 13:16:06 -0800 | [diff] [blame] | 247 | const DisplayBrightnessOptions& options) = 0; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 248 | |
| 249 | // Composer HAL 2.4 |
Yichi Chen | 3401b56 | 2022-01-17 15:42:35 +0800 | [diff] [blame] | 250 | virtual Error getDisplayCapabilities(Display display, |
| 251 | std::vector<V3_0::DisplayCapability>* outCapabilities) = 0; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 252 | virtual V2_4::Error getDisplayConnectionType( |
| 253 | Display display, IComposerClient::DisplayConnectionType* outType) = 0; |
| 254 | virtual V2_4::Error getDisplayVsyncPeriod(Display display, |
| 255 | VsyncPeriodNanos* outVsyncPeriod) = 0; |
| 256 | virtual V2_4::Error setActiveConfigWithConstraints( |
| 257 | Display display, Config config, |
| 258 | const IComposerClient::VsyncPeriodChangeConstraints& vsyncPeriodChangeConstraints, |
| 259 | VsyncPeriodChangeTimeline* outTimeline) = 0; |
Galia Peycheva | 5492cb5 | 2019-10-30 14:13:16 +0100 | [diff] [blame] | 260 | |
| 261 | virtual V2_4::Error setAutoLowLatencyMode(Display displayId, bool on) = 0; |
| 262 | virtual V2_4::Error getSupportedContentTypes( |
| 263 | Display displayId, |
| 264 | std::vector<IComposerClient::ContentType>* outSupportedContentTypes) = 0; |
| 265 | virtual V2_4::Error setContentType(Display displayId, |
| 266 | IComposerClient::ContentType contentType) = 0; |
Dan Stoza | 18d48cb | 2019-10-21 15:39:24 -0700 | [diff] [blame] | 267 | virtual V2_4::Error setLayerGenericMetadata(Display display, Layer layer, |
| 268 | const std::string& key, bool mandatory, |
| 269 | const std::vector<uint8_t>& value) = 0; |
| 270 | virtual V2_4::Error getLayerGenericMetadataKeys( |
| 271 | std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) = 0; |
Kriti Dang | 7defaf3 | 2021-11-15 11:55:43 +0100 | [diff] [blame] | 272 | |
Peiyong Lin | dfc3f7c | 2020-05-07 20:15:50 -0700 | [diff] [blame] | 273 | virtual Error getClientTargetProperty( |
Alec Mouri | 8506569 | 2022-03-18 00:58:26 +0000 | [diff] [blame] | 274 | Display display, V3_0::ClientTargetPropertyWithBrightness* outClientTargetProperty) = 0; |
Alec Mouri | cdf6cbc | 2021-11-01 17:21:15 -0700 | [diff] [blame] | 275 | |
| 276 | // AIDL Composer |
Alec Mouri | 6da0e27 | 2022-02-07 12:45:57 -0800 | [diff] [blame] | 277 | virtual Error setLayerBrightness(Display display, Layer layer, float brightness) = 0; |
Leon Scroggins III | d77d316 | 2022-01-05 10:42:28 -0500 | [diff] [blame] | 278 | virtual Error setLayerBlockingRegion(Display display, Layer layer, |
| 279 | const std::vector<IComposerClient::Rect>& blocking) = 0; |
Kriti Dang | 7defaf3 | 2021-11-15 11:55:43 +0100 | [diff] [blame] | 280 | virtual Error setBootDisplayConfig(Display displayId, Config) = 0; |
| 281 | virtual Error clearBootDisplayConfig(Display displayId) = 0; |
| 282 | virtual Error getPreferredBootDisplayConfig(Display displayId, Config*) = 0; |
Leon Scroggins III | e7c51c6 | 2022-02-01 15:53:54 -0500 | [diff] [blame] | 283 | virtual Error getDisplayDecorationSupport( |
| 284 | Display display, |
| 285 | std::optional<::aidl::android::hardware::graphics::common::DisplayDecorationSupport>* |
| 286 | support) = 0; |
ramindani | 32cf060 | 2022-03-02 02:30:29 +0000 | [diff] [blame] | 287 | virtual Error setIdleTimerEnabled(Display displayId, std::chrono::milliseconds timeout) = 0; |
ramindani | 06e518e | 2022-03-14 18:47:53 +0000 | [diff] [blame] | 288 | virtual Error getPhysicalDisplayOrientation(Display displayId, |
| 289 | AidlTransform* outDisplayOrientation) = 0; |
Sally Qi | 0cbd08b | 2022-08-17 12:12:28 -0700 | [diff] [blame] | 290 | virtual Error getOverlaySupport(V3_0::OverlayProperties* outProperties) = 0; |
Leon Scroggins III | e24d78f | 2022-09-20 16:38:19 -0400 | [diff] [blame] | 291 | virtual void onHotplugConnect(Display) = 0; |
| 292 | virtual void onHotplugDisconnect(Display) = 0; |
Kriti Dang | 674b937 | 2022-11-18 10:58:44 +0100 | [diff] [blame] | 293 | virtual Error getHdrConversionCapabilities( |
| 294 | std::vector<::aidl::android::hardware::graphics::common::HdrConversionCapability>*) = 0; |
| 295 | virtual Error setHdrConversionStrategy( |
Kriti Dang | d432bb5 | 2023-02-09 18:21:04 +0100 | [diff] [blame^] | 296 | ::aidl::android::hardware::graphics::common::HdrConversionStrategy, Hdr*) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 297 | }; |
| 298 | |
Yichi Chen | 3401b56 | 2022-01-17 15:42:35 +0800 | [diff] [blame] | 299 | } // namespace Hwc2 |
| 300 | } // namespace android |