1 /* 2 * Copyright (C) 2010 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 <cstdint> 20 #include <memory> 21 #include <mutex> 22 #include <optional> 23 #include <unordered_map> 24 #include <unordered_set> 25 #include <vector> 26 27 #include <android-base/thread_annotations.h> 28 #include <ftl/future.h> 29 #include <ui/DisplayIdentification.h> 30 #include <ui/FenceTime.h> 31 32 // TODO(b/129481165): remove the #pragma below and fix conversion issues 33 #pragma clang diagnostic push 34 #pragma clang diagnostic ignored "-Wconversion" 35 #pragma clang diagnostic ignored "-Wextra" 36 #include <ui/GraphicTypes.h> 37 #pragma clang diagnostic pop // ignored "-Wconversion -Wextra" 38 39 #include <utils/StrongPointer.h> 40 #include <utils/Timers.h> 41 42 #include "DisplayMode.h" 43 #include "HWC2.h" 44 #include "Hal.h" 45 46 #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> 47 #include <aidl/android/hardware/graphics/common/Hdr.h> 48 #include <aidl/android/hardware/graphics/common/HdrConversionCapability.h> 49 #include <aidl/android/hardware/graphics/common/HdrConversionStrategy.h> 50 #include <aidl/android/hardware/graphics/composer3/Capability.h> 51 #include <aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.h> 52 #include <aidl/android/hardware/graphics/composer3/Composition.h> 53 #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> 54 #include <aidl/android/hardware/graphics/composer3/OverlayProperties.h> 55 56 namespace android { 57 58 namespace hal = hardware::graphics::composer::hal; 59 60 struct DisplayedFrameStats; 61 class GraphicBuffer; 62 class TestableSurfaceFlinger; 63 struct CompositionInfo; 64 65 namespace Hwc2 { 66 class Composer; 67 } // namespace Hwc2 68 69 namespace compositionengine { 70 class Output; 71 } // namespace compositionengine 72 73 struct KnownHWCGenericLayerMetadata { 74 const char* name; 75 const uint32_t id; 76 }; 77 78 // See the comment for SurfaceFlinger::getHwComposer for the thread safety rules for accessing 79 // this class. 80 class HWComposer { 81 public: 82 struct DeviceRequestedChanges { 83 using ChangedTypes = 84 std::unordered_map<HWC2::Layer*, 85 aidl::android::hardware::graphics::composer3::Composition>; 86 using ClientTargetProperty = 87 aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness; 88 using DisplayRequests = hal::DisplayRequest; 89 using LayerRequests = std::unordered_map<HWC2::Layer*, hal::LayerRequest>; 90 91 ChangedTypes changedTypes; 92 DisplayRequests displayRequests; 93 LayerRequests layerRequests; 94 ClientTargetProperty clientTargetProperty; 95 }; 96 97 struct HWCDisplayMode { 98 hal::HWConfigId hwcId; 99 int32_t width = -1; 100 int32_t height = -1; 101 nsecs_t vsyncPeriod = -1; 102 int32_t dpiX = -1; 103 int32_t dpiY = -1; 104 int32_t configGroup = -1; 105 106 friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) { 107 return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height 108 << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x" 109 << mode.dpiY << " group=" << mode.configGroup; 110 } 111 }; 112 113 virtual ~HWComposer(); 114 115 virtual void setCallback(HWC2::ComposerCallback&) = 0; 116 117 virtual bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort, 118 DisplayIdentificationData* outData) const = 0; 119 120 virtual bool hasCapability(aidl::android::hardware::graphics::composer3::Capability) const = 0; 121 virtual bool hasDisplayCapability( 122 HalDisplayId, 123 aidl::android::hardware::graphics::composer3::DisplayCapability) const = 0; 124 125 virtual size_t getMaxVirtualDisplayCount() const = 0; 126 virtual size_t getMaxVirtualDisplayDimension() const = 0; 127 128 // Attempts to allocate a virtual display on the HWC. The maximum number of virtual displays 129 // supported by the HWC can be queried in advance, but allocation may fail for other reasons. 130 virtual bool allocateVirtualDisplay(HalVirtualDisplayId, ui::Size, ui::PixelFormat*) = 0; 131 132 virtual void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) = 0; 133 134 // Attempts to create a new layer on this display 135 virtual std::shared_ptr<HWC2::Layer> createLayer(HalDisplayId) = 0; 136 137 // Gets any required composition change requests from the HWC device. 138 // 139 // Note that frameUsesClientComposition must be set correctly based on 140 // whether the current frame appears to use client composition. If it is 141 // false some internal optimizations are allowed to present the display 142 // with fewer handshakes, but this does not work if client composition is 143 // expected. 144 virtual status_t getDeviceCompositionChanges( 145 HalDisplayId, bool frameUsesClientComposition, 146 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime, 147 nsecs_t expectedPresentTime, std::optional<DeviceRequestedChanges>* outChanges) = 0; 148 149 virtual status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence, 150 const sp<GraphicBuffer>& target, ui::Dataspace) = 0; 151 152 // Present layers to the display and read releaseFences. 153 virtual status_t presentAndGetReleaseFences( 154 HalDisplayId, 155 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime) = 0; 156 157 // set power mode 158 virtual status_t setPowerMode(PhysicalDisplayId, hal::PowerMode) = 0; 159 160 // Sets a color transform to be applied to the result of composition 161 virtual status_t setColorTransform(HalDisplayId, const mat4& transform) = 0; 162 163 // reset state when a display is disconnected 164 virtual void disconnectDisplay(HalDisplayId) = 0; 165 166 // Get the present fence/timestamp received from the last call to present. 167 virtual sp<Fence> getPresentFence(HalDisplayId) const = 0; 168 virtual nsecs_t getPresentTimestamp(PhysicalDisplayId) const = 0; 169 170 // Get last release fence for the given layer 171 virtual sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const = 0; 172 173 // Set the output buffer and acquire fence for a virtual display. 174 virtual status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence, 175 const sp<GraphicBuffer>& buffer) = 0; 176 177 // After SurfaceFlinger has retrieved the release fences for all the frames, 178 // it can call this to clear the shared pointers in the release fence map 179 virtual void clearReleaseFences(HalDisplayId) = 0; 180 181 // Fetches the HDR capabilities of the given display 182 virtual status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) = 0; 183 184 virtual const aidl::android::hardware::graphics::composer3::OverlayProperties& 185 getOverlaySupport() const = 0; 186 187 virtual int32_t getSupportedPerFrameMetadata(HalDisplayId) const = 0; 188 189 // Returns the available RenderIntent of the given display. 190 virtual std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const = 0; 191 192 virtual mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) = 0; 193 194 // Returns the attributes of the color sampling engine. 195 virtual status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat, 196 ui::Dataspace* outDataspace, 197 uint8_t* outComponentMask) = 0; 198 virtual status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled, 199 uint8_t componentMask, 200 uint64_t maxFrames) = 0; 201 virtual status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp, 202 DisplayedFrameStats* outStats) = 0; 203 204 // Sets the brightness of a display. 205 virtual ftl::Future<status_t> setDisplayBrightness( 206 PhysicalDisplayId, float brightness, float brightnessNits, 207 const Hwc2::Composer::DisplayBrightnessOptions&) = 0; 208 209 // Get whether the display skipped validation on the latest present 210 virtual bool getValidateSkipped(HalDisplayId displayId) const = 0; 211 212 // Events handling --------------------------------------------------------- 213 214 // Returns stable display ID (and display name on connection of new or previously disconnected 215 // display), or std::nullopt if hotplug event was ignored. 216 // This function is called from SurfaceFlinger. 217 virtual std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, 218 hal::Connection) = 0; 219 220 // If true we'll update the DeviceProductInfo on subsequent hotplug connected events. 221 // TODO(b/157555476): Remove when the framework has proper support for headless mode 222 virtual bool updatesDeviceProductInfoOnHotplugReconnect() const = 0; 223 224 // Called when a vsync happens. If the vsync is valid, returns the 225 // corresponding PhysicalDisplayId. Otherwise returns nullopt. 226 virtual std::optional<PhysicalDisplayId> onVsync(hal::HWDisplayId, nsecs_t timestamp) = 0; 227 228 virtual void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) = 0; 229 230 virtual bool isConnected(PhysicalDisplayId) const = 0; 231 232 virtual std::vector<HWCDisplayMode> getModes(PhysicalDisplayId) const = 0; 233 234 virtual std::optional<hal::HWConfigId> getActiveMode(PhysicalDisplayId) const = 0; 235 236 virtual std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const = 0; 237 238 virtual status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode mode, 239 ui::RenderIntent) = 0; 240 241 // Composer 2.4 242 virtual ui::DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const = 0; 243 virtual bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const = 0; 244 virtual status_t getDisplayVsyncPeriod(PhysicalDisplayId displayId, 245 nsecs_t* outVsyncPeriod) const = 0; 246 virtual status_t setActiveModeWithConstraints(PhysicalDisplayId, hal::HWConfigId, 247 const hal::VsyncPeriodChangeConstraints&, 248 hal::VsyncPeriodChangeTimeline* outTimeline) = 0; 249 virtual status_t setAutoLowLatencyMode(PhysicalDisplayId, bool on) = 0; 250 virtual status_t getSupportedContentTypes( 251 PhysicalDisplayId, std::vector<hal::ContentType>* outSupportedContentTypes) const = 0; 252 supportsContentType(PhysicalDisplayId displayId,hal::ContentType type)253 bool supportsContentType(PhysicalDisplayId displayId, hal::ContentType type) const { 254 std::vector<hal::ContentType> types; 255 return getSupportedContentTypes(displayId, &types) == NO_ERROR && 256 std::find(types.begin(), types.end(), type) != types.end(); 257 } 258 259 virtual status_t setContentType(PhysicalDisplayId, hal::ContentType) = 0; 260 261 virtual const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata() 262 const = 0; 263 264 virtual void dump(std::string& out) const = 0; 265 266 virtual Hwc2::Composer* getComposer() const = 0; 267 268 // Returns the first display connected at boot. Its connection via HWComposer::onHotplug, 269 // which in practice is immediately after HWComposer construction, must occur before any 270 // call to this function. 271 // The primary display can be temporarily disconnected from the perspective 272 // of this class. Callers must not call getPrimaryHwcDisplayId() or getPrimaryDisplayId() 273 // if isHeadless(). 274 // 275 // TODO(b/182939859): Remove special cases for primary display. 276 virtual hal::HWDisplayId getPrimaryHwcDisplayId() const = 0; 277 virtual PhysicalDisplayId getPrimaryDisplayId() const = 0; 278 virtual bool isHeadless() const = 0; 279 280 virtual std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const = 0; 281 virtual std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const = 0; 282 283 // Composer 3.0 284 virtual status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) = 0; 285 virtual status_t clearBootDisplayMode(PhysicalDisplayId) = 0; 286 virtual std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) = 0; 287 virtual status_t getDisplayDecorationSupport( 288 PhysicalDisplayId, 289 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>* 290 support) = 0; 291 virtual status_t setIdleTimerEnabled(PhysicalDisplayId, std::chrono::milliseconds timeout) = 0; 292 virtual bool hasDisplayIdleTimerCapability(PhysicalDisplayId) const = 0; 293 virtual Hwc2::AidlTransform getPhysicalDisplayOrientation(PhysicalDisplayId) const = 0; 294 virtual std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability> 295 getHdrConversionCapabilities() const = 0; 296 virtual status_t setHdrConversionStrategy( 297 aidl::android::hardware::graphics::common::HdrConversionStrategy, 298 aidl::android::hardware::graphics::common::Hdr*) = 0; 299 virtual status_t setRefreshRateChangedCallbackDebugEnabled(PhysicalDisplayId, bool enabled) = 0; 300 }; 301 302 static inline bool operator==(const android::HWComposer::DeviceRequestedChanges& lhs, 303 const android::HWComposer::DeviceRequestedChanges& rhs) { 304 return lhs.changedTypes == rhs.changedTypes && lhs.displayRequests == rhs.displayRequests && 305 lhs.layerRequests == rhs.layerRequests && 306 lhs.clientTargetProperty == rhs.clientTargetProperty; 307 } 308 309 namespace impl { 310 311 class HWComposer final : public android::HWComposer { 312 public: 313 explicit HWComposer(std::unique_ptr<Hwc2::Composer> composer); 314 explicit HWComposer(const std::string& composerServiceName); 315 316 ~HWComposer() override; 317 318 void setCallback(HWC2::ComposerCallback&) override; 319 320 bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort, 321 DisplayIdentificationData* outData) const override; 322 323 bool hasCapability(aidl::android::hardware::graphics::composer3::Capability) const override; 324 bool hasDisplayCapability( 325 HalDisplayId, 326 aidl::android::hardware::graphics::composer3::DisplayCapability) const override; 327 328 size_t getMaxVirtualDisplayCount() const override; 329 size_t getMaxVirtualDisplayDimension() const override; 330 331 bool allocateVirtualDisplay(HalVirtualDisplayId, ui::Size, ui::PixelFormat*) override; 332 333 // Called from SurfaceFlinger, when the state for a new physical display needs to be recreated. 334 void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) override; 335 336 // Attempts to create a new layer on this display 337 std::shared_ptr<HWC2::Layer> createLayer(HalDisplayId) override; 338 339 status_t getDeviceCompositionChanges( 340 HalDisplayId, bool frameUsesClientComposition, 341 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime, 342 nsecs_t expectedPresentTime, 343 std::optional<DeviceRequestedChanges>* outChanges) override; 344 345 status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence, 346 const sp<GraphicBuffer>& target, ui::Dataspace) override; 347 348 // Present layers to the display and read releaseFences. 349 status_t presentAndGetReleaseFences( 350 HalDisplayId, 351 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime) override; 352 353 // set power mode 354 status_t setPowerMode(PhysicalDisplayId, hal::PowerMode mode) override; 355 356 // Sets a color transform to be applied to the result of composition 357 status_t setColorTransform(HalDisplayId, const mat4& transform) override; 358 359 // reset state when a display is disconnected 360 void disconnectDisplay(HalDisplayId) override; 361 362 // Get the present fence/timestamp received from the last call to present. 363 sp<Fence> getPresentFence(HalDisplayId) const override; 364 nsecs_t getPresentTimestamp(PhysicalDisplayId) const override; 365 366 // Get last release fence for the given layer 367 sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const override; 368 369 // Set the output buffer and acquire fence for a virtual display. 370 status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence, 371 const sp<GraphicBuffer>& buffer) override; 372 373 // After SurfaceFlinger has retrieved the release fences for all the frames, 374 // it can call this to clear the shared pointers in the release fence map 375 void clearReleaseFences(HalDisplayId) override; 376 377 // Fetches the HDR capabilities of the given display 378 status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) override; 379 380 const aidl::android::hardware::graphics::composer3::OverlayProperties& getOverlaySupport() 381 const override; 382 383 int32_t getSupportedPerFrameMetadata(HalDisplayId) const override; 384 385 // Returns the available RenderIntent of the given display. 386 std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const override; 387 388 mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) override; 389 390 // Returns the attributes of the color sampling engine. 391 status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat, 392 ui::Dataspace* outDataspace, 393 uint8_t* outComponentMask) override; 394 status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled, uint8_t componentMask, 395 uint64_t maxFrames) override; 396 status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp, 397 DisplayedFrameStats* outStats) override; 398 ftl::Future<status_t> setDisplayBrightness( 399 PhysicalDisplayId, float brightness, float brightnessNits, 400 const Hwc2::Composer::DisplayBrightnessOptions&) override; 401 402 // Events handling --------------------------------------------------------- 403 404 // Returns PhysicalDisplayId (and display name on connection of new or previously disconnected 405 // display), or std::nullopt if hotplug event was ignored. 406 std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, hal::Connection) override; 407 408 bool updatesDeviceProductInfoOnHotplugReconnect() const override; 409 410 std::optional<PhysicalDisplayId> onVsync(hal::HWDisplayId, nsecs_t timestamp) override; 411 void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) override; 412 413 bool isConnected(PhysicalDisplayId) const override; 414 415 std::vector<HWCDisplayMode> getModes(PhysicalDisplayId) const override; 416 417 std::optional<hal::HWConfigId> getActiveMode(PhysicalDisplayId) const override; 418 419 std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const override; 420 421 status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode, ui::RenderIntent) override; 422 423 bool getValidateSkipped(HalDisplayId displayId) const override; 424 425 // Composer 2.4 426 ui::DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const override; 427 bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const override; 428 status_t getDisplayVsyncPeriod(PhysicalDisplayId displayId, 429 nsecs_t* outVsyncPeriod) const override; 430 status_t setActiveModeWithConstraints(PhysicalDisplayId, hal::HWConfigId, 431 const hal::VsyncPeriodChangeConstraints&, 432 hal::VsyncPeriodChangeTimeline* outTimeline) override; 433 status_t setAutoLowLatencyMode(PhysicalDisplayId, bool) override; 434 status_t getSupportedContentTypes(PhysicalDisplayId, 435 std::vector<hal::ContentType>*) const override; 436 status_t setContentType(PhysicalDisplayId, hal::ContentType) override; 437 438 const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata() const override; 439 440 // Composer 3.0 441 status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) override; 442 status_t clearBootDisplayMode(PhysicalDisplayId) override; 443 std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) override; 444 status_t getDisplayDecorationSupport( 445 PhysicalDisplayId, 446 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>* 447 support) override; 448 status_t setIdleTimerEnabled(PhysicalDisplayId, std::chrono::milliseconds timeout) override; 449 bool hasDisplayIdleTimerCapability(PhysicalDisplayId) const override; 450 Hwc2::AidlTransform getPhysicalDisplayOrientation(PhysicalDisplayId) const override; 451 std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability> 452 getHdrConversionCapabilities() const override; 453 status_t setHdrConversionStrategy( 454 aidl::android::hardware::graphics::common::HdrConversionStrategy, 455 aidl::android::hardware::graphics::common::Hdr*) override; 456 status_t setRefreshRateChangedCallbackDebugEnabled(PhysicalDisplayId, bool enabled) override; 457 458 // for debugging ---------------------------------------------------------- 459 void dump(std::string& out) const override; 460 getComposer()461 Hwc2::Composer* getComposer() const override { return mComposer.get(); } 462 getPrimaryHwcDisplayId()463 hal::HWDisplayId getPrimaryHwcDisplayId() const override { 464 LOG_ALWAYS_FATAL_IF(!mPrimaryHwcDisplayId, "Missing HWC primary display"); 465 return *mPrimaryHwcDisplayId; 466 } 467 getPrimaryDisplayId()468 PhysicalDisplayId getPrimaryDisplayId() const override { 469 const auto id = toPhysicalDisplayId(getPrimaryHwcDisplayId()); 470 LOG_ALWAYS_FATAL_IF(!id, "Missing primary display"); 471 return *id; 472 } 473 isHeadless()474 virtual bool isHeadless() const override { return !mPrimaryHwcDisplayId; } 475 476 std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const override; 477 std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const override; 478 479 private: 480 // For unit tests 481 friend TestableSurfaceFlinger; 482 483 struct DisplayData { 484 std::unique_ptr<HWC2::Display> hwcDisplay; 485 486 sp<Fence> lastPresentFence = Fence::NO_FENCE; // signals when the last set op retires 487 nsecs_t lastPresentTimestamp = 0; 488 489 std::unordered_map<HWC2::Layer*, sp<Fence>> releaseFences; 490 491 bool validateWasSkipped; 492 hal::Error presentError; 493 494 bool vsyncTraceToggle = false; 495 496 std::mutex vsyncEnabledLock; 497 hal::Vsync vsyncEnabled GUARDED_BY(vsyncEnabledLock) = hal::Vsync::DISABLE; 498 }; 499 500 std::optional<DisplayIdentificationInfo> onHotplugConnect(hal::HWDisplayId); 501 std::optional<DisplayIdentificationInfo> onHotplugDisconnect(hal::HWDisplayId); 502 bool shouldIgnoreHotplugConnect(hal::HWDisplayId, bool hasDisplayIdentificationData) const; 503 504 int32_t getAttribute(hal::HWDisplayId hwcDisplayId, hal::HWConfigId configId, 505 hal::Attribute attribute) const; 506 507 void loadCapabilities(); 508 void loadLayerMetadataSupport(); 509 void loadOverlayProperties(); 510 void loadHdrConversionCapabilities(); 511 512 std::unordered_map<HalDisplayId, DisplayData> mDisplayData; 513 514 std::unique_ptr<android::Hwc2::Composer> mComposer; 515 std::unordered_set<aidl::android::hardware::graphics::composer3::Capability> mCapabilities; 516 aidl::android::hardware::graphics::composer3::OverlayProperties mOverlayProperties; 517 std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability> 518 mHdrConversionCapabilities = {}; 519 520 std::unordered_map<std::string, bool> mSupportedLayerGenericMetadata; 521 bool mRegisteredCallback = false; 522 523 std::unordered_map<hal::HWDisplayId, PhysicalDisplayId> mPhysicalDisplayIdMap; 524 std::optional<hal::HWDisplayId> mPrimaryHwcDisplayId; 525 bool mHasMultiDisplaySupport = false; 526 527 const size_t mMaxVirtualDisplayDimension; 528 const bool mUpdateDeviceProductInfoOnHotplugReconnect; 529 }; 530 531 } // namespace impl 532 } // namespace android 533