blob: 9368b7b6dd3d5085cb07fa60f0e6f67a556ae9fa [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 Laskowskid940a012024-01-28 13:25:44 -050028#include <ftl/expected.h>
Dominik Laskowskib17c6212022-05-09 09:36:19 -070029#include <ftl/future.h>
Alec Mouriff793872022-01-13 17:45:06 -080030#include <ui/DisplayIdentification.h>
Ady Abrahamec7aa8a2021-06-28 12:37:09 -070031#include <ui/FenceTime.h>
Ady Abraham8a82ba62020-01-17 12:43:17 -080032
33// TODO(b/129481165): remove the #pragma below and fix conversion issues
34#pragma clang diagnostic push
35#pragma clang diagnostic ignored "-Wconversion"
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010036#pragma clang diagnostic ignored "-Wextra"
Dominik Laskowski1af47932018-11-12 10:20:46 -080037#include <ui/GraphicTypes.h>
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010038#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
Ady Abraham8a82ba62020-01-17 12:43:17 -080039
Dominik Laskowski1af47932018-11-12 10:20:46 -080040#include <utils/StrongPointer.h>
41#include <utils/Timers.h>
42
Marin Shalamanov3ea1d602020-12-16 19:59:39 +010043#include "DisplayMode.h"
Dominik Laskowski1af47932018-11-12 10:20:46 -080044#include "HWC2.h"
Peiyong Line9d809e2020-04-14 13:10:48 -070045#include "Hal.h"
Dan Stoza9e56aa02015-11-02 13:00:03 -080046
Leon Scroggins IIIe7c51c62022-02-01 15:53:54 -050047#include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h>
Kriti Dangd432bb52023-02-09 18:21:04 +010048#include <aidl/android/hardware/graphics/common/Hdr.h>
Kriti Dang674b9372022-11-18 10:58:44 +010049#include <aidl/android/hardware/graphics/common/HdrConversionCapability.h>
50#include <aidl/android/hardware/graphics/common/HdrConversionStrategy.h>
Ady Abrahamde549d42022-01-26 19:19:17 -080051#include <aidl/android/hardware/graphics/composer3/Capability.h>
Alec Mouri85065692022-03-18 00:58:26 +000052#include <aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.h>
Leon Scroggins III2e1aa182021-12-01 17:33:12 -050053#include <aidl/android/hardware/graphics/composer3/Composition.h>
Leon Scroggins III5967aec2021-12-29 11:14:22 -050054#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
Sally Qi0cbd08b2022-08-17 12:12:28 -070055#include <aidl/android/hardware/graphics/composer3/OverlayProperties.h>
Leon Scroggins III2e1aa182021-12-01 17:33:12 -050056
Mathias Agopiana350ff92010-08-10 17:14:02 -070057namespace android {
Mathias Agopiana350ff92010-08-10 17:14:02 -070058
Peiyong Line9d809e2020-04-14 13:10:48 -070059namespace hal = hardware::graphics::composer::hal;
60
Kevin DuBois1d4249a2018-08-29 10:45:14 -070061struct DisplayedFrameStats;
Jesse Hall399184a2014-03-03 15:42:54 -080062class GraphicBuffer;
Lloyd Piquee39cad22017-12-20 17:01:29 -080063class TestableSurfaceFlinger;
ramindanib90711b2023-10-02 15:13:19 -070064struct HWComposerTest;
David Sodmanfb95bcc2017-12-22 15:45:30 -080065struct CompositionInfo;
Mathias Agopian83727852010-09-23 18:13:21 -070066
Lloyd Piquea822d522017-12-20 16:42:57 -080067namespace Hwc2 {
68class Composer;
69} // namespace Hwc2
70
Lloyd Pique37c2c9b2018-12-04 17:25:10 -080071namespace compositionengine {
72class Output;
73} // namespace compositionengine
74
Lloyd Pique4603f3c2020-02-11 12:06:56 -080075struct KnownHWCGenericLayerMetadata {
76 const char* name;
77 const uint32_t id;
78};
79
Marin Shalamanov1c434292020-06-12 01:47:29 +020080// See the comment for SurfaceFlinger::getHwComposer for the thread safety rules for accessing
81// this class.
Lloyd Pique441d5042018-10-18 16:49:51 -070082class HWComposer {
83public:
Peiyong Lindfc3f7c2020-05-07 20:15:50 -070084 struct DeviceRequestedChanges {
Leon Scroggins III2e1aa182021-12-01 17:33:12 -050085 using ChangedTypes =
86 std::unordered_map<HWC2::Layer*,
87 aidl::android::hardware::graphics::composer3::Composition>;
Alec Mouri85065692022-03-18 00:58:26 +000088 using ClientTargetProperty =
89 aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness;
Peiyong Lindfc3f7c2020-05-07 20:15:50 -070090 using DisplayRequests = hal::DisplayRequest;
91 using LayerRequests = std::unordered_map<HWC2::Layer*, hal::LayerRequest>;
92
93 ChangedTypes changedTypes;
94 DisplayRequests displayRequests;
95 LayerRequests layerRequests;
96 ClientTargetProperty clientTargetProperty;
97 };
98
Marin Shalamanov045b7002021-01-07 16:56:24 +010099 struct HWCDisplayMode {
100 hal::HWConfigId hwcId;
101 int32_t width = -1;
102 int32_t height = -1;
103 nsecs_t vsyncPeriod = -1;
ramindani0cd1d8d2023-06-13 13:43:23 -0700104 float dpiX = -1.f;
105 float dpiY = -1.f;
Marin Shalamanov045b7002021-01-07 16:56:24 +0100106 int32_t configGroup = -1;
ramindania04b8a52023-08-07 18:49:47 -0700107 std::optional<hal::VrrConfig> vrrConfig;
Marin Shalamanovd3b5c5d2021-02-11 18:26:14 +0100108
109 friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) {
110 return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height
111 << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x"
ramindania04b8a52023-08-07 18:49:47 -0700112 << mode.dpiY << " group=" << mode.configGroup
113 << " vrrConfig=" << to_string(mode.vrrConfig).c_str();
Marin Shalamanovd3b5c5d2021-02-11 18:26:14 +0100114 }
Marin Shalamanov045b7002021-01-07 16:56:24 +0100115 };
116
Lloyd Pique441d5042018-10-18 16:49:51 -0700117 virtual ~HWComposer();
118
Yichi Chen3401b562022-01-17 15:42:35 +0800119 virtual void setCallback(HWC2::ComposerCallback&) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700120
Marin Shalamanova524a092020-07-27 21:39:55 +0200121 virtual bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort,
Lloyd Pique441d5042018-10-18 16:49:51 -0700122 DisplayIdentificationData* outData) const = 0;
123
Ady Abrahamde549d42022-01-26 19:19:17 -0800124 virtual bool hasCapability(aidl::android::hardware::graphics::composer3::Capability) const = 0;
Leon Scroggins III5967aec2021-12-29 11:14:22 -0500125 virtual bool hasDisplayCapability(
126 HalDisplayId,
127 aidl::android::hardware::graphics::composer3::DisplayCapability) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700128
Dominik Laskowski13948602021-03-08 20:48:28 -0800129 virtual size_t getMaxVirtualDisplayCount() const = 0;
130 virtual size_t getMaxVirtualDisplayDimension() const = 0;
131
132 // Attempts to allocate a virtual display on the HWC. The maximum number of virtual displays
133 // supported by the HWC can be queried in advance, but allocation may fail for other reasons.
Dominik Laskowski263eec42021-07-21 23:13:24 -0700134 virtual bool allocateVirtualDisplay(HalVirtualDisplayId, ui::Size, ui::PixelFormat*) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700135
Marin Shalamanova524a092020-07-27 21:39:55 +0200136 virtual void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) = 0;
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100137
Lloyd Pique441d5042018-10-18 16:49:51 -0700138 // Attempts to create a new layer on this display
Lloyd Pique1b33fc32021-05-07 14:36:58 -0700139 virtual std::shared_ptr<HWC2::Layer> createLayer(HalDisplayId) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700140
Lloyd Pique66d68602019-02-13 14:23:31 -0800141 // Gets any required composition change requests from the HWC device.
142 //
143 // Note that frameUsesClientComposition must be set correctly based on
144 // whether the current frame appears to use client composition. If it is
145 // false some internal optimizations are allowed to present the display
146 // with fewer handshakes, but this does not work if client composition is
147 // expected.
148 virtual status_t getDeviceCompositionChanges(
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200149 HalDisplayId, bool frameUsesClientComposition,
Ady Abrahamf1db8032023-03-24 17:52:34 -0700150 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime,
ramindani4aac32c2023-10-30 14:13:30 -0700151 nsecs_t expectedPresentTime, Fps frameInterval,
152 std::optional<DeviceRequestedChanges>* outChanges) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700153
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200154 virtual status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence,
Alec Mourif97df4d2023-09-06 02:10:05 +0000155 const sp<GraphicBuffer>& target, ui::Dataspace,
156 float hdrSdrRatio) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700157
158 // Present layers to the display and read releaseFences.
Ady Abrahamb42cdc12021-05-11 14:31:26 -0700159 virtual status_t presentAndGetReleaseFences(
Ady Abrahamf1db8032023-03-24 17:52:34 -0700160 HalDisplayId,
161 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700162
Leon Scroggins IIIa3ba7fa2024-05-22 16:34:52 -0400163 virtual status_t executeCommands(HalDisplayId) = 0;
164
Lloyd Pique441d5042018-10-18 16:49:51 -0700165 // set power mode
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200166 virtual status_t setPowerMode(PhysicalDisplayId, hal::PowerMode) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700167
Lloyd Pique441d5042018-10-18 16:49:51 -0700168 // Sets a color transform to be applied to the result of composition
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200169 virtual status_t setColorTransform(HalDisplayId, const mat4& transform) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700170
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200171 // reset state when a display is disconnected
172 virtual void disconnectDisplay(HalDisplayId) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700173
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400174 // Get the present fence/timestamp received from the last call to present.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200175 virtual sp<Fence> getPresentFence(HalDisplayId) const = 0;
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400176 virtual nsecs_t getPresentTimestamp(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700177
178 // Get last release fence for the given layer
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200179 virtual sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700180
181 // Set the output buffer and acquire fence for a virtual display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200182 virtual status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence,
Lloyd Pique441d5042018-10-18 16:49:51 -0700183 const sp<GraphicBuffer>& buffer) = 0;
184
185 // After SurfaceFlinger has retrieved the release fences for all the frames,
186 // it can call this to clear the shared pointers in the release fence map
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200187 virtual void clearReleaseFences(HalDisplayId) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700188
189 // Fetches the HDR capabilities of the given display
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200190 virtual status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700191
Sally Qibb866c12022-10-17 11:31:20 -0700192 virtual const aidl::android::hardware::graphics::composer3::OverlayProperties&
193 getOverlaySupport() const = 0;
Sally Qi0cbd08b2022-08-17 12:12:28 -0700194
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200195 virtual int32_t getSupportedPerFrameMetadata(HalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700196
197 // Returns the available RenderIntent of the given display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200198 virtual std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700199
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200200 virtual mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700201
202 // Returns the attributes of the color sampling engine.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200203 virtual status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat,
Lloyd Pique441d5042018-10-18 16:49:51 -0700204 ui::Dataspace* outDataspace,
205 uint8_t* outComponentMask) = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200206 virtual status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled,
Lloyd Pique441d5042018-10-18 16:49:51 -0700207 uint8_t componentMask,
208 uint64_t maxFrames) = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200209 virtual status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp,
Lloyd Pique441d5042018-10-18 16:49:51 -0700210 DisplayedFrameStats* outStats) = 0;
211
Dan Gittik57e63c52019-01-18 16:37:54 +0000212 // Sets the brightness of a display.
Dominik Laskowskib17c6212022-05-09 09:36:19 -0700213 virtual ftl::Future<status_t> setDisplayBrightness(
Alec Mouri4d8a05d2022-03-23 18:14:26 +0000214 PhysicalDisplayId, float brightness, float brightnessNits,
Alec Mouricdf16792021-12-10 13:16:06 -0800215 const Hwc2::Composer::DisplayBrightnessOptions&) = 0;
Dan Gittik57e63c52019-01-18 16:37:54 +0000216
Matt Buckley50c44062022-01-17 20:48:10 +0000217 // Get whether the display skipped validation on the latest present
218 virtual bool getValidateSkipped(HalDisplayId displayId) const = 0;
219
Lloyd Pique441d5042018-10-18 16:49:51 -0700220 // Events handling ---------------------------------------------------------
221
222 // Returns stable display ID (and display name on connection of new or previously disconnected
223 // display), or std::nullopt if hotplug event was ignored.
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100224 // This function is called from SurfaceFlinger.
Marin Shalamanova524a092020-07-27 21:39:55 +0200225 virtual std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId,
226 hal::Connection) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700227
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200228 // If true we'll update the DeviceProductInfo on subsequent hotplug connected events.
229 // TODO(b/157555476): Remove when the framework has proper support for headless mode
230 virtual bool updatesDeviceProductInfoOnHotplugReconnect() const = 0;
231
Leon Scroggins III959a7ff2023-02-07 11:24:25 -0500232 // Called when a vsync happens. If the vsync is valid, returns the
233 // corresponding PhysicalDisplayId. Otherwise returns nullopt.
234 virtual std::optional<PhysicalDisplayId> onVsync(hal::HWDisplayId, nsecs_t timestamp) = 0;
235
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200236 virtual void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700237
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200238 virtual bool isConnected(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700239
ramindani263a3f12023-07-18 20:44:49 -0700240 virtual std::vector<HWCDisplayMode> getModes(PhysicalDisplayId,
241 int32_t maxFrameIntervalNs) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700242
Dominik Laskowskid940a012024-01-28 13:25:44 -0500243 virtual ftl::Expected<hal::HWConfigId, status_t> getActiveMode(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700244
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200245 virtual std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700246
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200247 virtual status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode mode,
248 ui::RenderIntent) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700249
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800250 // Composer 2.4
Marin Shalamanov228f46b2021-01-28 21:11:45 +0100251 virtual ui::DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200252 virtual bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const = 0;
Dominik Laskowskia109bb22024-01-28 13:33:51 -0500253 virtual ftl::Expected<nsecs_t, status_t> getDisplayVsyncPeriod(PhysicalDisplayId) const = 0;
Marin Shalamanov12c9e5a2021-01-07 00:25:35 +0100254 virtual status_t setActiveModeWithConstraints(PhysicalDisplayId, hal::HWConfigId,
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100255 const hal::VsyncPeriodChangeConstraints&,
256 hal::VsyncPeriodChangeTimeline* outTimeline) = 0;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200257 virtual status_t setAutoLowLatencyMode(PhysicalDisplayId, bool on) = 0;
Galia Peycheva5492cb52019-10-30 14:13:16 +0100258 virtual status_t getSupportedContentTypes(
Dominik Laskowski6c7b36e2022-03-03 08:27:58 -0800259 PhysicalDisplayId, std::vector<hal::ContentType>* outSupportedContentTypes) const = 0;
260
261 bool supportsContentType(PhysicalDisplayId displayId, hal::ContentType type) const {
262 std::vector<hal::ContentType> types;
263 return getSupportedContentTypes(displayId, &types) == NO_ERROR &&
264 std::find(types.begin(), types.end(), type) != types.end();
265 }
266
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200267 virtual status_t setContentType(PhysicalDisplayId, hal::ContentType) = 0;
Dominik Laskowski6c7b36e2022-03-03 08:27:58 -0800268
Lloyd Pique4603f3c2020-02-11 12:06:56 -0800269 virtual const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata()
270 const = 0;
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800271
Lloyd Pique441d5042018-10-18 16:49:51 -0700272 virtual void dump(std::string& out) const = 0;
273
Sally Qi254ef492024-04-08 15:01:28 -0700274 virtual void dumpOverlayProperties(std::string& out) const = 0;
275
Lloyd Pique441d5042018-10-18 16:49:51 -0700276 virtual Hwc2::Composer* getComposer() const = 0;
277
Marin Shalamanov8b196592021-08-09 16:24:42 +0200278 // Returns the first display connected at boot. Its connection via HWComposer::onHotplug,
279 // which in practice is immediately after HWComposer construction, must occur before any
280 // call to this function.
281 // The primary display can be temporarily disconnected from the perspective
282 // of this class. Callers must not call getPrimaryHwcDisplayId() or getPrimaryDisplayId()
283 // if isHeadless().
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700284 //
285 // TODO(b/182939859): Remove special cases for primary display.
286 virtual hal::HWDisplayId getPrimaryHwcDisplayId() const = 0;
287 virtual PhysicalDisplayId getPrimaryDisplayId() const = 0;
288 virtual bool isHeadless() const = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700289
Marin Shalamanova524a092020-07-27 21:39:55 +0200290 virtual std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const = 0;
291 virtual std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const = 0;
Kriti Dang7defaf32021-11-15 11:55:43 +0100292
293 // Composer 3.0
Kriti Dang7defaf32021-11-15 11:55:43 +0100294 virtual status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) = 0;
295 virtual status_t clearBootDisplayMode(PhysicalDisplayId) = 0;
Kriti Dang16ca2972022-02-01 20:07:03 +0100296 virtual std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) = 0;
Leon Scroggins IIIe7c51c62022-02-01 15:53:54 -0500297 virtual status_t getDisplayDecorationSupport(
298 PhysicalDisplayId,
299 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
300 support) = 0;
ramindani32cf0602022-03-02 02:30:29 +0000301 virtual status_t setIdleTimerEnabled(PhysicalDisplayId, std::chrono::milliseconds timeout) = 0;
ramindani06e518e2022-03-14 18:47:53 +0000302 virtual bool hasDisplayIdleTimerCapability(PhysicalDisplayId) const = 0;
303 virtual Hwc2::AidlTransform getPhysicalDisplayOrientation(PhysicalDisplayId) const = 0;
Kriti Dang674b9372022-11-18 10:58:44 +0100304 virtual std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability>
305 getHdrConversionCapabilities() const = 0;
306 virtual status_t setHdrConversionStrategy(
Kriti Dangd432bb52023-02-09 18:21:04 +0100307 aidl::android::hardware::graphics::common::HdrConversionStrategy,
308 aidl::android::hardware::graphics::common::Hdr*) = 0;
ramindanib2158ee2023-02-13 20:29:59 -0800309 virtual status_t setRefreshRateChangedCallbackDebugEnabled(PhysicalDisplayId, bool enabled) = 0;
ramindanic67d22c2023-11-28 14:58:47 -0800310 virtual status_t notifyExpectedPresent(PhysicalDisplayId, TimePoint expectedPresentTime,
311 Fps frameInterval) = 0;
Lloyd Pique441d5042018-10-18 16:49:51 -0700312};
313
Vishnu Naira3140382022-02-24 14:07:11 -0800314static inline bool operator==(const android::HWComposer::DeviceRequestedChanges& lhs,
315 const android::HWComposer::DeviceRequestedChanges& rhs) {
316 return lhs.changedTypes == rhs.changedTypes && lhs.displayRequests == rhs.displayRequests &&
317 lhs.layerRequests == rhs.layerRequests &&
318 lhs.clientTargetProperty == rhs.clientTargetProperty;
319}
320
Lloyd Pique441d5042018-10-18 16:49:51 -0700321namespace impl {
322
323class HWComposer final : public android::HWComposer {
Mathias Agopiana350ff92010-08-10 17:14:02 -0700324public:
Dominik Laskowski1af47932018-11-12 10:20:46 -0800325 explicit HWComposer(std::unique_ptr<Hwc2::Composer> composer);
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800326 explicit HWComposer(const std::string& composerServiceName);
Mathias Agopian8b736f12012-08-13 17:54:26 -0700327
Lloyd Pique441d5042018-10-18 16:49:51 -0700328 ~HWComposer() override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700329
Yichi Chen3401b562022-01-17 15:42:35 +0800330 void setCallback(HWC2::ComposerCallback&) override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700331
Marin Shalamanova524a092020-07-27 21:39:55 +0200332 bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort,
Lloyd Pique441d5042018-10-18 16:49:51 -0700333 DisplayIdentificationData* outData) const override;
Dominik Laskowskie9ef7c42018-03-12 19:34:30 -0700334
Ady Abrahamde549d42022-01-26 19:19:17 -0800335 bool hasCapability(aidl::android::hardware::graphics::composer3::Capability) const override;
Leon Scroggins III5967aec2021-12-29 11:14:22 -0500336 bool hasDisplayCapability(
337 HalDisplayId,
338 aidl::android::hardware::graphics::composer3::DisplayCapability) const override;
Dan Stoza9f26a9c2016-06-22 14:51:09 -0700339
Dominik Laskowski13948602021-03-08 20:48:28 -0800340 size_t getMaxVirtualDisplayCount() const override;
341 size_t getMaxVirtualDisplayDimension() const override;
342
Dominik Laskowski263eec42021-07-21 23:13:24 -0700343 bool allocateVirtualDisplay(HalVirtualDisplayId, ui::Size, ui::PixelFormat*) override;
Mathias Agopiane60b0682012-08-21 23:34:09 -0700344
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100345 // Called from SurfaceFlinger, when the state for a new physical display needs to be recreated.
Marin Shalamanova524a092020-07-27 21:39:55 +0200346 void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) override;
Marin Shalamanovbdd59152020-02-14 15:30:06 +0100347
Dan Stoza9e56aa02015-11-02 13:00:03 -0800348 // Attempts to create a new layer on this display
Lloyd Pique1b33fc32021-05-07 14:36:58 -0700349 std::shared_ptr<HWC2::Layer> createLayer(HalDisplayId) override;
Mathias Agopiane60b0682012-08-21 23:34:09 -0700350
Lloyd Pique66d68602019-02-13 14:23:31 -0800351 status_t getDeviceCompositionChanges(
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200352 HalDisplayId, bool frameUsesClientComposition,
Ady Abrahamf1db8032023-03-24 17:52:34 -0700353 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime,
ramindani4aac32c2023-10-30 14:13:30 -0700354 nsecs_t expectedPresentTime, Fps frameInterval,
Lloyd Pique66d68602019-02-13 14:23:31 -0800355 std::optional<DeviceRequestedChanges>* outChanges) override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700356
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200357 status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence,
Alec Mourif97df4d2023-09-06 02:10:05 +0000358 const sp<GraphicBuffer>& target, ui::Dataspace,
359 float hdrSdrRatio) override;
Dan Stoza9e56aa02015-11-02 13:00:03 -0800360
Fabien Sanglarda87aa7b2016-11-30 16:27:22 -0800361 // Present layers to the display and read releaseFences.
Ady Abrahamb42cdc12021-05-11 14:31:26 -0700362 status_t presentAndGetReleaseFences(
Ady Abrahamf1db8032023-03-24 17:52:34 -0700363 HalDisplayId,
364 std::optional<std::chrono::steady_clock::time_point> earliestPresentTime) override;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700365
Leon Scroggins IIIa3ba7fa2024-05-22 16:34:52 -0400366 status_t executeCommands(HalDisplayId) override;
367
Prashant Malani2c9b11f2014-05-25 01:36:31 -0700368 // set power mode
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200369 status_t setPowerMode(PhysicalDisplayId, hal::PowerMode mode) override;
Colin Cross10fbdb62012-07-12 17:56:34 -0700370
Dan Stoza9f26a9c2016-06-22 14:51:09 -0700371 // Sets a color transform to be applied to the result of composition
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200372 status_t setColorTransform(HalDisplayId, const mat4& transform) override;
Dan Stoza9f26a9c2016-06-22 14:51:09 -0700373
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200374 // reset state when a display is disconnected
375 void disconnectDisplay(HalDisplayId) override;
Mathias Agopianda27af92012-09-13 18:17:13 -0700376
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400377 // Get the present fence/timestamp received from the last call to present.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200378 sp<Fence> getPresentFence(HalDisplayId) const override;
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400379 nsecs_t getPresentTimestamp(PhysicalDisplayId) const override;
Mathias Agopianda27af92012-09-13 18:17:13 -0700380
Dan Stoza9e56aa02015-11-02 13:00:03 -0800381 // Get last release fence for the given layer
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200382 sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const override;
Andy McFaddenb0d1dd32012-09-10 14:08:09 -0700383
Jesse Hall851cfe82013-03-20 13:44:00 -0700384 // Set the output buffer and acquire fence for a virtual display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200385 status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence,
Lloyd Pique441d5042018-10-18 16:49:51 -0700386 const sp<GraphicBuffer>& buffer) override;
Jesse Hall851cfe82013-03-20 13:44:00 -0700387
Dan Stoza9e56aa02015-11-02 13:00:03 -0800388 // After SurfaceFlinger has retrieved the release fences for all the frames,
389 // it can call this to clear the shared pointers in the release fence map
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200390 void clearReleaseFences(HalDisplayId) override;
Mathias Agopian3e8b8532012-05-13 20:42:01 -0700391
Peiyong Lin62665892018-04-16 11:07:44 -0700392 // Fetches the HDR capabilities of the given display
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200393 status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) override;
Dan Stozac4f471e2016-03-24 09:31:08 -0700394
Sally Qibb866c12022-10-17 11:31:20 -0700395 const aidl::android::hardware::graphics::composer3::OverlayProperties& getOverlaySupport()
396 const override;
Sally Qi0cbd08b2022-08-17 12:12:28 -0700397
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200398 int32_t getSupportedPerFrameMetadata(HalDisplayId) const override;
Peiyong Lin0ac5f4e2018-04-19 22:06:34 -0700399
Peiyong Lin0e7a7912018-04-05 14:36:36 -0700400 // Returns the available RenderIntent of the given display.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200401 std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const override;
Peiyong Lin0e7a7912018-04-05 14:36:36 -0700402
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200403 mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) override;
Peiyong Lin0e7a7912018-04-05 14:36:36 -0700404
Kevin DuBois9c0a1762018-10-16 13:32:31 -0700405 // Returns the attributes of the color sampling engine.
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200406 status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat,
Kevin DuBois9c0a1762018-10-16 13:32:31 -0700407 ui::Dataspace* outDataspace,
Lloyd Pique441d5042018-10-18 16:49:51 -0700408 uint8_t* outComponentMask) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200409 status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled, uint8_t componentMask,
Marin Shalamanova524a092020-07-27 21:39:55 +0200410 uint64_t maxFrames) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200411 status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp,
Lloyd Pique441d5042018-10-18 16:49:51 -0700412 DisplayedFrameStats* outStats) override;
Dominik Laskowskib17c6212022-05-09 09:36:19 -0700413 ftl::Future<status_t> setDisplayBrightness(
Alec Mouri4d8a05d2022-03-23 18:14:26 +0000414 PhysicalDisplayId, float brightness, float brightnessNits,
Alec Mouricdf16792021-12-10 13:16:06 -0800415 const Hwc2::Composer::DisplayBrightnessOptions&) override;
Kevin DuBois9c0a1762018-10-16 13:32:31 -0700416
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700417 // Events handling ---------------------------------------------------------
418
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200419 // Returns PhysicalDisplayId (and display name on connection of new or previously disconnected
Dominik Laskowski075d3172018-05-24 15:50:06 -0700420 // display), or std::nullopt if hotplug event was ignored.
Marin Shalamanova524a092020-07-27 21:39:55 +0200421 std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, hal::Connection) override;
Steven Thomas94e35b92017-07-26 18:48:28 -0700422
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200423 bool updatesDeviceProductInfoOnHotplugReconnect() const override;
424
Leon Scroggins III959a7ff2023-02-07 11:24:25 -0500425 std::optional<PhysicalDisplayId> onVsync(hal::HWDisplayId, nsecs_t timestamp) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200426 void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) override;
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700427
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200428 bool isConnected(PhysicalDisplayId) const override;
Dan Stoza7f7da322014-05-02 15:26:25 -0700429
ramindani263a3f12023-07-18 20:44:49 -0700430 std::vector<HWCDisplayMode> getModes(PhysicalDisplayId,
431 int32_t maxFrameIntervalNs) const override;
Dan Stoza7f7da322014-05-02 15:26:25 -0700432
Dominik Laskowskid940a012024-01-28 13:25:44 -0500433 ftl::Expected<hal::HWConfigId, status_t> getActiveMode(PhysicalDisplayId) const override;
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700434
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200435 std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const override;
Michael Wright28f24d02016-07-12 13:30:53 -0700436
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200437 status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode, ui::RenderIntent) override;
Courtney Goeltzenleuchterfad9d8c2016-06-23 11:49:50 -0600438
Matt Buckley50c44062022-01-17 20:48:10 +0000439 bool getValidateSkipped(HalDisplayId displayId) const override;
440
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800441 // Composer 2.4
Marin Shalamanov228f46b2021-01-28 21:11:45 +0100442 ui::DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200443 bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const override;
Dominik Laskowskia109bb22024-01-28 13:33:51 -0500444 ftl::Expected<nsecs_t, status_t> getDisplayVsyncPeriod(PhysicalDisplayId) const override;
Marin Shalamanov12c9e5a2021-01-07 00:25:35 +0100445 status_t setActiveModeWithConstraints(PhysicalDisplayId, hal::HWConfigId,
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100446 const hal::VsyncPeriodChangeConstraints&,
447 hal::VsyncPeriodChangeTimeline* outTimeline) override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200448 status_t setAutoLowLatencyMode(PhysicalDisplayId, bool) override;
Dominik Laskowski6c7b36e2022-03-03 08:27:58 -0800449 status_t getSupportedContentTypes(PhysicalDisplayId,
450 std::vector<hal::ContentType>*) const override;
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200451 status_t setContentType(PhysicalDisplayId, hal::ContentType) override;
Ady Abraham3a77a7b2019-12-02 18:46:59 -0800452
Lloyd Pique4603f3c2020-02-11 12:06:56 -0800453 const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata() const override;
454
Kriti Dang7defaf32021-11-15 11:55:43 +0100455 // Composer 3.0
Kriti Dang7defaf32021-11-15 11:55:43 +0100456 status_t setBootDisplayMode(PhysicalDisplayId, hal::HWConfigId) override;
457 status_t clearBootDisplayMode(PhysicalDisplayId) override;
Kriti Dang16ca2972022-02-01 20:07:03 +0100458 std::optional<hal::HWConfigId> getPreferredBootDisplayMode(PhysicalDisplayId) override;
Leon Scroggins IIIe7c51c62022-02-01 15:53:54 -0500459 status_t getDisplayDecorationSupport(
460 PhysicalDisplayId,
461 std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
462 support) override;
ramindani32cf0602022-03-02 02:30:29 +0000463 status_t setIdleTimerEnabled(PhysicalDisplayId, std::chrono::milliseconds timeout) override;
ramindani06e518e2022-03-14 18:47:53 +0000464 bool hasDisplayIdleTimerCapability(PhysicalDisplayId) const override;
465 Hwc2::AidlTransform getPhysicalDisplayOrientation(PhysicalDisplayId) const override;
Kriti Dang674b9372022-11-18 10:58:44 +0100466 std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability>
467 getHdrConversionCapabilities() const override;
468 status_t setHdrConversionStrategy(
Kriti Dangd432bb52023-02-09 18:21:04 +0100469 aidl::android::hardware::graphics::common::HdrConversionStrategy,
470 aidl::android::hardware::graphics::common::Hdr*) override;
ramindanib2158ee2023-02-13 20:29:59 -0800471 status_t setRefreshRateChangedCallbackDebugEnabled(PhysicalDisplayId, bool enabled) override;
ramindanic67d22c2023-11-28 14:58:47 -0800472 status_t notifyExpectedPresent(PhysicalDisplayId, TimePoint expectedPresentTime,
473 Fps frameInterval) override;
Kriti Dang7defaf32021-11-15 11:55:43 +0100474
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700475 // for debugging ----------------------------------------------------------
Lloyd Pique441d5042018-10-18 16:49:51 -0700476 void dump(std::string& out) const override;
Sally Qi254ef492024-04-08 15:01:28 -0700477 void dumpOverlayProperties(std::string& out) const override;
Mathias Agopian83727852010-09-23 18:13:21 -0700478
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800479 Hwc2::Composer* getComposer() const override { return mComposer.get(); }
Steven Thomas6e8f7062017-11-22 14:15:29 -0800480
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700481 hal::HWDisplayId getPrimaryHwcDisplayId() const override {
482 LOG_ALWAYS_FATAL_IF(!mPrimaryHwcDisplayId, "Missing HWC primary display");
483 return *mPrimaryHwcDisplayId;
Lloyd Pique441d5042018-10-18 16:49:51 -0700484 }
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700485
486 PhysicalDisplayId getPrimaryDisplayId() const override {
487 const auto id = toPhysicalDisplayId(getPrimaryHwcDisplayId());
488 LOG_ALWAYS_FATAL_IF(!id, "Missing primary display");
489 return *id;
Lloyd Pique441d5042018-10-18 16:49:51 -0700490 }
Dominik Laskowski075d3172018-05-24 15:50:06 -0700491
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700492 virtual bool isHeadless() const override { return !mPrimaryHwcDisplayId; }
493
Marin Shalamanova524a092020-07-27 21:39:55 +0200494 std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const override;
495 std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const override;
Dominik Laskowski075d3172018-05-24 15:50:06 -0700496
Mathias Agopiana350ff92010-08-10 17:14:02 -0700497private:
Lloyd Piquee39cad22017-12-20 17:01:29 -0800498 // For unit tests
499 friend TestableSurfaceFlinger;
ramindani355fca82023-12-18 12:07:34 -0800500 friend HWComposerTest;
Lloyd Piquee39cad22017-12-20 17:01:29 -0800501
Mathias Agopiane60b0682012-08-21 23:34:09 -0700502 struct DisplayData {
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800503 std::unique_ptr<HWC2::Display> hwcDisplay;
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400504
Dominik Laskowskif9750f22018-06-06 12:24:53 -0700505 sp<Fence> lastPresentFence = Fence::NO_FENCE; // signals when the last set op retires
Dominik Laskowskidc2bb802022-09-28 16:02:59 -0400506 nsecs_t lastPresentTimestamp = 0;
507
Steven Thomas94e35b92017-07-26 18:48:28 -0700508 std::unordered_map<HWC2::Layer*, sp<Fence>> releaseFences;
Jamie Gennis2ec3e072012-11-11 16:24:33 -0800509
Fabien Sanglard249c0ae2017-06-19 19:22:36 -0700510 bool validateWasSkipped;
Peiyong Line9d809e2020-04-14 13:10:48 -0700511 hal::Error presentError;
Dominik Laskowski1af47932018-11-12 10:20:46 -0800512
513 bool vsyncTraceToggle = false;
514
515 std::mutex vsyncEnabledLock;
Peiyong Line9d809e2020-04-14 13:10:48 -0700516 hal::Vsync vsyncEnabled GUARDED_BY(vsyncEnabledLock) = hal::Vsync::DISABLE;
Mathias Agopiane60b0682012-08-21 23:34:09 -0700517 };
518
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100519 std::optional<DisplayIdentificationInfo> onHotplugConnect(hal::HWDisplayId);
520 std::optional<DisplayIdentificationInfo> onHotplugDisconnect(hal::HWDisplayId);
521 bool shouldIgnoreHotplugConnect(hal::HWDisplayId, bool hasDisplayIdentificationData) const;
522
ramindani263a3f12023-07-18 20:44:49 -0700523 std::vector<HWCDisplayMode> getModesFromDisplayConfigurations(uint64_t hwcDisplayId,
524 int32_t maxFrameIntervalNs) const;
ramindani0cd1d8d2023-06-13 13:43:23 -0700525 std::vector<HWCDisplayMode> getModesFromLegacyDisplayConfigs(uint64_t hwcDisplayId) const;
526
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100527 int32_t getAttribute(hal::HWDisplayId hwcDisplayId, hal::HWConfigId configId,
Marin Shalamanov045b7002021-01-07 16:56:24 +0100528 hal::Attribute attribute) const;
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100529
530 void loadCapabilities();
531 void loadLayerMetadataSupport();
Sally Qibb866c12022-10-17 11:31:20 -0700532 void loadOverlayProperties();
Kriti Dang674b9372022-11-18 10:58:44 +0100533 void loadHdrConversionCapabilities();
Marin Shalamanov3ea1d602020-12-16 19:59:39 +0100534
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +0200535 std::unordered_map<HalDisplayId, DisplayData> mDisplayData;
Dominik Laskowskib04f98a2018-11-07 21:07:16 -0800536
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800537 std::unique_ptr<android::Hwc2::Composer> mComposer;
Ady Abrahamde549d42022-01-26 19:19:17 -0800538 std::unordered_set<aidl::android::hardware::graphics::composer3::Capability> mCapabilities;
Sally Qibb866c12022-10-17 11:31:20 -0700539 aidl::android::hardware::graphics::composer3::OverlayProperties mOverlayProperties;
Kriti Dang674b9372022-11-18 10:58:44 +0100540 std::vector<aidl::android::hardware::graphics::common::HdrConversionCapability>
541 mHdrConversionCapabilities = {};
542
Lloyd Pique4603f3c2020-02-11 12:06:56 -0800543 std::unordered_map<std::string, bool> mSupportedLayerGenericMetadata;
Peiyong Linbdd08cc2019-12-17 21:35:14 -0800544 bool mRegisteredCallback = false;
Dominik Laskowskib04f98a2018-11-07 21:07:16 -0800545
Marin Shalamanova524a092020-07-27 21:39:55 +0200546 std::unordered_map<hal::HWDisplayId, PhysicalDisplayId> mPhysicalDisplayIdMap;
Dominik Laskowskif8db0f02021-04-19 11:05:25 -0700547 std::optional<hal::HWDisplayId> mPrimaryHwcDisplayId;
Dominik Laskowski075d3172018-05-24 15:50:06 -0700548 bool mHasMultiDisplaySupport = false;
549
Dominik Laskowski13948602021-03-08 20:48:28 -0800550 const size_t mMaxVirtualDisplayDimension;
Marin Shalamanovf8c63722020-10-06 13:11:21 +0200551 const bool mUpdateDeviceProductInfoOnHotplugReconnect;
ramindani355fca82023-12-18 12:07:34 -0800552 bool mEnableVrrTimeout;
Mathias Agopiana350ff92010-08-10 17:14:02 -0700553};
554
Lloyd Pique441d5042018-10-18 16:49:51 -0700555} // namespace impl
Dominik Laskowski1af47932018-11-12 10:20:46 -0800556} // namespace android