1 /* 2 * Copyright 2015 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 <android-base/expected.h> 20 #include <android-base/thread_annotations.h> 21 #include <ftl/expected.h> 22 #include <ftl/future.h> 23 #include <ftl/small_map.h> 24 #include <gui/HdrMetadata.h> 25 #include <math/mat4.h> 26 #include <ui/HdrCapabilities.h> 27 #include <ui/PictureProfileHandle.h> 28 #include <ui/Region.h> 29 #include <ui/StaticDisplayInfo.h> 30 #include <utils/Log.h> 31 #include <utils/StrongPointer.h> 32 #include <utils/Timers.h> 33 34 #include <functional> 35 #include <string> 36 #include <unordered_map> 37 #include <unordered_set> 38 #include <vector> 39 40 #include "ComposerHal.h" 41 #include "Hal.h" 42 43 #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> 44 #include <aidl/android/hardware/graphics/common/DisplayHotplugEvent.h> 45 #include <aidl/android/hardware/graphics/composer3/Capability.h> 46 #include <aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.h> 47 #include <aidl/android/hardware/graphics/composer3/Color.h> 48 #include <aidl/android/hardware/graphics/composer3/Composition.h> 49 #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> 50 #include <aidl/android/hardware/graphics/composer3/Luts.h> 51 #include <aidl/android/hardware/graphics/composer3/OverlayProperties.h> 52 #include <aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.h> 53 54 namespace android { 55 56 class Fence; 57 class FloatRect; 58 class GraphicBuffer; 59 class TestableSurfaceFlinger; 60 struct DisplayedFrameStats; 61 62 namespace Hwc2 { 63 class Composer; 64 } // namespace Hwc2 65 66 namespace HWC2 { 67 68 class Layer; 69 70 namespace hal = android::hardware::graphics::composer::hal; 71 72 using aidl::android::hardware::drm::HdcpLevels; 73 using aidl::android::hardware::graphics::common::DisplayHotplugEvent; 74 using aidl::android::hardware::graphics::composer3::RefreshRateChangedDebugData; 75 76 // Implement this interface to receive hardware composer events. 77 // 78 // These callback functions will generally be called on a hwbinder thread, but 79 // when first registering the callback the onComposerHalHotplugEvent() function 80 // will immediately be called on the thread calling registerCallback(). 81 struct ComposerCallback { 82 virtual void onComposerHalHotplugEvent(hal::HWDisplayId, DisplayHotplugEvent) = 0; 83 virtual void onComposerHalRefresh(hal::HWDisplayId) = 0; 84 virtual void onComposerHalVsync(hal::HWDisplayId, nsecs_t timestamp, 85 std::optional<hal::VsyncPeriodNanos>) = 0; 86 virtual void onComposerHalVsyncPeriodTimingChanged(hal::HWDisplayId, 87 const hal::VsyncPeriodChangeTimeline&) = 0; 88 virtual void onComposerHalSeamlessPossible(hal::HWDisplayId) = 0; 89 virtual void onComposerHalVsyncIdle(hal::HWDisplayId) = 0; 90 virtual void onRefreshRateChangedDebug(const RefreshRateChangedDebugData&) = 0; 91 virtual void onComposerHalHdcpLevelsChanged(hal::HWDisplayId, const HdcpLevels& levels) = 0; 92 93 protected: 94 ~ComposerCallback() = default; 95 }; 96 97 // Convenience C++ class to access per display functions directly. 98 class Display { 99 public: 100 virtual ~Display(); 101 102 virtual hal::HWDisplayId getId() const = 0; 103 virtual bool isConnected() const = 0; 104 virtual void setConnected(bool connected) = 0; // For use by HWComposer only 105 virtual bool hasCapability( 106 aidl::android::hardware::graphics::composer3::DisplayCapability) const = 0; 107 virtual bool isVsyncPeriodSwitchSupported() const = 0; 108 virtual bool hasDisplayIdleTimerCapability() const = 0; 109 virtual void onLayerDestroyed(hal::HWLayerId layerId) = 0; 110 virtual std::optional<ui::Size> getPhysicalSizeInMm() const = 0; 111 112 static const int kLutFileDescriptorMapperSize = 20; 113 using LutOffsetAndProperties = std::vector< 114 std::pair<int32_t, aidl::android::hardware::graphics::composer3::LutProperties>>; 115 using LayerLuts = 116 ftl::SmallMap<HWC2::Layer*, LutOffsetAndProperties, kLutFileDescriptorMapperSize>; 117 using LutFileDescriptorMapper = 118 ftl::SmallMap<HWC2::Layer*, ndk::ScopedFileDescriptor, kLutFileDescriptorMapperSize>; 119 120 [[nodiscard]] virtual hal::Error acceptChanges() = 0; 121 [[nodiscard]] virtual base::expected<std::shared_ptr<HWC2::Layer>, hal::Error> 122 createLayer() = 0; 123 [[nodiscard]] virtual hal::Error getChangedCompositionTypes( 124 std::unordered_map<Layer*, aidl::android::hardware::graphics::composer3::Composition>* 125 outTypes) = 0; 126 [[nodiscard]] virtual hal::Error getColorModes(std::vector<hal::ColorMode>* outModes) const = 0; 127 // Returns a bitmask which contains HdrMetadata::Type::*. 128 [[nodiscard]] virtual int32_t getSupportedPerFrameMetadata() const = 0; 129 [[nodiscard]] virtual hal::Error getRenderIntents( 130 hal::ColorMode colorMode, std::vector<hal::RenderIntent>* outRenderIntents) const = 0; 131 [[nodiscard]] virtual hal::Error getDataspaceSaturationMatrix(hal::Dataspace dataspace, 132 android::mat4* outMatrix) = 0; 133 134 [[nodiscard]] virtual hal::Error getName(std::string* outName) const = 0; 135 [[nodiscard]] virtual hal::Error getRequests( 136 hal::DisplayRequest* outDisplayRequests, 137 std::unordered_map<Layer*, hal::LayerRequest>* outLayerRequests) = 0; 138 [[nodiscard]] virtual ftl::Expected<ui::DisplayConnectionType, hal::Error> getConnectionType() 139 const = 0; 140 [[nodiscard]] virtual hal::Error supportsDoze(bool* outSupport) const = 0; 141 [[nodiscard]] virtual hal::Error getHdrCapabilities( 142 android::HdrCapabilities* outCapabilities) const = 0; 143 [[nodiscard]] virtual hal::Error getOverlaySupport( 144 aidl::android::hardware::graphics::composer3::OverlayProperties* outProperties) 145 const = 0; 146 [[nodiscard]] virtual hal::Error getDisplayedContentSamplingAttributes( 147 hal::PixelFormat* outFormat, hal::Dataspace* outDataspace, 148 uint8_t* outComponentMask) const = 0; 149 [[nodiscard]] virtual hal::Error setDisplayContentSamplingEnabled(bool enabled, 150 uint8_t componentMask, 151 uint64_t maxFrames) const = 0; 152 [[nodiscard]] virtual hal::Error getDisplayedContentSample( 153 uint64_t maxFrames, uint64_t timestamp, 154 android::DisplayedFrameStats* outStats) const = 0; 155 [[nodiscard]] virtual hal::Error getReleaseFences( 156 std::unordered_map<Layer*, android::sp<android::Fence>>* outFences) const = 0; 157 [[nodiscard]] virtual hal::Error present(android::sp<android::Fence>* outPresentFence) = 0; 158 [[nodiscard]] virtual hal::Error setClientTarget( 159 uint32_t slot, const android::sp<android::GraphicBuffer>& target, 160 const android::sp<android::Fence>& acquireFence, hal::Dataspace dataspace, 161 float hdrSdrRatio) = 0; 162 [[nodiscard]] virtual hal::Error setColorMode(hal::ColorMode mode, 163 hal::RenderIntent renderIntent) = 0; 164 [[nodiscard]] virtual hal::Error setColorTransform(const android::mat4& matrix) = 0; 165 [[nodiscard]] virtual hal::Error setOutputBuffer( 166 const android::sp<android::GraphicBuffer>& buffer, 167 const android::sp<android::Fence>& releaseFence) = 0; 168 [[nodiscard]] virtual hal::Error setPowerMode(hal::PowerMode mode) = 0; 169 [[nodiscard]] virtual hal::Error setVsyncEnabled(hal::Vsync enabled) = 0; 170 [[nodiscard]] virtual hal::Error validate(nsecs_t expectedPresentTime, int32_t frameIntervalNs, 171 uint32_t* outNumTypes, uint32_t* outNumRequests) = 0; 172 [[nodiscard]] virtual hal::Error presentOrValidate(nsecs_t expectedPresentTime, 173 int32_t frameIntervalNs, 174 uint32_t* outNumTypes, 175 uint32_t* outNumRequests, 176 android::sp<android::Fence>* outPresentFence, 177 uint32_t* state) = 0; 178 [[nodiscard]] virtual ftl::Future<hal::Error> setDisplayBrightness( 179 float brightness, float brightnessNits, 180 const Hwc2::Composer::DisplayBrightnessOptions& options) = 0; 181 [[nodiscard]] virtual hal::Error setActiveConfigWithConstraints( 182 hal::HWConfigId configId, const hal::VsyncPeriodChangeConstraints& constraints, 183 hal::VsyncPeriodChangeTimeline* outTimeline) = 0; 184 [[nodiscard]] virtual hal::Error setBootDisplayConfig(hal::HWConfigId configId) = 0; 185 [[nodiscard]] virtual hal::Error clearBootDisplayConfig() = 0; 186 [[nodiscard]] virtual hal::Error getPreferredBootDisplayConfig( 187 hal::HWConfigId* configId) const = 0; 188 [[nodiscard]] virtual hal::Error setAutoLowLatencyMode(bool on) = 0; 189 [[nodiscard]] virtual hal::Error getSupportedContentTypes( 190 std::vector<hal::ContentType>*) const = 0; 191 [[nodiscard]] virtual hal::Error setContentType(hal::ContentType) = 0; 192 [[nodiscard]] virtual hal::Error getClientTargetProperty( 193 aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness* 194 outClientTargetProperty) = 0; 195 [[nodiscard]] virtual hal::Error getRequestedLuts( 196 LayerLuts* outLuts, LutFileDescriptorMapper& lutFileDescriptorMapper) = 0; 197 [[nodiscard]] virtual hal::Error getDisplayDecorationSupport( 198 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>* 199 support) = 0; 200 [[nodiscard]] virtual hal::Error setIdleTimerEnabled(std::chrono::milliseconds timeout) = 0; 201 [[nodiscard]] virtual hal::Error getPhysicalDisplayOrientation( 202 Hwc2::AidlTransform* outTransform) const = 0; 203 [[nodiscard]] virtual hal::Error getMaxLayerPictureProfiles(int32_t* maxProfiles) = 0; 204 [[nodiscard]] virtual hal::Error setPictureProfileHandle( 205 const PictureProfileHandle& handle) = 0; 206 }; 207 208 namespace impl { 209 210 class Layer; 211 212 class Display : public HWC2::Display { 213 public: 214 Display(android::Hwc2::Composer&, 215 const std::unordered_set<aidl::android::hardware::graphics::composer3::Capability>&, 216 hal::HWDisplayId, hal::DisplayType); 217 ~Display() override; 218 219 // Required by HWC2 220 hal::Error acceptChanges() override; 221 base::expected<std::shared_ptr<HWC2::Layer>, hal::Error> createLayer() override; 222 hal::Error getChangedCompositionTypes( 223 std::unordered_map<HWC2::Layer*, 224 aidl::android::hardware::graphics::composer3::Composition>* outTypes) 225 override; 226 hal::Error getColorModes(std::vector<hal::ColorMode>* outModes) const override; 227 // Returns a bitmask which contains HdrMetadata::Type::*. 228 int32_t getSupportedPerFrameMetadata() const override; 229 hal::Error getRenderIntents(hal::ColorMode colorMode, 230 std::vector<hal::RenderIntent>* outRenderIntents) const override; 231 hal::Error getDataspaceSaturationMatrix(hal::Dataspace, android::mat4* outMatrix) override; 232 233 hal::Error getName(std::string* outName) const override; 234 hal::Error getRequests( 235 hal::DisplayRequest* outDisplayRequests, 236 std::unordered_map<HWC2::Layer*, hal::LayerRequest>* outLayerRequests) override; 237 ftl::Expected<ui::DisplayConnectionType, hal::Error> getConnectionType() const override; 238 hal::Error supportsDoze(bool* outSupport) const override EXCLUDES(mDisplayCapabilitiesMutex); 239 hal::Error getHdrCapabilities(android::HdrCapabilities* outCapabilities) const override; 240 hal::Error getOverlaySupport(aidl::android::hardware::graphics::composer3::OverlayProperties* 241 outProperties) const override; 242 hal::Error getDisplayedContentSamplingAttributes(hal::PixelFormat* outFormat, 243 hal::Dataspace* outDataspace, 244 uint8_t* outComponentMask) const override; 245 hal::Error setDisplayContentSamplingEnabled(bool enabled, uint8_t componentMask, 246 uint64_t maxFrames) const override; 247 hal::Error getDisplayedContentSample(uint64_t maxFrames, uint64_t timestamp, 248 android::DisplayedFrameStats* outStats) const override; 249 hal::Error getReleaseFences(std::unordered_map<HWC2::Layer*, android::sp<android::Fence>>* 250 outFences) const override; 251 hal::Error present(android::sp<android::Fence>* outPresentFence) override; 252 hal::Error setClientTarget(uint32_t slot, const android::sp<android::GraphicBuffer>& target, 253 const android::sp<android::Fence>& acquireFence, 254 hal::Dataspace dataspace, float hdrSdrRatio) override; 255 hal::Error setColorMode(hal::ColorMode, hal::RenderIntent) override; 256 hal::Error setColorTransform(const android::mat4& matrix) override; 257 hal::Error setOutputBuffer(const android::sp<android::GraphicBuffer>&, 258 const android::sp<android::Fence>& releaseFence) override; 259 hal::Error setPowerMode(hal::PowerMode) override; 260 hal::Error setVsyncEnabled(hal::Vsync enabled) override; 261 hal::Error validate(nsecs_t expectedPresentTime, int32_t frameIntervalNs, uint32_t* outNumTypes, 262 uint32_t* outNumRequests) override; 263 hal::Error presentOrValidate(nsecs_t expectedPresentTime, int32_t frameIntervalNs, 264 uint32_t* outNumTypes, uint32_t* outNumRequests, 265 android::sp<android::Fence>* outPresentFence, 266 uint32_t* state) override; 267 ftl::Future<hal::Error> setDisplayBrightness( 268 float brightness, float brightnessNits, 269 const Hwc2::Composer::DisplayBrightnessOptions& options) override; 270 hal::Error setActiveConfigWithConstraints(hal::HWConfigId configId, 271 const hal::VsyncPeriodChangeConstraints& constraints, 272 hal::VsyncPeriodChangeTimeline* outTimeline) override; 273 hal::Error setBootDisplayConfig(hal::HWConfigId configId) override; 274 hal::Error clearBootDisplayConfig() override; 275 hal::Error getPreferredBootDisplayConfig(hal::HWConfigId* configId) const override; 276 hal::Error setAutoLowLatencyMode(bool on) override; 277 hal::Error getSupportedContentTypes( 278 std::vector<hal::ContentType>* outSupportedContentTypes) const override; 279 hal::Error setContentType(hal::ContentType) override; 280 hal::Error getClientTargetProperty( 281 aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness* 282 outClientTargetProperty) override; 283 hal::Error getRequestedLuts(LayerLuts* outLuts, 284 LutFileDescriptorMapper& lutFileDescriptorMapper) override; 285 hal::Error getDisplayDecorationSupport( 286 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>* 287 support) override; 288 hal::Error setIdleTimerEnabled(std::chrono::milliseconds timeout) override; 289 hal::Error getMaxLayerPictureProfiles(int32_t* maxProfiles) override; 290 hal::Error setPictureProfileHandle(const android::PictureProfileHandle& handle) override; 291 292 // Other Display methods getId()293 hal::HWDisplayId getId() const override { return mId; } isConnected()294 bool isConnected() const override { return mIsConnected; } 295 void setConnected(bool connected) override; 296 bool hasCapability(aidl::android::hardware::graphics::composer3::DisplayCapability) 297 const override EXCLUDES(mDisplayCapabilitiesMutex); 298 bool isVsyncPeriodSwitchSupported() const override; 299 bool hasDisplayIdleTimerCapability() const override; 300 void onLayerDestroyed(hal::HWLayerId layerId) override; 301 hal::Error getPhysicalDisplayOrientation(Hwc2::AidlTransform* outTransform) const override; 302 void setPhysicalSizeInMm(std::optional<ui::Size> size); getPhysicalSizeInMm()303 std::optional<ui::Size> getPhysicalSizeInMm() const override { return mPhysicalSize; } 304 305 private: 306 void loadDisplayCapabilities(); 307 308 // This may fail (and return a null pointer) if no layer with this ID exists 309 // on this display 310 std::shared_ptr<HWC2::Layer> getLayerById(hal::HWLayerId id) const; 311 312 friend android::TestableSurfaceFlinger; 313 314 // Member variables 315 316 // These are references to data owned by HWComposer, which will outlive 317 // this HWC2::Display, so these references are guaranteed to be valid for 318 // the lifetime of this object. 319 android::Hwc2::Composer& mComposer; 320 const std::unordered_set<aidl::android::hardware::graphics::composer3::Capability>& 321 mCapabilities; 322 323 const hal::HWDisplayId mId; 324 hal::DisplayType mType; 325 // Cached on first call to getConnectionType. 326 mutable std::optional<ftl::Expected<ui::DisplayConnectionType, hal::Error>> mConnectionType; 327 bool mIsConnected = false; 328 329 using Layers = std::unordered_map<hal::HWLayerId, std::weak_ptr<HWC2::impl::Layer>>; 330 Layers mLayers; 331 332 mutable std::mutex mDisplayCapabilitiesMutex; 333 std::once_flag mDisplayCapabilityQueryFlag; 334 std::optional< 335 std::unordered_set<aidl::android::hardware::graphics::composer3::DisplayCapability>> 336 mDisplayCapabilities GUARDED_BY(mDisplayCapabilitiesMutex); 337 // Physical size in mm. 338 std::optional<ui::Size> mPhysicalSize; 339 }; 340 341 } // namespace impl 342 343 class Layer { 344 public: 345 virtual ~Layer(); 346 347 virtual hal::HWLayerId getId() const = 0; 348 349 [[nodiscard]] virtual hal::Error setCursorPosition(int32_t x, int32_t y) = 0; 350 [[nodiscard]] virtual hal::Error setBuffer(uint32_t slot, 351 const android::sp<android::GraphicBuffer>& buffer, 352 const android::sp<android::Fence>& acquireFence) = 0; 353 [[nodiscard]] virtual hal::Error setBufferSlotsToClear( 354 const std::vector<uint32_t>& slotsToClear, uint32_t activeBufferSlot) = 0; 355 [[nodiscard]] virtual hal::Error setSurfaceDamage(const android::Region& damage) = 0; 356 357 [[nodiscard]] virtual hal::Error setBlendMode(hal::BlendMode mode) = 0; 358 [[nodiscard]] virtual hal::Error setColor( 359 aidl::android::hardware::graphics::composer3::Color color) = 0; 360 [[nodiscard]] virtual hal::Error setCompositionType( 361 aidl::android::hardware::graphics::composer3::Composition type) = 0; 362 [[nodiscard]] virtual hal::Error setDataspace(hal::Dataspace dataspace) = 0; 363 [[nodiscard]] virtual hal::Error setPerFrameMetadata(const int32_t supportedPerFrameMetadata, 364 const android::HdrMetadata& metadata) = 0; 365 [[nodiscard]] virtual hal::Error setDisplayFrame(const android::Rect& frame) = 0; 366 [[nodiscard]] virtual hal::Error setPlaneAlpha(float alpha) = 0; 367 [[nodiscard]] virtual hal::Error setSidebandStream(const native_handle_t* stream) = 0; 368 [[nodiscard]] virtual hal::Error setSourceCrop(const android::FloatRect& crop) = 0; 369 [[nodiscard]] virtual hal::Error setTransform(hal::Transform transform) = 0; 370 [[nodiscard]] virtual hal::Error setVisibleRegion(const android::Region& region) = 0; 371 [[nodiscard]] virtual hal::Error setZOrder(uint32_t z) = 0; 372 373 // Composer HAL 2.3 374 [[nodiscard]] virtual hal::Error setColorTransform(const android::mat4& matrix) = 0; 375 376 // Composer HAL 2.4 377 [[nodiscard]] virtual hal::Error setLayerGenericMetadata(const std::string& name, 378 bool mandatory, 379 const std::vector<uint8_t>& value) = 0; 380 381 // AIDL HAL 382 [[nodiscard]] virtual hal::Error setBrightness(float brightness) = 0; 383 [[nodiscard]] virtual hal::Error setBlockingRegion(const android::Region& region) = 0; 384 [[nodiscard]] virtual hal::Error setLuts( 385 aidl::android::hardware::graphics::composer3::Luts& luts) = 0; 386 [[nodiscard]] virtual hal::Error setPictureProfileHandle( 387 const PictureProfileHandle& handle) = 0; 388 }; 389 390 namespace impl { 391 392 // Convenience C++ class to access per layer functions directly. 393 394 class Layer : public HWC2::Layer { 395 public: 396 Layer(android::Hwc2::Composer& composer, 397 const std::unordered_set<aidl::android::hardware::graphics::composer3::Capability>& 398 capabilities, 399 HWC2::Display& display, hal::HWLayerId layerId); 400 ~Layer() override; 401 402 void onOwningDisplayDestroyed(); 403 getId()404 hal::HWLayerId getId() const override { return mId; } 405 406 hal::Error setCursorPosition(int32_t x, int32_t y) override; 407 hal::Error setBuffer(uint32_t slot, const android::sp<android::GraphicBuffer>& buffer, 408 const android::sp<android::Fence>& acquireFence) override; 409 hal::Error setBufferSlotsToClear(const std::vector<uint32_t>& slotsToClear, 410 uint32_t activeBufferSlot) override; 411 hal::Error setSurfaceDamage(const android::Region& damage) override; 412 413 hal::Error setBlendMode(hal::BlendMode mode) override; 414 hal::Error setColor(aidl::android::hardware::graphics::composer3::Color color) override; 415 hal::Error setCompositionType( 416 aidl::android::hardware::graphics::composer3::Composition type) override; 417 hal::Error setDataspace(hal::Dataspace dataspace) override; 418 hal::Error setPerFrameMetadata(const int32_t supportedPerFrameMetadata, 419 const android::HdrMetadata& metadata) override; 420 hal::Error setDisplayFrame(const android::Rect& frame) override; 421 hal::Error setPlaneAlpha(float alpha) override; 422 hal::Error setSidebandStream(const native_handle_t* stream) override; 423 hal::Error setSourceCrop(const android::FloatRect& crop) override; 424 hal::Error setTransform(hal::Transform transform) override; 425 hal::Error setVisibleRegion(const android::Region& region) override; 426 hal::Error setZOrder(uint32_t z) override; 427 428 // Composer HAL 2.3 429 hal::Error setColorTransform(const android::mat4& matrix) override; 430 431 // Composer HAL 2.4 432 hal::Error setLayerGenericMetadata(const std::string& name, bool mandatory, 433 const std::vector<uint8_t>& value) override; 434 435 // AIDL HAL 436 hal::Error setBrightness(float brightness) override; 437 hal::Error setBlockingRegion(const android::Region& region) override; 438 hal::Error setLuts(aidl::android::hardware::graphics::composer3::Luts&) override; 439 hal::Error setPictureProfileHandle(const PictureProfileHandle& handle) override; 440 441 private: 442 // These are references to data owned by HWComposer, which will outlive 443 // this HWC2::Layer, so these references are guaranteed to be valid for 444 // the lifetime of this object. 445 android::Hwc2::Composer& mComposer; 446 const std::unordered_set<aidl::android::hardware::graphics::composer3::Capability>& 447 mCapabilities; 448 449 HWC2::Display* mDisplay; 450 hal::HWLayerId mId; 451 452 // Cached HWC2 data, to ensure the same commands aren't sent to the HWC 453 // multiple times. 454 android::Region mVisibleRegion = android::Region::INVALID_REGION; 455 android::Region mDamageRegion = android::Region::INVALID_REGION; 456 android::Region mBlockingRegion = android::Region::INVALID_REGION; 457 hal::Dataspace mDataSpace = hal::Dataspace::UNKNOWN; 458 android::HdrMetadata mHdrMetadata; 459 android::mat4 mColorMatrix; 460 uint32_t mBufferSlot; 461 android::PictureProfileHandle profile; 462 }; 463 464 } // namespace impl 465 } // namespace HWC2 466 } // namespace android 467