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 | |
| 17 | #ifndef ANDROID_SF_COMPOSER_HAL_H |
| 18 | #define ANDROID_SF_COMPOSER_HAL_H |
| 19 | |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 20 | #include <memory> |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 21 | #include <string> |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 22 | #include <unordered_map> |
| 23 | #include <utility> |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 24 | #include <vector> |
| 25 | |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 26 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 27 | #pragma clang diagnostic push |
| 28 | #pragma clang diagnostic ignored "-Wconversion" |
| 29 | |
mamik | 94e91f6 | 2019-08-19 09:11:33 -0700 | [diff] [blame] | 30 | #if defined(USE_VR_COMPOSER) && USE_VR_COMPOSER |
| 31 | #include <android/frameworks/vr/composer/2.0/IVrComposerClient.h> |
| 32 | #endif // defined(USE_VR_COMPOSER) && USE_VR_COMPOSER |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 33 | #include <android/hardware/graphics/common/1.1/types.h> |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 34 | #include <android/hardware/graphics/composer/2.4/IComposer.h> |
| 35 | #include <android/hardware/graphics/composer/2.4/IComposerClient.h> |
Peiyong Lin | afa0f57 | 2020-01-13 16:35:02 -0800 | [diff] [blame] | 36 | #include <composer-command-buffer/2.4/ComposerCommandBuffer.h> |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame] | 37 | #include <gui/HdrMetadata.h> |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 38 | #include <math/mat4.h> |
Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 39 | #include <ui/DisplayedFrameStats.h> |
Lloyd Pique | d0094aa | 2017-12-20 16:43:28 -0800 | [diff] [blame] | 40 | #include <ui/GraphicBuffer.h> |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 41 | #include <utils/StrongPointer.h> |
| 42 | |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 43 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 44 | #pragma clang diagnostic pop // ignored "-Wconversion" |
| 45 | |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 46 | namespace android { |
| 47 | |
| 48 | namespace Hwc2 { |
| 49 | |
mamik | 94e91f6 | 2019-08-19 09:11:33 -0700 | [diff] [blame] | 50 | #if defined(USE_VR_COMPOSER) && USE_VR_COMPOSER |
| 51 | using frameworks::vr::composer::V2_0::IVrComposerClient; |
| 52 | #endif // defined(USE_VR_COMPOSER) && USE_VR_COMPOSER |
Daniel Nicoara | 1f42e3a | 2017-04-10 13:27:32 -0400 | [diff] [blame] | 53 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 54 | namespace types = hardware::graphics::common; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 55 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 56 | namespace V2_1 = hardware::graphics::composer::V2_1; |
| 57 | namespace V2_2 = hardware::graphics::composer::V2_2; |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 58 | namespace V2_3 = hardware::graphics::composer::V2_3; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 59 | namespace V2_4 = hardware::graphics::composer::V2_4; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 60 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 61 | using types::V1_0::ColorTransform; |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 62 | using types::V1_0::Transform; |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 63 | using types::V1_1::RenderIntent; |
Valerie Hau | 9758ae0 | 2018-10-09 16:05:09 -0700 | [diff] [blame] | 64 | using types::V1_2::ColorMode; |
| 65 | using types::V1_2::Dataspace; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 66 | using types::V1_2::Hdr; |
Kevin DuBois | 73d0f48 | 2019-01-25 11:18:03 -0800 | [diff] [blame] | 67 | using types::V1_2::PixelFormat; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 68 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 69 | using V2_1::Config; |
| 70 | using V2_1::Display; |
| 71 | using V2_1::Error; |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 72 | using V2_1::Layer; |
Peiyong Lin | afa0f57 | 2020-01-13 16:35:02 -0800 | [diff] [blame] | 73 | using V2_4::CommandReaderBase; |
| 74 | using V2_4::CommandWriterBase; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 75 | using V2_4::IComposer; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 76 | using V2_4::IComposerCallback; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 77 | using V2_4::IComposerClient; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 78 | using V2_4::VsyncPeriodChangeTimeline; |
| 79 | using V2_4::VsyncPeriodNanos; |
Peiyong Lin | ed531a3 | 2018-10-26 18:27:56 -0700 | [diff] [blame] | 80 | using DisplayCapability = IComposerClient::DisplayCapability; |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 81 | using PerFrameMetadata = IComposerClient::PerFrameMetadata; |
| 82 | using PerFrameMetadataKey = IComposerClient::PerFrameMetadataKey; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 83 | using PerFrameMetadataBlob = IComposerClient::PerFrameMetadataBlob; |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 84 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 85 | class Composer { |
| 86 | public: |
| 87 | virtual ~Composer() = 0; |
| 88 | |
| 89 | virtual std::vector<IComposer::Capability> getCapabilities() = 0; |
| 90 | virtual std::string dumpDebugInfo() = 0; |
| 91 | |
| 92 | virtual void registerCallback(const sp<IComposerCallback>& callback) = 0; |
| 93 | |
| 94 | // Returns true if the connected composer service is running in a remote |
| 95 | // process, false otherwise. This will return false if the service is |
| 96 | // configured in passthrough mode, for example. |
| 97 | virtual bool isRemote() = 0; |
| 98 | |
| 99 | // Reset all pending commands in the command buffer. Useful if you want to |
| 100 | // skip a frame but have already queued some commands. |
| 101 | virtual void resetCommands() = 0; |
| 102 | |
| 103 | // Explicitly flush all pending commands in the command buffer. |
| 104 | virtual Error executeCommands() = 0; |
| 105 | |
| 106 | virtual uint32_t getMaxVirtualDisplayCount() = 0; |
| 107 | virtual bool isUsingVrComposer() const = 0; |
| 108 | virtual Error createVirtualDisplay(uint32_t width, uint32_t height, PixelFormat* format, |
| 109 | Display* outDisplay) = 0; |
| 110 | virtual Error destroyVirtualDisplay(Display display) = 0; |
| 111 | |
| 112 | virtual Error acceptDisplayChanges(Display display) = 0; |
| 113 | |
| 114 | virtual Error createLayer(Display display, Layer* outLayer) = 0; |
| 115 | virtual Error destroyLayer(Display display, Layer layer) = 0; |
| 116 | |
| 117 | virtual Error getActiveConfig(Display display, Config* outConfig) = 0; |
| 118 | virtual Error getChangedCompositionTypes( |
| 119 | Display display, std::vector<Layer>* outLayers, |
| 120 | std::vector<IComposerClient::Composition>* outTypes) = 0; |
| 121 | virtual Error getColorModes(Display display, std::vector<ColorMode>* outModes) = 0; |
| 122 | virtual Error getDisplayAttribute(Display display, Config config, |
| 123 | IComposerClient::Attribute attribute, int32_t* outValue) = 0; |
| 124 | virtual Error getDisplayConfigs(Display display, std::vector<Config>* outConfigs) = 0; |
| 125 | virtual Error getDisplayName(Display display, std::string* outName) = 0; |
| 126 | |
| 127 | virtual Error getDisplayRequests(Display display, uint32_t* outDisplayRequestMask, |
| 128 | std::vector<Layer>* outLayers, |
| 129 | std::vector<uint32_t>* outLayerRequestMasks) = 0; |
| 130 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 131 | virtual Error getDozeSupport(Display display, bool* outSupport) = 0; |
| 132 | virtual Error getHdrCapabilities(Display display, std::vector<Hdr>* outTypes, |
| 133 | float* outMaxLuminance, float* outMaxAverageLuminance, |
| 134 | float* outMinLuminance) = 0; |
| 135 | |
| 136 | virtual Error getReleaseFences(Display display, std::vector<Layer>* outLayers, |
| 137 | std::vector<int>* outReleaseFences) = 0; |
| 138 | |
| 139 | virtual Error presentDisplay(Display display, int* outPresentFence) = 0; |
| 140 | |
| 141 | virtual Error setActiveConfig(Display display, Config config) = 0; |
| 142 | |
| 143 | /* |
| 144 | * The composer caches client targets internally. When target is nullptr, |
| 145 | * the composer uses slot to look up the client target from its cache. |
| 146 | * When target is not nullptr, the cache is updated with the new target. |
| 147 | */ |
| 148 | virtual Error setClientTarget(Display display, uint32_t slot, const sp<GraphicBuffer>& target, |
| 149 | int acquireFence, Dataspace dataspace, |
| 150 | const std::vector<IComposerClient::Rect>& damage) = 0; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 151 | virtual Error setColorMode(Display display, ColorMode mode, RenderIntent renderIntent) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 152 | virtual Error setColorTransform(Display display, const float* matrix, ColorTransform hint) = 0; |
| 153 | virtual Error setOutputBuffer(Display display, const native_handle_t* buffer, |
| 154 | int releaseFence) = 0; |
| 155 | virtual Error setPowerMode(Display display, IComposerClient::PowerMode mode) = 0; |
| 156 | virtual Error setVsyncEnabled(Display display, IComposerClient::Vsync enabled) = 0; |
| 157 | |
| 158 | virtual Error setClientTargetSlotCount(Display display) = 0; |
| 159 | |
| 160 | virtual Error validateDisplay(Display display, uint32_t* outNumTypes, |
| 161 | uint32_t* outNumRequests) = 0; |
| 162 | |
| 163 | virtual Error presentOrValidateDisplay(Display display, uint32_t* outNumTypes, |
| 164 | uint32_t* outNumRequests, int* outPresentFence, |
| 165 | uint32_t* state) = 0; |
| 166 | |
| 167 | virtual Error setCursorPosition(Display display, Layer layer, int32_t x, int32_t y) = 0; |
| 168 | /* see setClientTarget for the purpose of slot */ |
| 169 | virtual Error setLayerBuffer(Display display, Layer layer, uint32_t slot, |
| 170 | const sp<GraphicBuffer>& buffer, int acquireFence) = 0; |
| 171 | virtual Error setLayerSurfaceDamage(Display display, Layer layer, |
| 172 | const std::vector<IComposerClient::Rect>& damage) = 0; |
| 173 | virtual Error setLayerBlendMode(Display display, Layer layer, |
| 174 | IComposerClient::BlendMode mode) = 0; |
| 175 | virtual Error setLayerColor(Display display, Layer layer, |
| 176 | const IComposerClient::Color& color) = 0; |
| 177 | virtual Error setLayerCompositionType(Display display, Layer layer, |
| 178 | IComposerClient::Composition type) = 0; |
| 179 | virtual Error setLayerDataspace(Display display, Layer layer, Dataspace dataspace) = 0; |
| 180 | virtual Error setLayerDisplayFrame(Display display, Layer layer, |
| 181 | const IComposerClient::Rect& frame) = 0; |
| 182 | virtual Error setLayerPlaneAlpha(Display display, Layer layer, float alpha) = 0; |
| 183 | virtual Error setLayerSidebandStream(Display display, Layer layer, |
| 184 | const native_handle_t* stream) = 0; |
| 185 | virtual Error setLayerSourceCrop(Display display, Layer layer, |
| 186 | const IComposerClient::FRect& crop) = 0; |
| 187 | virtual Error setLayerTransform(Display display, Layer layer, Transform transform) = 0; |
| 188 | virtual Error setLayerVisibleRegion(Display display, Layer layer, |
| 189 | const std::vector<IComposerClient::Rect>& visible) = 0; |
| 190 | virtual Error setLayerZOrder(Display display, Layer layer, uint32_t z) = 0; |
| 191 | virtual Error setLayerInfo(Display display, Layer layer, uint32_t type, uint32_t appId) = 0; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 192 | |
| 193 | // Composer HAL 2.2 |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 194 | virtual Error setLayerPerFrameMetadata( |
| 195 | Display display, Layer layer, |
| 196 | const std::vector<IComposerClient::PerFrameMetadata>& perFrameMetadatas) = 0; |
Chia-I Wu | d7e01d7 | 2018-06-21 13:39:09 +0800 | [diff] [blame] | 197 | virtual std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys( |
| 198 | Display display) = 0; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 199 | virtual Error getRenderIntents(Display display, ColorMode colorMode, |
| 200 | std::vector<RenderIntent>* outRenderIntents) = 0; |
| 201 | virtual Error getDataspaceSaturationMatrix(Dataspace dataspace, mat4* outMatrix) = 0; |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 202 | |
| 203 | // Composer HAL 2.3 |
| 204 | virtual Error getDisplayIdentificationData(Display display, uint8_t* outPort, |
| 205 | std::vector<uint8_t>* outData) = 0; |
Peiyong Lin | 698147a | 2018-09-14 13:27:18 -0700 | [diff] [blame] | 206 | virtual Error setLayerColorTransform(Display display, Layer layer, |
| 207 | const float* matrix) = 0; |
Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 208 | virtual Error getDisplayedContentSamplingAttributes(Display display, PixelFormat* outFormat, |
| 209 | Dataspace* outDataspace, |
| 210 | uint8_t* outComponentMask) = 0; |
Kevin DuBois | 74e5377 | 2018-11-19 10:52:38 -0800 | [diff] [blame] | 211 | virtual Error setDisplayContentSamplingEnabled(Display display, bool enabled, |
| 212 | uint8_t componentMask, uint64_t maxFrames) = 0; |
Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 213 | virtual Error getDisplayedContentSample(Display display, uint64_t maxFrames, uint64_t timestamp, |
| 214 | DisplayedFrameStats* outStats) = 0; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 215 | virtual Error setLayerPerFrameMetadataBlobs( |
| 216 | Display display, Layer layer, const std::vector<PerFrameMetadataBlob>& metadata) = 0; |
Dan Gittik | 57e63c5 | 2019-01-18 16:37:54 +0000 | [diff] [blame] | 217 | virtual Error setDisplayBrightness(Display display, float brightness) = 0; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 218 | |
| 219 | // Composer HAL 2.4 |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 220 | virtual bool isVsyncPeriodSwitchSupported() = 0; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 221 | virtual Error getDisplayCapabilities(Display display, |
| 222 | std::vector<DisplayCapability>* outCapabilities) = 0; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 223 | virtual V2_4::Error getDisplayConnectionType( |
| 224 | Display display, IComposerClient::DisplayConnectionType* outType) = 0; |
| 225 | virtual V2_4::Error getDisplayVsyncPeriod(Display display, |
| 226 | VsyncPeriodNanos* outVsyncPeriod) = 0; |
| 227 | virtual V2_4::Error setActiveConfigWithConstraints( |
| 228 | Display display, Config config, |
| 229 | const IComposerClient::VsyncPeriodChangeConstraints& vsyncPeriodChangeConstraints, |
| 230 | VsyncPeriodChangeTimeline* outTimeline) = 0; |
Galia Peycheva | 5492cb5 | 2019-10-30 14:13:16 +0100 | [diff] [blame] | 231 | |
| 232 | virtual V2_4::Error setAutoLowLatencyMode(Display displayId, bool on) = 0; |
| 233 | virtual V2_4::Error getSupportedContentTypes( |
| 234 | Display displayId, |
| 235 | std::vector<IComposerClient::ContentType>* outSupportedContentTypes) = 0; |
| 236 | virtual V2_4::Error setContentType(Display displayId, |
| 237 | IComposerClient::ContentType contentType) = 0; |
Dan Stoza | 18d48cb | 2019-10-21 15:39:24 -0700 | [diff] [blame] | 238 | virtual V2_4::Error setLayerGenericMetadata(Display display, Layer layer, |
| 239 | const std::string& key, bool mandatory, |
| 240 | const std::vector<uint8_t>& value) = 0; |
| 241 | virtual V2_4::Error getLayerGenericMetadataKeys( |
| 242 | std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) = 0; |
Peiyong Lin | dfc3f7c | 2020-05-07 20:15:50 -0700 | [diff] [blame^] | 243 | virtual Error getClientTargetProperty( |
| 244 | Display display, IComposerClient::ClientTargetProperty* outClientTargetProperty) = 0; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 245 | }; |
| 246 | |
| 247 | namespace impl { |
| 248 | |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 249 | class CommandReader : public CommandReaderBase { |
| 250 | public: |
| 251 | ~CommandReader(); |
| 252 | |
| 253 | // Parse and execute commands from the command queue. The commands are |
| 254 | // actually return values from the server and will be saved in ReturnData. |
| 255 | Error parse(); |
| 256 | |
| 257 | // Get and clear saved errors. |
| 258 | struct CommandError { |
| 259 | uint32_t location; |
| 260 | Error error; |
| 261 | }; |
| 262 | std::vector<CommandError> takeErrors(); |
| 263 | |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 264 | bool hasChanges(Display display, uint32_t* outNumChangedCompositionTypes, |
| 265 | uint32_t* outNumLayerRequestMasks) const; |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 266 | |
| 267 | // Get and clear saved changed composition types. |
| 268 | void takeChangedCompositionTypes(Display display, |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 269 | std::vector<Layer>* outLayers, |
| 270 | std::vector<IComposerClient::Composition>* outTypes); |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 271 | |
| 272 | // Get and clear saved display requests. |
| 273 | void takeDisplayRequests(Display display, |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 274 | uint32_t* outDisplayRequestMask, std::vector<Layer>* outLayers, |
| 275 | std::vector<uint32_t>* outLayerRequestMasks); |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 276 | |
| 277 | // Get and clear saved release fences. |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 278 | void takeReleaseFences(Display display, std::vector<Layer>* outLayers, |
| 279 | std::vector<int>* outReleaseFences); |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 280 | |
| 281 | // Get and clear saved present fence. |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 282 | void takePresentFence(Display display, int* outPresentFence); |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 283 | |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 284 | // Get what stage succeeded during PresentOrValidate: Present or Validate |
| 285 | void takePresentOrValidateStage(Display display, uint32_t * state); |
| 286 | |
Peiyong Lin | dfc3f7c | 2020-05-07 20:15:50 -0700 | [diff] [blame^] | 287 | // Get the client target properties requested by hardware composer. |
| 288 | void takeClientTargetProperty(Display display, |
| 289 | IComposerClient::ClientTargetProperty* outClientTargetProperty); |
| 290 | |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 291 | private: |
| 292 | void resetData(); |
| 293 | |
| 294 | bool parseSelectDisplay(uint16_t length); |
| 295 | bool parseSetError(uint16_t length); |
| 296 | bool parseSetChangedCompositionTypes(uint16_t length); |
| 297 | bool parseSetDisplayRequests(uint16_t length); |
| 298 | bool parseSetPresentFence(uint16_t length); |
| 299 | bool parseSetReleaseFences(uint16_t length); |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 300 | bool parseSetPresentOrValidateDisplayResult(uint16_t length); |
Peiyong Lin | afa0f57 | 2020-01-13 16:35:02 -0800 | [diff] [blame] | 301 | bool parseSetClientTargetProperty(uint16_t length); |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 302 | |
| 303 | struct ReturnData { |
| 304 | uint32_t displayRequests = 0; |
| 305 | |
| 306 | std::vector<Layer> changedLayers; |
| 307 | std::vector<IComposerClient::Composition> compositionTypes; |
| 308 | |
| 309 | std::vector<Layer> requestedLayers; |
| 310 | std::vector<uint32_t> requestMasks; |
| 311 | |
| 312 | int presentFence = -1; |
| 313 | |
| 314 | std::vector<Layer> releasedLayers; |
| 315 | std::vector<int> releaseFences; |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 316 | |
| 317 | uint32_t presentOrValidateState; |
Peiyong Lin | afa0f57 | 2020-01-13 16:35:02 -0800 | [diff] [blame] | 318 | |
| 319 | // Composer 2.4 implementation can return a client target property |
| 320 | // structure to indicate the client target properties that hardware |
| 321 | // composer requests. The composer client must change the client target |
| 322 | // properties to match this request. |
| 323 | IComposerClient::ClientTargetProperty clientTargetProperty{PixelFormat::RGBA_8888, |
| 324 | Dataspace::UNKNOWN}; |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 325 | }; |
| 326 | |
| 327 | std::vector<CommandError> mErrors; |
| 328 | std::unordered_map<Display, ReturnData> mReturnData; |
| 329 | |
| 330 | // When SELECT_DISPLAY is parsed, this is updated to point to the |
| 331 | // display's return data in mReturnData. We use it to avoid repeated |
| 332 | // map lookups. |
| 333 | ReturnData* mCurrentReturnData; |
| 334 | }; |
| 335 | |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 336 | // Composer is a wrapper to IComposer, a proxy to server-side composer. |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 337 | class Composer final : public Hwc2::Composer { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 338 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 339 | explicit Composer(const std::string& serviceName); |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 340 | ~Composer() override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 341 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 342 | std::vector<IComposer::Capability> getCapabilities() override; |
| 343 | std::string dumpDebugInfo() override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 344 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 345 | void registerCallback(const sp<IComposerCallback>& callback) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 346 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 347 | // Returns true if the connected composer service is running in a remote |
| 348 | // process, false otherwise. This will return false if the service is |
| 349 | // configured in passthrough mode, for example. |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 350 | bool isRemote() override; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 351 | |
Steven Thomas | 0af4b9f | 2017-04-26 14:34:01 -0700 | [diff] [blame] | 352 | // Reset all pending commands in the command buffer. Useful if you want to |
| 353 | // skip a frame but have already queued some commands. |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 354 | void resetCommands() override; |
Steven Thomas | 0af4b9f | 2017-04-26 14:34:01 -0700 | [diff] [blame] | 355 | |
Chia-I Wu | ae5a6b8 | 2017-10-10 09:09:22 -0700 | [diff] [blame] | 356 | // Explicitly flush all pending commands in the command buffer. |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 357 | Error executeCommands() override; |
Chia-I Wu | ae5a6b8 | 2017-10-10 09:09:22 -0700 | [diff] [blame] | 358 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 359 | uint32_t getMaxVirtualDisplayCount() override; |
| 360 | bool isUsingVrComposer() const override { return mIsUsingVrComposer; } |
| 361 | Error createVirtualDisplay(uint32_t width, uint32_t height, PixelFormat* format, |
| 362 | Display* outDisplay) override; |
| 363 | Error destroyVirtualDisplay(Display display) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 364 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 365 | Error acceptDisplayChanges(Display display) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 366 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 367 | Error createLayer(Display display, Layer* outLayer) override; |
| 368 | Error destroyLayer(Display display, Layer layer) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 369 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 370 | Error getActiveConfig(Display display, Config* outConfig) override; |
| 371 | Error getChangedCompositionTypes(Display display, std::vector<Layer>* outLayers, |
| 372 | std::vector<IComposerClient::Composition>* outTypes) override; |
| 373 | Error getColorModes(Display display, std::vector<ColorMode>* outModes) override; |
| 374 | Error getDisplayAttribute(Display display, Config config, IComposerClient::Attribute attribute, |
| 375 | int32_t* outValue) override; |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 376 | Error getDisplayConfigs(Display display, std::vector<Config>* outConfigs); |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 377 | Error getDisplayName(Display display, std::string* outName) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 378 | |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 379 | Error getDisplayRequests(Display display, uint32_t* outDisplayRequestMask, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 380 | std::vector<Layer>* outLayers, |
| 381 | std::vector<uint32_t>* outLayerRequestMasks) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 382 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 383 | Error getDozeSupport(Display display, bool* outSupport) override; |
| 384 | Error getHdrCapabilities(Display display, std::vector<Hdr>* outTypes, float* outMaxLuminance, |
| 385 | float* outMaxAverageLuminance, float* outMinLuminance) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 386 | |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 387 | Error getReleaseFences(Display display, std::vector<Layer>* outLayers, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 388 | std::vector<int>* outReleaseFences) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 389 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 390 | Error presentDisplay(Display display, int* outPresentFence) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 391 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 392 | Error setActiveConfig(Display display, Config config) override; |
Chia-I Wu | 06d63de | 2017-01-04 14:58:51 +0800 | [diff] [blame] | 393 | |
| 394 | /* |
| 395 | * The composer caches client targets internally. When target is nullptr, |
| 396 | * the composer uses slot to look up the client target from its cache. |
| 397 | * When target is not nullptr, the cache is updated with the new target. |
| 398 | */ |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 399 | Error setClientTarget(Display display, uint32_t slot, const sp<GraphicBuffer>& target, |
| 400 | int acquireFence, Dataspace dataspace, |
| 401 | const std::vector<IComposerClient::Rect>& damage) override; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 402 | Error setColorMode(Display display, ColorMode mode, RenderIntent renderIntent) override; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 403 | Error setColorTransform(Display display, const float* matrix, ColorTransform hint) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 404 | Error setOutputBuffer(Display display, const native_handle_t* buffer, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 405 | int releaseFence) override; |
| 406 | Error setPowerMode(Display display, IComposerClient::PowerMode mode) override; |
| 407 | Error setVsyncEnabled(Display display, IComposerClient::Vsync enabled) override; |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 408 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 409 | Error setClientTargetSlotCount(Display display) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 410 | |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 411 | Error validateDisplay(Display display, uint32_t* outNumTypes, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 412 | uint32_t* outNumRequests) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 413 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 414 | Error presentOrValidateDisplay(Display display, uint32_t* outNumTypes, uint32_t* outNumRequests, |
| 415 | int* outPresentFence, uint32_t* state) override; |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 416 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 417 | Error setCursorPosition(Display display, Layer layer, int32_t x, int32_t y) override; |
Chia-I Wu | 06d63de | 2017-01-04 14:58:51 +0800 | [diff] [blame] | 418 | /* see setClientTarget for the purpose of slot */ |
| 419 | Error setLayerBuffer(Display display, Layer layer, uint32_t slot, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 420 | const sp<GraphicBuffer>& buffer, int acquireFence) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 421 | Error setLayerSurfaceDamage(Display display, Layer layer, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 422 | const std::vector<IComposerClient::Rect>& damage) override; |
| 423 | Error setLayerBlendMode(Display display, Layer layer, IComposerClient::BlendMode mode) override; |
| 424 | Error setLayerColor(Display display, Layer layer, const IComposerClient::Color& color) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 425 | Error setLayerCompositionType(Display display, Layer layer, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 426 | IComposerClient::Composition type) override; |
| 427 | Error setLayerDataspace(Display display, Layer layer, Dataspace dataspace) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 428 | Error setLayerDisplayFrame(Display display, Layer layer, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 429 | const IComposerClient::Rect& frame) override; |
| 430 | Error setLayerPlaneAlpha(Display display, Layer layer, float alpha) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 431 | Error setLayerSidebandStream(Display display, Layer layer, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 432 | const native_handle_t* stream) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 433 | Error setLayerSourceCrop(Display display, Layer layer, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 434 | const IComposerClient::FRect& crop) override; |
| 435 | Error setLayerTransform(Display display, Layer layer, Transform transform) override; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 436 | Error setLayerVisibleRegion(Display display, Layer layer, |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 437 | const std::vector<IComposerClient::Rect>& visible) override; |
| 438 | Error setLayerZOrder(Display display, Layer layer, uint32_t z) override; |
| 439 | Error setLayerInfo(Display display, Layer layer, uint32_t type, uint32_t appId) override; |
| 440 | |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 441 | // Composer HAL 2.2 |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 442 | Error setLayerPerFrameMetadata( |
| 443 | Display display, Layer layer, |
| 444 | const std::vector<IComposerClient::PerFrameMetadata>& perFrameMetadatas) override; |
Chia-I Wu | d7e01d7 | 2018-06-21 13:39:09 +0800 | [diff] [blame] | 445 | std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys( |
| 446 | Display display) override; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 447 | Error getRenderIntents(Display display, ColorMode colorMode, |
| 448 | std::vector<RenderIntent>* outRenderIntents) override; |
| 449 | Error getDataspaceSaturationMatrix(Dataspace dataspace, mat4* outMatrix) override; |
| 450 | |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 451 | // Composer HAL 2.3 |
| 452 | Error getDisplayIdentificationData(Display display, uint8_t* outPort, |
| 453 | std::vector<uint8_t>* outData) override; |
Peiyong Lin | 698147a | 2018-09-14 13:27:18 -0700 | [diff] [blame] | 454 | Error setLayerColorTransform(Display display, Layer layer, const float* matrix) override; |
Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 455 | Error getDisplayedContentSamplingAttributes(Display display, PixelFormat* outFormat, |
| 456 | Dataspace* outDataspace, |
| 457 | uint8_t* outComponentMask) override; |
Kevin DuBois | 74e5377 | 2018-11-19 10:52:38 -0800 | [diff] [blame] | 458 | Error setDisplayContentSamplingEnabled(Display display, bool enabled, uint8_t componentMask, |
| 459 | uint64_t maxFrames) override; |
Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 460 | Error getDisplayedContentSample(Display display, uint64_t maxFrames, uint64_t timestamp, |
| 461 | DisplayedFrameStats* outStats) override; |
Valerie Hau | e9e843a | 2018-12-18 13:39:23 -0800 | [diff] [blame] | 462 | Error setLayerPerFrameMetadataBlobs( |
| 463 | Display display, Layer layer, |
| 464 | const std::vector<IComposerClient::PerFrameMetadataBlob>& metadata) override; |
Dan Gittik | 57e63c5 | 2019-01-18 16:37:54 +0000 | [diff] [blame] | 465 | Error setDisplayBrightness(Display display, float brightness) override; |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 466 | |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 467 | // Composer HAL 2.4 |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 468 | bool isVsyncPeriodSwitchSupported() override { return mClient_2_4 != nullptr; } |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 469 | Error getDisplayCapabilities(Display display, |
| 470 | std::vector<DisplayCapability>* outCapabilities) override; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 471 | V2_4::Error getDisplayConnectionType(Display display, |
| 472 | IComposerClient::DisplayConnectionType* outType) override; |
| 473 | V2_4::Error getDisplayVsyncPeriod(Display display, VsyncPeriodNanos* outVsyncPeriod) override; |
| 474 | V2_4::Error setActiveConfigWithConstraints( |
| 475 | Display display, Config config, |
| 476 | const IComposerClient::VsyncPeriodChangeConstraints& vsyncPeriodChangeConstraints, |
| 477 | VsyncPeriodChangeTimeline* outTimeline) override; |
Galia Peycheva | 5492cb5 | 2019-10-30 14:13:16 +0100 | [diff] [blame] | 478 | V2_4::Error setAutoLowLatencyMode(Display displayId, bool on) override; |
| 479 | V2_4::Error getSupportedContentTypes( |
| 480 | Display displayId, |
| 481 | std::vector<IComposerClient::ContentType>* outSupportedContentTypes) override; |
| 482 | V2_4::Error setContentType(Display displayId, |
| 483 | IComposerClient::ContentType contentType) override; |
Dan Stoza | 18d48cb | 2019-10-21 15:39:24 -0700 | [diff] [blame] | 484 | V2_4::Error setLayerGenericMetadata(Display display, Layer layer, const std::string& key, |
| 485 | bool mandatory, const std::vector<uint8_t>& value) override; |
| 486 | V2_4::Error getLayerGenericMetadataKeys( |
| 487 | std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) override; |
Peiyong Lin | dfc3f7c | 2020-05-07 20:15:50 -0700 | [diff] [blame^] | 488 | Error getClientTargetProperty( |
| 489 | Display display, |
| 490 | IComposerClient::ClientTargetProperty* outClientTargetProperty) override; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 491 | |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 492 | private: |
mamik | 94e91f6 | 2019-08-19 09:11:33 -0700 | [diff] [blame] | 493 | #if defined(USE_VR_COMPOSER) && USE_VR_COMPOSER |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 494 | class CommandWriter : public CommandWriterBase { |
| 495 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 496 | explicit CommandWriter(uint32_t initialMaxSize); |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 497 | ~CommandWriter() override; |
| 498 | |
| 499 | void setLayerInfo(uint32_t type, uint32_t appId); |
Daniel Nicoara | 1f42e3a | 2017-04-10 13:27:32 -0400 | [diff] [blame] | 500 | void setClientTargetMetadata( |
| 501 | const IVrComposerClient::BufferMetadata& metadata); |
| 502 | void setLayerBufferMetadata( |
| 503 | const IVrComposerClient::BufferMetadata& metadata); |
| 504 | |
| 505 | private: |
| 506 | void writeBufferMetadata( |
| 507 | const IVrComposerClient::BufferMetadata& metadata); |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 508 | }; |
mamik | 94e91f6 | 2019-08-19 09:11:33 -0700 | [diff] [blame] | 509 | #else |
| 510 | class CommandWriter : public CommandWriterBase { |
| 511 | public: |
| 512 | explicit CommandWriter(uint32_t initialMaxSize) : CommandWriterBase(initialMaxSize) {} |
| 513 | ~CommandWriter() override {} |
| 514 | }; |
| 515 | #endif // defined(USE_VR_COMPOSER) && USE_VR_COMPOSER |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 516 | |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 517 | // Many public functions above simply write a command into the command |
| 518 | // queue to batch the calls. validateDisplay and presentDisplay will call |
| 519 | // this function to execute the command queue. |
| 520 | Error execute(); |
| 521 | |
Dominik Laskowski | 6231aaf | 2018-04-02 17:10:23 -0700 | [diff] [blame] | 522 | sp<V2_1::IComposer> mComposer; |
| 523 | |
| 524 | sp<V2_1::IComposerClient> mClient; |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 525 | sp<V2_2::IComposerClient> mClient_2_2; |
Dominik Laskowski | 25a4e7d | 2019-09-20 14:50:10 -0700 | [diff] [blame] | 526 | sp<V2_3::IComposerClient> mClient_2_3; |
| 527 | sp<IComposerClient> mClient_2_4; |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 528 | |
| 529 | // 64KiB minus a small space for metadata such as read/write pointers |
| 530 | static constexpr size_t kWriterInitialSize = |
| 531 | 64 * 1024 / sizeof(uint32_t) - 16; |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 532 | CommandWriter mWriter; |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 533 | CommandReader mReader; |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 534 | |
Hendrik Wagenaar | 87670ff | 2017-02-01 12:10:46 -0800 | [diff] [blame] | 535 | // When true, the we attach to the vr_hwcomposer service instead of the |
| 536 | // hwcomposer. This allows us to redirect surfaces to 3d surfaces in vr. |
| 537 | const bool mIsUsingVrComposer; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 538 | }; |
| 539 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 540 | } // namespace impl |
| 541 | |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 542 | } // namespace Hwc2 |
| 543 | |
| 544 | } // namespace android |
| 545 | |
| 546 | #endif // ANDROID_SF_COMPOSER_HAL_H |