blob: 51e93197a8cd704f6466fe44356d81a6bb787139 [file] [log] [blame]
Mathias Agopiana350ff92010-08-10 17:14:02 -07001/*
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
Dominik Laskowskif8db0f02021-04-19 11:05:25 -070017#pragma once
Mathias Agopiana350ff92010-08-10 17:14:02 -070018
Dominik Laskowski1af47932018-11-12 10:20:46 -080019#include <cstdint>
Dan Stoza9e56aa02015-11-02 13:00:03 -080020#include <memory>
Dominik Laskowski1af47932018-11-12 10:20:46 -080021#include <mutex>
Steven Thomas6e8f7062017-11-22 14:15:29 -080022#include <optional>
Dominik Laskowski075d3172018-05-24 15:50:06 -070023#include <unordered_map>
24#include <unordered_set>
Dan Stoza9e56aa02015-11-02 13:00:03 -080025#include <vector>
26
Dominik Laskowski1af47932018-11-12 10:20:46 -080027#include <android-base/thread_annotations.h>
Dominik Laskowskib17c6212022-05-09 09:36:19 -070028#include <ftl/future.h>
Alec Mouriff793872022-01-13 17:45:06 -080029#include <ui/DisplayIdentification.h>
Ady Abrahamec7aa8a2021-06-28 12:37:09 -070030#include <ui/FenceTime.h>
Ady Abraham8a82ba62020-01-17 12:43:17 -080031
32// TODO(b/129481165): remove the #pragma below and fix conversion issues
33#pragma clang diagnostic push
34#pragma clang diagnostic ignored "-Wconversion"
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010035#pragma clang diagnostic ignored "-Wextra"
Dominik Laskowski1af47932018-11-12 10:20:46 -080036#include <ui/GraphicTypes.h>
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010037#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
Ady Abraham8a82ba62020-01-17 12:43:17 -080038
Dominik Laskowski1af47932018-11-12 10:20:46 -080039#include <utils/StrongPointer.h>
40#include <utils/Timers.h>
41
Marin Shalamanov3ea1d602020-12-16 19:59:39 +010042#include "DisplayMode.h"
Dominik Laskowski1af47932018-11-12 10:20:46 -080043#include "HWC2.h"
Peiyong Line9d809e2020-04-14 13:10:48 -070044#include "Hal.h"
Dan Stoza9e56aa02015-11-02 13:00:03 -080045
Leon Scroggins IIIe7c51c62022-02-01 15:53:54 -050046#include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h>
Kriti Dangd432bb52023-02-09 18:21:04 +010047#include <aidl/android/hardware/graphics/common/Hdr.h>
Kriti Dang674b9372022-11-18 10:58:44 +010048#include <aidl/android/hardware/graphics/common/HdrConversionCapability.h>
49#include <aidl/android/hardware/graphics/common/HdrConversionStrategy.h>
Ady Abrahamde549d42022-01-26 19:19:17 -080050#include <aidl/android/hardware/graphics/composer3/Capability.h>
Alec Mouri85065692022-03-18 00:58:26 +000051#include <aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.h>
Leon Scroggins III2e1aa182021-12-01 17:33:12 -050052#include <aidl/android/hardware/graphics/composer3/Composition.h>
Leon Scroggins III5967aec2021-12-29 11:14:22 -050053#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
Sally Qi0cbd08b2022-08-17 12:12:28 -070054#include <aidl/android/hardware/graphics/composer3/OverlayProperties.h>
Leon Scroggins III2e1aa182021-12-01 17:33:12 -050055
Mathias Agopiana350ff92010-08-10 17:14:02 -070056namespace android {
Mathias Agopiana350ff92010-08-10 17:14:02 -070057
Peiyong Line9d809e2020-04-14 13:10:48 -070058namespace hal = hardware::graphics::composer::hal;
59
Kevin DuBois1d4249a2018-08-29 10:45:14 -070060struct DisplayedFrameStats;
Jesse Hall399184a2014-03-03 15:42:54 -080061class GraphicBuffer;
Lloyd Piquee39cad22017-12-20 17:01:29 -080062class TestableSurfaceFlinger;
ramindanib90711b2023-10-02 15:13:19 -070063struct HWComposerTest;
David Sodmanfb95bcc2017-12-22 15:45:30 -080064struct CompositionInfo;
Mathias Agopian83727852010-09-23 18:13:21 -070065
Lloyd Piquea822d522017-12-20 16:42:57 -080066namespace Hwc2 {
67class Composer;
68} // namespace Hwc2
69
Lloyd Pique37c2c9b2018-12-04 17:25:10 -080070namespace compositionengine {
71class Output;
72} // namespace compositionengine
73
Lloyd Pique4603f3c2020-02-11 12:06:56 -080074struct KnownHWCGenericLayerMetadata {
75 const char* name;
76 const uint32_t id;
77};
78
Marin Shalamanov1c434292020-06-12 01:47:29 +020079// See the comment for SurfaceFlinger::getHwComposer for the thread safety rules for accessing
80// this class.
Lloyd Pique441d5042018-10-18 16:49:51 -070081class HWComposer {
82public:
Peiyong Lindfc3f7c2020-05-07 20:15:50 -070083 struct DeviceRequestedChanges {
Leon Scroggins III2e1aa182021-12-01 17:33:12 -050084 using ChangedTypes =
85 std::unordered_map<HWC2::Layer*,
86 aidl::android::hardware::graphics::composer3::Composition>;
Alec Mouri85065692022-03-18 00:58:26 +000087 using ClientTargetProperty =
88 aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness;
Peiyong Lindfc3f7c2020-05-07 20:15:50 -070089 using DisplayRequests = hal::DisplayRequest;
90 using LayerRequests = std::unordered_map<HWC2::Layer*, hal::LayerRequest>;
91
92 ChangedTypes changedTypes;
93 DisplayRequests displayRequests;
94 LayerRequests layerRequests;
95 ClientTargetProperty clientTargetProperty;
96 };
97
Marin Shalamanov045b7002021-01-07 16:56:24 +010098 struct HWCDisplayMode {
99 hal::HWConfigId hwcId;
100 int32_t width = -1;
101 int32_t height = -1;
102 nsecs_t vsyncPeriod = -1;
ramindani0cd1d8d2023-06-13 13:43:23 -0700103 float dpiX = -1.f;
104 float dpiY = -1.f;
Marin Shalamanov045b7002021-01-07 16:56:24 +0100105 int32_t configGroup = -1;
ramindania04b8a52023-08-07 18:49:47 -0700106 std::optional<hal::VrrConfig> vrrConfig;
Marin Shalamanovd3b5c5d2021-02-11 18:26:14 +0100107
108 friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) {
109 return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height
110 << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x"
ramindania04b8a52023-08-07 18:49:47 -0700111 << mode.dpiY << " group=" << mode.configGroup
112 << " vrrConfig=" << to_string(mode.vrrConfig).c_str();
Marin Shalamanovd3b5c5d2021-02-11 18:26:14 +0100113 }
Marin Shalamanov045b7002021-01-07 16:56:24 +0100114 };
115
Lloyd Pique441d5042018-10-18 16:49:51 -0700116 virtual ~HWComposer();
117
Yichi Chen3401b562022-01-17 15:42:35 +0800118 virtual void setCallback(HWC2::ComposerCallback&) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700119
Marin Shalamanova524a092020-07-27 21:39:55 +0200120 virtual bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort,
Lloyd Pique441d5042018-10-18 16:49:51 -0700121 DisplayIdentificationData* outData) const = 0;
122
Ady Abrahamde549d42022-01-26 19:19:17 -0800123 virtual bool hasCapability(aidl::android::hardware::graphics::composer3::Capability) const = 0;
Leon Scroggins III5967aec2021-12-29 11:14:22 -0500124 virtual bool hasDisplayCapability(
125 HalDisplayId,
126 aidl::android::hardware::graphics::composer3::DisplayCapability) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700127
Dominik Laskowski13948602021-03-08 20:48:28 -0800128 virtual size_t getMaxVirtualDisplayCount() const = 0;
129 virtual size_t getMaxVirtualDisplayDimension() const = 0;
130
131 // Attempts to allocate a virtual display on the HWC. The maximum number of virtual displays
132 // supported by the HWC can be queried in advance, but allocation may fail for other reasons.
Dominik Laskowski263eec42021-07-21 23:13:24 -0700133 virtual bool allocateVirtualDisplay(HalVirtualDisplayId, ui::Size, ui::PixelFormat*) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700134
Marin Shalamanova524a092020-07-27 21:39:55 +0200135 virtual void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) = 0;
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100136
Lloyd Pique441d5042018-10-18 16:49:51 -0700137 // Attempts to create a new layer on this display
Lloyd Pique1b33fc32021-05-07 14:36:58 -0700138 virtual std::shared_ptr<HWC2::Layer> createLayer(HalDisplayId) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700139
Lloyd Pique66d68602019-02-13 14:23:31 -0800140 // Gets any required composition change requests from the HWC device.
141 //
142 // Note that frameUsesClientComposition must be set correctly based on
143 // whether the current frame appears to use client composition. If it is
144 // false some internal optimizations are allowed to present the display
145 // with fewer handshakes, but this does not work if client composition is
146 // expected.
147 virtual status_t getDeviceCompositionChanges(
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200148 HalDisplayId, bool frameUsesClientComposition,
Ady Abrahamf1db8032023-03-24 17:52:34 -0700149 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime,
150 nsecs_t expectedPresentTime, std::optional<DeviceRequestedChanges>* outChanges) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700151
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200152 virtual status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence,
Marin Shalamanova524a092020-07-27 21:39:55 +0200153 const sp<GraphicBuffer>& target, ui::Dataspace) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700154
155 // Present layers to the display and read releaseFences.
Ady Abrahamb42cdc12021-05-11 14:31:26 -0700156 virtual status_t presentAndGetReleaseFences(
Ady Abrahamf1db8032023-03-24 17:52:34 -0700157 HalDisplayId,
158 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700159
160 // set power mode
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200161 virtual status_t setPowerMode(PhysicalDisplayId, hal::PowerMode) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700162
Lloyd Pique441d5042018-10-18 16:49:51 -0700163 // Sets a color transform to be applied to the result of composition
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200164 virtual status_t setColorTransform(HalDisplayId, const mat4& transform) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700165
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200166 // reset state when a display is disconnected
167 virtual void disconnectDisplay(HalDisplayId) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700168
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400169 // Get the present fence/timestamp received from the last call to present.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200170 virtual sp<Fence> getPresentFence(HalDisplayId) const = 0;
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400171 virtual nsecs_t getPresentTimestamp(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700172
173 // Get last release fence for the given layer
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200174 virtual sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700175
176 // Set the output buffer and acquire fence for a virtual display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200177 virtual status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence,
Lloyd Pique441d5042018-10-18 16:49:51 -0700178 const sp<GraphicBuffer>& buffer) = 0;
179
180 // After SurfaceFlinger has retrieved the release fences for all the frames,
181 // it can call this to clear the shared pointers in the release fence map
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200182 virtual void clearReleaseFences(HalDisplayId) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700183
184 // Fetches the HDR capabilities of the given display
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200185 virtual status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700186
Sally Qibb866c12022-10-17 11:31:20 -0700187 virtual const aidl::android::hardware::graphics::composer3::OverlayProperties&
188 getOverlaySupport() const = 0;
Sally Qi0cbd08b2022-08-17 12:12:28 -0700189
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200190 virtual int32_t getSupportedPerFrameMetadata(HalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700191
192 // Returns the available RenderIntent of the given display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200193 virtual std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700194
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200195 virtual mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700196
197 // Returns the attributes of the color sampling engine.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200198 virtual status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat,
Lloyd Pique441d5042018-10-18 16:49:51 -0700199 ui::Dataspace* outDataspace,
200 uint8_t* outComponentMask) = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200201 virtual status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled,
Lloyd Pique441d5042018-10-18 16:49:51 -0700202 uint8_t componentMask,
203 uint64_t maxFrames) = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200204 virtual status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp,
Lloyd Pique441d5042018-10-18 16:49:51 -0700205 DisplayedFrameStats* outStats) = 0;
206
Dan Gittik57e63c52019-01-18 16:37:54 +0000207 // Sets the brightness of a display.
Dominik Laskowskib17c6212022-05-09 09:36:19 -0700208 virtual ftl::Future<status_t> setDisplayBrightness(
Alec Mouri4d8a05d2022-03-23 18:14:26 +0000209 PhysicalDisplayId, float brightness, float brightnessNits,
Alec Mouricdf16792021-12-10 13:16:06 -0800210 const Hwc2::Composer::DisplayBrightnessOptions&) = 0;
Dan Gittik57e63c52019-01-18 16:37:54 +0000211
Matt Buckley50c44062022-01-17 20:48:10 +0000212 // Get whether the display skipped validation on the latest present
213 virtual bool getValidateSkipped(HalDisplayId displayId) const = 0;
214
Lloyd Pique441d5042018-10-18 16:49:51 -0700215 // Events handling ---------------------------------------------------------
216
217 // Returns stable display ID (and display name on connection of new or previously disconnected
218 // display), or std::nullopt if hotplug event was ignored.
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100219 // This function is called from SurfaceFlinger.
Marin Shalamanova524a092020-07-27 21:39:55 +0200220 virtual std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId,
221 hal::Connection) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700222
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200223 // If true we'll update the DeviceProductInfo on subsequent hotplug connected events.
224 // TODO(b/157555476): Remove when the framework has proper support for headless mode
225 virtual bool updatesDeviceProductInfoOnHotplugReconnect() const = 0;
226
Leon Scroggins III959a7ff2023-02-07 11:24:25 -0500227 // Called when a vsync happens. If the vsync is valid, returns the
228 // corresponding PhysicalDisplayId. Otherwise returns nullopt.
229 virtual std::optional<PhysicalDisplayId> onVsync(hal::HWDisplayId, nsecs_t timestamp) = 0;
230
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200231 virtual void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700232
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200233 virtual bool isConnected(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700234
ramindani263a3f12023-07-18 20:44:49 -0700235 virtual std::vector<HWCDisplayMode> getModes(PhysicalDisplayId,
236 int32_t maxFrameIntervalNs) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700237
Marin Shalamanov045b7002021-01-07 16:56:24 +0100238 virtual std::optional<hal::HWConfigId> getActiveMode(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700239
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200240 virtual std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700241
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200242 virtual status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode mode,
243 ui::RenderIntent) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700244
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800245 // Composer 2.4
Marin Shalamanov228f46b2021-01-28 21:11:45 +0100246 virtual ui::DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200247 virtual bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const = 0;
Marin Shalamanov045b7002021-01-07 16:56:24 +0100248 virtual status_t getDisplayVsyncPeriod(PhysicalDisplayId displayId,
249 nsecs_t* outVsyncPeriod) const = 0;
Marin Shalamanov12c9e5a2021-01-07 00:25:35 +0100250 virtual status_t setActiveModeWithConstraints(PhysicalDisplayId, hal::HWConfigId,
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100251 const hal::VsyncPeriodChangeConstraints&,
252 hal::VsyncPeriodChangeTimeline* outTimeline) = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200253 virtual status_t setAutoLowLatencyMode(PhysicalDisplayId, bool on) = 0;
Galia Peycheva5492cb52019-10-30 14:13:16 +0100254 virtual status_t getSupportedContentTypes(
Dominik Laskowski6c7b36e2022-03-03 08:27:58 -0800255 PhysicalDisplayId, std::vector<hal::ContentType>* outSupportedContentTypes) const = 0;
256
257 bool supportsContentType(PhysicalDisplayId displayId, hal::ContentType type) const {
258 std::vector<hal::ContentType> types;
259 return getSupportedContentTypes(displayId, &types) == NO_ERROR &&
260 std::find(types.begin(), types.end(), type) != types.end();
261 }
262
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200263 virtual status_t setContentType(PhysicalDisplayId, hal::ContentType) = 0;
Dominik Laskowski6c7b36e2022-03-03 08:27:58 -0800264
Lloyd Pique4603f3c2020-02-11 12:06:56 -0800265 virtual const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata()
266 const = 0;
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800267
Lloyd Pique441d5042018-10-18 16:49:51 -0700268 virtual void dump(std::string& out) const = 0;
269
270 virtual Hwc2::Composer* getComposer() const = 0;
271
Marin Shalamanov8b196592021-08-09 16:24:42 +0200272 // Returns the first display connected at boot. Its connection via HWComposer::onHotplug,
273 // which in practice is immediately after HWComposer construction, must occur before any
274 // call to this function.
275 // The primary display can be temporarily disconnected from the perspective
276 // of this class. Callers must not call getPrimaryHwcDisplayId() or getPrimaryDisplayId()
277 // if isHeadless().
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700278 //
279 // TODO(b/182939859): Remove special cases for primary display.
280 virtual hal::HWDisplayId getPrimaryHwcDisplayId() const = 0;
281 virtual PhysicalDisplayId getPrimaryDisplayId() const = 0;
282 virtual bool isHeadless() const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700283
Marin Shalamanova524a092020-07-27 21:39:55 +0200284 virtual std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const = 0;
285 virtual std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const = 0;
Kriti Dang7defaf32021-11-15 11:55:43 +0100286
287 // Composer 3.0
Kriti Dang7defaf32021-11-15 11:55:43 +0100288 virtual status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) = 0;
289 virtual status_t clearBootDisplayMode(PhysicalDisplayId) = 0;
Kriti Dang16ca2972022-02-01 20:07:03 +0100290 virtual std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) = 0;
Leon Scroggins IIIe7c51c62022-02-01 15:53:54 -0500291 virtual status_t getDisplayDecorationSupport(
292 PhysicalDisplayId,
293 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
294 support) = 0;
ramindani32cf0602022-03-02 02:30:29 +0000295 virtual status_t setIdleTimerEnabled(PhysicalDisplayId, std::chrono::milliseconds timeout) = 0;
ramindani06e518e2022-03-14 18:47:53 +0000296 virtual bool hasDisplayIdleTimerCapability(PhysicalDisplayId) const = 0;
297 virtual Hwc2::AidlTransform getPhysicalDisplayOrientation(PhysicalDisplayId) const = 0;
Kriti Dang674b9372022-11-18 10:58:44 +0100298 virtual std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability>
299 getHdrConversionCapabilities() const = 0;
300 virtual status_t setHdrConversionStrategy(
Kriti Dangd432bb52023-02-09 18:21:04 +0100301 aidl::android::hardware::graphics::common::HdrConversionStrategy,
302 aidl::android::hardware::graphics::common::Hdr*) = 0;
ramindanib2158ee2023-02-13 20:29:59 -0800303 virtual status_t setRefreshRateChangedCallbackDebugEnabled(PhysicalDisplayId, bool enabled) = 0;
ramindanif8c0f102023-10-09 12:42:57 -0700304 virtual status_t notifyExpectedPresentIfRequired(PhysicalDisplayId, Period vsyncPeriod,
305 TimePoint expectedPresentTime,
306 Fps frameInterval,
307 std::optional<Period> timeoutOpt) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700308};
309
Vishnu Naira3140382022-02-24 14:07:11 -0800310static inline bool operator==(const android::HWComposer::DeviceRequestedChanges& lhs,
311 const android::HWComposer::DeviceRequestedChanges& rhs) {
312 return lhs.changedTypes == rhs.changedTypes && lhs.displayRequests == rhs.displayRequests &&
313 lhs.layerRequests == rhs.layerRequests &&
314 lhs.clientTargetProperty == rhs.clientTargetProperty;
315}
316
Lloyd Pique441d5042018-10-18 16:49:51 -0700317namespace impl {
318
319class HWComposer final : public android::HWComposer {
Mathias Agopiana350ff92010-08-10 17:14:02 -0700320public:
Dominik Laskowski1af47932018-11-12 10:20:46 -0800321 explicit HWComposer(std::unique_ptr<Hwc2::Composer> composer);
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800322 explicit HWComposer(const std::string& composerServiceName);
Mathias Agopian8b736f12012-08-13 17:54:26 -0700323
Lloyd Pique441d5042018-10-18 16:49:51 -0700324 ~HWComposer() override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700325
Yichi Chen3401b562022-01-17 15:42:35 +0800326 void setCallback(HWC2::ComposerCallback&) override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700327
Marin Shalamanova524a092020-07-27 21:39:55 +0200328 bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort,
Lloyd Pique441d5042018-10-18 16:49:51 -0700329 DisplayIdentificationData* outData) const override;
Dominik Laskowskie9ef7c42018-03-12 19:34:30 -0700330
Ady Abrahamde549d42022-01-26 19:19:17 -0800331 bool hasCapability(aidl::android::hardware::graphics::composer3::Capability) const override;
Leon Scroggins III5967aec2021-12-29 11:14:22 -0500332 bool hasDisplayCapability(
333 HalDisplayId,
334 aidl::android::hardware::graphics::composer3::DisplayCapability) const override;
Dan Stoza9f26a9c2016-06-22 14:51:09 -0700335
Dominik Laskowski13948602021-03-08 20:48:28 -0800336 size_t getMaxVirtualDisplayCount() const override;
337 size_t getMaxVirtualDisplayDimension() const override;
338
Dominik Laskowski263eec42021-07-21 23:13:24 -0700339 bool allocateVirtualDisplay(HalVirtualDisplayId, ui::Size, ui::PixelFormat*) override;
Mathias Agopiane60b0682012-08-21 23:34:09 -0700340
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100341 // Called from SurfaceFlinger, when the state for a new physical display needs to be recreated.
Marin Shalamanova524a092020-07-27 21:39:55 +0200342 void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) override;
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100343
Dan Stoza9e56aa02015-11-02 13:00:03 -0800344 // Attempts to create a new layer on this display
Lloyd Pique1b33fc32021-05-07 14:36:58 -0700345 std::shared_ptr<HWC2::Layer> createLayer(HalDisplayId) override;
Mathias Agopiane60b0682012-08-21 23:34:09 -0700346
Lloyd Pique66d68602019-02-13 14:23:31 -0800347 status_t getDeviceCompositionChanges(
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200348 HalDisplayId, bool frameUsesClientComposition,
Ady Abrahamf1db8032023-03-24 17:52:34 -0700349 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime,
350 nsecs_t expectedPresentTime,
Lloyd Pique66d68602019-02-13 14:23:31 -0800351 std::optional<DeviceRequestedChanges>* outChanges) override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700352
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200353 status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence,
Marin Shalamanova524a092020-07-27 21:39:55 +0200354 const sp<GraphicBuffer>& target, ui::Dataspace) override;
Dan Stoza9e56aa02015-11-02 13:00:03 -0800355
Fabien Sanglarda87aa7b2016-11-30 16:27:22 -0800356 // Present layers to the display and read releaseFences.
Ady Abrahamb42cdc12021-05-11 14:31:26 -0700357 status_t presentAndGetReleaseFences(
Ady Abrahamf1db8032023-03-24 17:52:34 -0700358 HalDisplayId,
359 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime) override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700360
Prashant Malani2c9b11f2014-05-25 01:36:31 -0700361 // set power mode
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200362 status_t setPowerMode(PhysicalDisplayId, hal::PowerMode mode) override;
Colin Cross10fbdb62012-07-12 17:56:34 -0700363
Dan Stoza9f26a9c2016-06-22 14:51:09 -0700364 // Sets a color transform to be applied to the result of composition
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200365 status_t setColorTransform(HalDisplayId, const mat4& transform) override;
Dan Stoza9f26a9c2016-06-22 14:51:09 -0700366
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200367 // reset state when a display is disconnected
368 void disconnectDisplay(HalDisplayId) override;
Mathias Agopianda27af92012-09-13 18:17:13 -0700369
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400370 // Get the present fence/timestamp received from the last call to present.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200371 sp<Fence> getPresentFence(HalDisplayId) const override;
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400372 nsecs_t getPresentTimestamp(PhysicalDisplayId) const override;
Mathias Agopianda27af92012-09-13 18:17:13 -0700373
Dan Stoza9e56aa02015-11-02 13:00:03 -0800374 // Get last release fence for the given layer
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200375 sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const override;
Andy McFaddenb0d1dd32012-09-10 14:08:09 -0700376
Jesse Hall851cfe82013-03-20 13:44:00 -0700377 // Set the output buffer and acquire fence for a virtual display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200378 status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence,
Lloyd Pique441d5042018-10-18 16:49:51 -0700379 const sp<GraphicBuffer>& buffer) override;
Jesse Hall851cfe82013-03-20 13:44:00 -0700380
Dan Stoza9e56aa02015-11-02 13:00:03 -0800381 // After SurfaceFlinger has retrieved the release fences for all the frames,
382 // it can call this to clear the shared pointers in the release fence map
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200383 void clearReleaseFences(HalDisplayId) override;
Mathias Agopian3e8b8532012-05-13 20:42:01 -0700384
Peiyong Lin62665892018-04-16 11:07:44 -0700385 // Fetches the HDR capabilities of the given display
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200386 status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) override;
Dan Stozac4f471e2016-03-24 09:31:08 -0700387
Sally Qibb866c12022-10-17 11:31:20 -0700388 const aidl::android::hardware::graphics::composer3::OverlayProperties& getOverlaySupport()
389 const override;
Sally Qi0cbd08b2022-08-17 12:12:28 -0700390
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200391 int32_t getSupportedPerFrameMetadata(HalDisplayId) const override;
Peiyong Lin0ac5f4e2018-04-19 22:06:34 -0700392
Peiyong Lin0e7a7912018-04-05 14:36:36 -0700393 // Returns the available RenderIntent of the given display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200394 std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const override;
Peiyong Lin0e7a7912018-04-05 14:36:36 -0700395
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200396 mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) override;
Peiyong Lin0e7a7912018-04-05 14:36:36 -0700397
Kevin DuBois9c0a1762018-10-16 13:32:31 -0700398 // Returns the attributes of the color sampling engine.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200399 status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat,
Kevin DuBois9c0a1762018-10-16 13:32:31 -0700400 ui::Dataspace* outDataspace,
Lloyd Pique441d5042018-10-18 16:49:51 -0700401 uint8_t* outComponentMask) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200402 status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled, uint8_t componentMask,
Marin Shalamanova524a092020-07-27 21:39:55 +0200403 uint64_t maxFrames) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200404 status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp,
Lloyd Pique441d5042018-10-18 16:49:51 -0700405 DisplayedFrameStats* outStats) override;
Dominik Laskowskib17c6212022-05-09 09:36:19 -0700406 ftl::Future<status_t> setDisplayBrightness(
Alec Mouri4d8a05d2022-03-23 18:14:26 +0000407 PhysicalDisplayId, float brightness, float brightnessNits,
Alec Mouricdf16792021-12-10 13:16:06 -0800408 const Hwc2::Composer::DisplayBrightnessOptions&) override;
Kevin DuBois9c0a1762018-10-16 13:32:31 -0700409
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700410 // Events handling ---------------------------------------------------------
411
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200412 // Returns PhysicalDisplayId (and display name on connection of new or previously disconnected
Dominik Laskowski075d3172018-05-24 15:50:06 -0700413 // display), or std::nullopt if hotplug event was ignored.
Marin Shalamanova524a092020-07-27 21:39:55 +0200414 std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, hal::Connection) override;
Steven Thomas94e35b92017-07-26 18:48:28 -0700415
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200416 bool updatesDeviceProductInfoOnHotplugReconnect() const override;
417
Leon Scroggins III959a7ff2023-02-07 11:24:25 -0500418 std::optional<PhysicalDisplayId> onVsync(hal::HWDisplayId, nsecs_t timestamp) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200419 void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) override;
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700420
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200421 bool isConnected(PhysicalDisplayId) const override;
Dan Stoza7f7da322014-05-02 15:26:25 -0700422
ramindani263a3f12023-07-18 20:44:49 -0700423 std::vector<HWCDisplayMode> getModes(PhysicalDisplayId,
424 int32_t maxFrameIntervalNs) const override;
Dan Stoza7f7da322014-05-02 15:26:25 -0700425
Marin Shalamanov045b7002021-01-07 16:56:24 +0100426 std::optional<hal::HWConfigId> getActiveMode(PhysicalDisplayId) const override;
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700427
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200428 std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const override;
Michael Wright28f24d02016-07-12 13:30:53 -0700429
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200430 status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode, ui::RenderIntent) override;
Courtney Goeltzenleuchterfad9d8c2016-06-23 11:49:50 -0600431
Matt Buckley50c44062022-01-17 20:48:10 +0000432 bool getValidateSkipped(HalDisplayId displayId) const override;
433
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800434 // Composer 2.4
Marin Shalamanov228f46b2021-01-28 21:11:45 +0100435 ui::DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200436 bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const override;
Marin Shalamanov045b7002021-01-07 16:56:24 +0100437 status_t getDisplayVsyncPeriod(PhysicalDisplayId displayId,
438 nsecs_t* outVsyncPeriod) const override;
Marin Shalamanov12c9e5a2021-01-07 00:25:35 +0100439 status_t setActiveModeWithConstraints(PhysicalDisplayId, hal::HWConfigId,
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100440 const hal::VsyncPeriodChangeConstraints&,
441 hal::VsyncPeriodChangeTimeline* outTimeline) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200442 status_t setAutoLowLatencyMode(PhysicalDisplayId, bool) override;
Dominik Laskowski6c7b36e2022-03-03 08:27:58 -0800443 status_t getSupportedContentTypes(PhysicalDisplayId,
444 std::vector<hal::ContentType>*) const override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200445 status_t setContentType(PhysicalDisplayId, hal::ContentType) override;
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800446
Lloyd Pique4603f3c2020-02-11 12:06:56 -0800447 const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata() const override;
448
Kriti Dang7defaf32021-11-15 11:55:43 +0100449 // Composer 3.0
Kriti Dang7defaf32021-11-15 11:55:43 +0100450 status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) override;
451 status_t clearBootDisplayMode(PhysicalDisplayId) override;
Kriti Dang16ca2972022-02-01 20:07:03 +0100452 std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) override;
Leon Scroggins IIIe7c51c62022-02-01 15:53:54 -0500453 status_t getDisplayDecorationSupport(
454 PhysicalDisplayId,
455 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
456 support) override;
ramindani32cf0602022-03-02 02:30:29 +0000457 status_t setIdleTimerEnabled(PhysicalDisplayId, std::chrono::milliseconds timeout) override;
ramindani06e518e2022-03-14 18:47:53 +0000458 bool hasDisplayIdleTimerCapability(PhysicalDisplayId) const override;
459 Hwc2::AidlTransform getPhysicalDisplayOrientation(PhysicalDisplayId) const override;
Kriti Dang674b9372022-11-18 10:58:44 +0100460 std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability>
461 getHdrConversionCapabilities() const override;
462 status_t setHdrConversionStrategy(
Kriti Dangd432bb52023-02-09 18:21:04 +0100463 aidl::android::hardware::graphics::common::HdrConversionStrategy,
464 aidl::android::hardware::graphics::common::Hdr*) override;
ramindanib2158ee2023-02-13 20:29:59 -0800465 status_t setRefreshRateChangedCallbackDebugEnabled(PhysicalDisplayId, bool enabled) override;
ramindanif8c0f102023-10-09 12:42:57 -0700466 status_t notifyExpectedPresentIfRequired(PhysicalDisplayId, Period vsyncPeriod,
467 TimePoint expectedPresentTime, Fps frameInterval,
468 std::optional<Period> timeoutOpt) override;
Kriti Dang7defaf32021-11-15 11:55:43 +0100469
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700470 // for debugging ----------------------------------------------------------
Lloyd Pique441d5042018-10-18 16:49:51 -0700471 void dump(std::string& out) const override;
Mathias Agopian83727852010-09-23 18:13:21 -0700472
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800473 Hwc2::Composer* getComposer() const override { return mComposer.get(); }
Steven Thomas6e8f7062017-11-22 14:15:29 -0800474
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700475 hal::HWDisplayId getPrimaryHwcDisplayId() const override {
476 LOG_ALWAYS_FATAL_IF(!mPrimaryHwcDisplayId, "Missing HWC primary display");
477 return *mPrimaryHwcDisplayId;
Lloyd Pique441d5042018-10-18 16:49:51 -0700478 }
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700479
480 PhysicalDisplayId getPrimaryDisplayId() const override {
481 const auto id = toPhysicalDisplayId(getPrimaryHwcDisplayId());
482 LOG_ALWAYS_FATAL_IF(!id, "Missing primary display");
483 return *id;
Lloyd Pique441d5042018-10-18 16:49:51 -0700484 }
Dominik Laskowski075d3172018-05-24 15:50:06 -0700485
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700486 virtual bool isHeadless() const override { return !mPrimaryHwcDisplayId; }
487
Marin Shalamanova524a092020-07-27 21:39:55 +0200488 std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const override;
489 std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const override;
Dominik Laskowski075d3172018-05-24 15:50:06 -0700490
Mathias Agopiana350ff92010-08-10 17:14:02 -0700491private:
Lloyd Piquee39cad22017-12-20 17:01:29 -0800492 // For unit tests
493 friend TestableSurfaceFlinger;
ramindanib90711b2023-10-02 15:13:19 -0700494 friend HWComposerTest;
Lloyd Piquee39cad22017-12-20 17:01:29 -0800495
Mathias Agopiane60b0682012-08-21 23:34:09 -0700496 struct DisplayData {
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800497 std::unique_ptr<HWC2::Display> hwcDisplay;
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400498
Dominik Laskowskif9750f22018-06-06 12:24:53 -0700499 sp<Fence> lastPresentFence = Fence::NO_FENCE; // signals when the last set op retires
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400500 nsecs_t lastPresentTimestamp = 0;
501
ramindanif8c0f102023-10-09 12:42:57 -0700502 std::mutex expectedPresentLock;
503 TimePoint lastExpectedPresentTimestamp GUARDED_BY(expectedPresentLock) =
504 TimePoint::fromNs(0);
505 Fps lastFrameInterval GUARDED_BY(expectedPresentLock) = Fps::fromValue(0);
ramindanib90711b2023-10-02 15:13:19 -0700506
Steven Thomas94e35b92017-07-26 18:48:28 -0700507 std::unordered_map<HWC2::Layer*, sp<Fence>> releaseFences;
Jamie Gennis2ec3e072012-11-11 16:24:33 -0800508
Fabien Sanglard249c0ae2017-06-19 19:22:36 -0700509 bool validateWasSkipped;
Peiyong Line9d809e2020-04-14 13:10:48 -0700510 hal::Error presentError;
Dominik Laskowski1af47932018-11-12 10:20:46 -0800511
512 bool vsyncTraceToggle = false;
513
514 std::mutex vsyncEnabledLock;
Peiyong Line9d809e2020-04-14 13:10:48 -0700515 hal::Vsync vsyncEnabled GUARDED_BY(vsyncEnabledLock) = hal::Vsync::DISABLE;
Mathias Agopiane60b0682012-08-21 23:34:09 -0700516 };
517
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100518 std::optional<DisplayIdentificationInfo> onHotplugConnect(hal::HWDisplayId);
519 std::optional<DisplayIdentificationInfo> onHotplugDisconnect(hal::HWDisplayId);
520 bool shouldIgnoreHotplugConnect(hal::HWDisplayId, bool hasDisplayIdentificationData) const;
521
ramindani263a3f12023-07-18 20:44:49 -0700522 std::vector<HWCDisplayMode> getModesFromDisplayConfigurations(uint64_t hwcDisplayId,
523 int32_t maxFrameIntervalNs) const;
ramindani0cd1d8d2023-06-13 13:43:23 -0700524 std::vector<HWCDisplayMode> getModesFromLegacyDisplayConfigs(uint64_t hwcDisplayId) const;
525
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100526 int32_t getAttribute(hal::HWDisplayId hwcDisplayId, hal::HWConfigId configId,
Marin Shalamanov045b7002021-01-07 16:56:24 +0100527 hal::Attribute attribute) const;
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100528
529 void loadCapabilities();
530 void loadLayerMetadataSupport();
Sally Qibb866c12022-10-17 11:31:20 -0700531 void loadOverlayProperties();
Kriti Dang674b9372022-11-18 10:58:44 +0100532 void loadHdrConversionCapabilities();
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100533
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200534 std::unordered_map<HalDisplayId, DisplayData> mDisplayData;
Dominik Laskowskib04f98a2018-11-07 21:07:16 -0800535
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800536 std::unique_ptr<android::Hwc2::Composer> mComposer;
Ady Abrahamde549d42022-01-26 19:19:17 -0800537 std::unordered_set<aidl::android::hardware::graphics::composer3::Capability> mCapabilities;
Sally Qibb866c12022-10-17 11:31:20 -0700538 aidl::android::hardware::graphics::composer3::OverlayProperties mOverlayProperties;
Kriti Dang674b9372022-11-18 10:58:44 +0100539 std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability>
540 mHdrConversionCapabilities = {};
541
Lloyd Pique4603f3c2020-02-11 12:06:56 -0800542 std::unordered_map<std::string, bool> mSupportedLayerGenericMetadata;
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800543 bool mRegisteredCallback = false;
Dominik Laskowskib04f98a2018-11-07 21:07:16 -0800544
Marin Shalamanova524a092020-07-27 21:39:55 +0200545 std::unordered_map<hal::HWDisplayId, PhysicalDisplayId> mPhysicalDisplayIdMap;
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700546 std::optional<hal::HWDisplayId> mPrimaryHwcDisplayId;
Dominik Laskowski075d3172018-05-24 15:50:06 -0700547 bool mHasMultiDisplaySupport = false;
548
Dominik Laskowski13948602021-03-08 20:48:28 -0800549 const size_t mMaxVirtualDisplayDimension;
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200550 const bool mUpdateDeviceProductInfoOnHotplugReconnect;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700551};
552
Lloyd Pique441d5042018-10-18 16:49:51 -0700553} // namespace impl
Dominik Laskowski1af47932018-11-12 10:20:46 -0800554} // namespace android