Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 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 | #ifndef ANDROID_SF_HWCOMPOSER_H |
| 18 | #define ANDROID_SF_HWCOMPOSER_H |
| 19 | |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 20 | #include <cstdint> |
Dominik Laskowski | 5690bde | 2020-04-23 19:04:22 -0700 | [diff] [blame] | 21 | #include <future> |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 22 | #include <memory> |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 23 | #include <mutex> |
Steven Thomas | 6e8f706 | 2017-11-22 14:15:29 -0800 | [diff] [blame] | 24 | #include <optional> |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 25 | #include <unordered_map> |
| 26 | #include <unordered_set> |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 27 | #include <vector> |
| 28 | |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 29 | #include <android-base/thread_annotations.h> |
| 30 | #include <ui/Fence.h> |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 31 | |
| 32 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 33 | #pragma clang diagnostic push |
| 34 | #pragma clang diagnostic ignored "-Wconversion" |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 35 | #include <ui/GraphicTypes.h> |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame] | 36 | #pragma clang diagnostic pop |
| 37 | |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 38 | #include <utils/StrongPointer.h> |
| 39 | #include <utils/Timers.h> |
| 40 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 41 | #include "DisplayIdGenerator.h" |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 42 | #include "DisplayIdentification.h" |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 43 | #include "HWC2.h" |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 44 | #include "Hal.h" |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 45 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 46 | namespace android { |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 47 | |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 48 | namespace hal = hardware::graphics::composer::hal; |
| 49 | |
Kevin DuBois | 1d4249a | 2018-08-29 10:45:14 -0700 | [diff] [blame] | 50 | struct DisplayedFrameStats; |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 51 | class GraphicBuffer; |
Lloyd Pique | e39cad2 | 2017-12-20 17:01:29 -0800 | [diff] [blame] | 52 | class TestableSurfaceFlinger; |
David Sodman | fb95bcc | 2017-12-22 15:45:30 -0800 | [diff] [blame] | 53 | struct CompositionInfo; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 54 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 55 | namespace Hwc2 { |
| 56 | class Composer; |
| 57 | } // namespace Hwc2 |
| 58 | |
Lloyd Pique | 37c2c9b | 2018-12-04 17:25:10 -0800 | [diff] [blame] | 59 | namespace compositionengine { |
| 60 | class Output; |
| 61 | } // namespace compositionengine |
| 62 | |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 63 | struct KnownHWCGenericLayerMetadata { |
| 64 | const char* name; |
| 65 | const uint32_t id; |
| 66 | }; |
| 67 | |
Marin Shalamanov | 1c43429 | 2020-06-12 01:47:29 +0200 | [diff] [blame] | 68 | // See the comment for SurfaceFlinger::getHwComposer for the thread safety rules for accessing |
| 69 | // this class. |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 70 | class HWComposer { |
| 71 | public: |
Peiyong Lin | dfc3f7c | 2020-05-07 20:15:50 -0700 | [diff] [blame] | 72 | struct DeviceRequestedChanges { |
| 73 | using ChangedTypes = std::unordered_map<HWC2::Layer*, hal::Composition>; |
| 74 | using ClientTargetProperty = hal::ClientTargetProperty; |
| 75 | using DisplayRequests = hal::DisplayRequest; |
| 76 | using LayerRequests = std::unordered_map<HWC2::Layer*, hal::LayerRequest>; |
| 77 | |
| 78 | ChangedTypes changedTypes; |
| 79 | DisplayRequests displayRequests; |
| 80 | LayerRequests layerRequests; |
| 81 | ClientTargetProperty clientTargetProperty; |
| 82 | }; |
| 83 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 84 | virtual ~HWComposer(); |
| 85 | |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 86 | virtual void setConfiguration(HWC2::ComposerCallback* callback, int32_t sequenceId) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 87 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 88 | virtual bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 89 | DisplayIdentificationData* outData) const = 0; |
| 90 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 91 | virtual bool hasCapability(hal::Capability) const = 0; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 92 | virtual bool hasDisplayCapability(HalDisplayId, hal::DisplayCapability) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 93 | |
| 94 | // Attempts to allocate a virtual display and returns its ID if created on the HWC device. |
| 95 | virtual std::optional<DisplayId> allocateVirtualDisplay(uint32_t width, uint32_t height, |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 96 | ui::PixelFormat*) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 97 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 98 | virtual void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) = 0; |
Marin Shalamanov | bdd5915 | 2020-02-14 15:30:06 +0100 | [diff] [blame] | 99 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 100 | // Attempts to create a new layer on this display |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 101 | virtual HWC2::Layer* createLayer(HalDisplayId) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 102 | // Destroy a previously created layer |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 103 | virtual void destroyLayer(HalDisplayId, HWC2::Layer*) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 104 | |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 105 | // Gets any required composition change requests from the HWC device. |
| 106 | // |
| 107 | // Note that frameUsesClientComposition must be set correctly based on |
| 108 | // whether the current frame appears to use client composition. If it is |
| 109 | // false some internal optimizations are allowed to present the display |
| 110 | // with fewer handshakes, but this does not work if client composition is |
| 111 | // expected. |
| 112 | virtual status_t getDeviceCompositionChanges( |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 113 | HalDisplayId, bool frameUsesClientComposition, |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 114 | std::optional<DeviceRequestedChanges>* outChanges) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 115 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 116 | virtual status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence, |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 117 | const sp<GraphicBuffer>& target, ui::Dataspace) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 118 | |
| 119 | // Present layers to the display and read releaseFences. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 120 | virtual status_t presentAndGetReleaseFences(HalDisplayId) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 121 | |
| 122 | // set power mode |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 123 | virtual status_t setPowerMode(PhysicalDisplayId, hal::PowerMode) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 124 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 125 | // Sets a color transform to be applied to the result of composition |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 126 | virtual status_t setColorTransform(HalDisplayId, const mat4& transform) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 127 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 128 | // reset state when a display is disconnected |
| 129 | virtual void disconnectDisplay(HalDisplayId) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 130 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 131 | // get the present fence received from the last call to present. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 132 | virtual sp<Fence> getPresentFence(HalDisplayId) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 133 | |
| 134 | // Get last release fence for the given layer |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 135 | virtual sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 136 | |
| 137 | // Set the output buffer and acquire fence for a virtual display. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 138 | virtual status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 139 | const sp<GraphicBuffer>& buffer) = 0; |
| 140 | |
| 141 | // After SurfaceFlinger has retrieved the release fences for all the frames, |
| 142 | // it can call this to clear the shared pointers in the release fence map |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 143 | virtual void clearReleaseFences(HalDisplayId) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 144 | |
| 145 | // Fetches the HDR capabilities of the given display |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 146 | virtual status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 147 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 148 | virtual int32_t getSupportedPerFrameMetadata(HalDisplayId) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 149 | |
| 150 | // Returns the available RenderIntent of the given display. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 151 | virtual std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 152 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 153 | virtual mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 154 | |
| 155 | // Returns the attributes of the color sampling engine. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 156 | virtual status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 157 | ui::Dataspace* outDataspace, |
| 158 | uint8_t* outComponentMask) = 0; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 159 | virtual status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 160 | uint8_t componentMask, |
| 161 | uint64_t maxFrames) = 0; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 162 | virtual status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 163 | DisplayedFrameStats* outStats) = 0; |
| 164 | |
Dan Gittik | 57e63c5 | 2019-01-18 16:37:54 +0000 | [diff] [blame] | 165 | // Sets the brightness of a display. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 166 | virtual std::future<status_t> setDisplayBrightness(PhysicalDisplayId, float brightness) = 0; |
Dan Gittik | 57e63c5 | 2019-01-18 16:37:54 +0000 | [diff] [blame] | 167 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 168 | // Events handling --------------------------------------------------------- |
| 169 | |
| 170 | // Returns stable display ID (and display name on connection of new or previously disconnected |
| 171 | // display), or std::nullopt if hotplug event was ignored. |
Marin Shalamanov | bdd5915 | 2020-02-14 15:30:06 +0100 | [diff] [blame] | 172 | // This function is called from SurfaceFlinger. |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 173 | virtual std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, |
| 174 | hal::Connection) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 175 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 176 | virtual bool onVsync(hal::HWDisplayId, int64_t timestamp) = 0; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 177 | virtual void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 178 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 179 | virtual nsecs_t getRefreshTimestamp(PhysicalDisplayId) const = 0; |
| 180 | virtual bool isConnected(PhysicalDisplayId) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 181 | |
| 182 | // Non-const because it can update configMap inside of mDisplayData |
| 183 | virtual std::vector<std::shared_ptr<const HWC2::Display::Config>> getConfigs( |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 184 | PhysicalDisplayId) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 185 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 186 | virtual std::shared_ptr<const HWC2::Display::Config> getActiveConfig( |
| 187 | PhysicalDisplayId) const = 0; |
| 188 | virtual int getActiveConfigIndex(PhysicalDisplayId) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 189 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 190 | virtual std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 191 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 192 | virtual status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode mode, |
| 193 | ui::RenderIntent) = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 194 | |
Ady Abraham | 3a77a7b | 2019-12-02 18:46:59 -0800 | [diff] [blame] | 195 | // Composer 2.4 |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 196 | virtual DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const = 0; |
| 197 | virtual bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const = 0; |
| 198 | virtual nsecs_t getDisplayVsyncPeriod(PhysicalDisplayId) const = 0; |
Ady Abraham | 3a77a7b | 2019-12-02 18:46:59 -0800 | [diff] [blame] | 199 | virtual status_t setActiveConfigWithConstraints( |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 200 | PhysicalDisplayId, size_t configId, const hal::VsyncPeriodChangeConstraints&, |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 201 | hal::VsyncPeriodChangeTimeline* outTimeline) = 0; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 202 | virtual status_t setAutoLowLatencyMode(PhysicalDisplayId, bool on) = 0; |
Galia Peycheva | 5492cb5 | 2019-10-30 14:13:16 +0100 | [diff] [blame] | 203 | virtual status_t getSupportedContentTypes( |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 204 | PhysicalDisplayId, std::vector<hal::ContentType>* outSupportedContentTypes) = 0; |
| 205 | virtual status_t setContentType(PhysicalDisplayId, hal::ContentType) = 0; |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 206 | virtual const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata() |
| 207 | const = 0; |
Ady Abraham | 3a77a7b | 2019-12-02 18:46:59 -0800 | [diff] [blame] | 208 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 209 | // for debugging ---------------------------------------------------------- |
| 210 | virtual void dump(std::string& out) const = 0; |
| 211 | |
| 212 | virtual Hwc2::Composer* getComposer() const = 0; |
| 213 | |
| 214 | // TODO(b/74619554): Remove special cases for internal/external display. |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 215 | virtual std::optional<hal::HWDisplayId> getInternalHwcDisplayId() const = 0; |
| 216 | virtual std::optional<hal::HWDisplayId> getExternalHwcDisplayId() const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 217 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 218 | virtual std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const = 0; |
| 219 | virtual std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const = 0; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | namespace impl { |
| 223 | |
| 224 | class HWComposer final : public android::HWComposer { |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 225 | public: |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 226 | explicit HWComposer(std::unique_ptr<Hwc2::Composer> composer); |
Peiyong Lin | bdd08cc | 2019-12-17 21:35:14 -0800 | [diff] [blame] | 227 | explicit HWComposer(const std::string& composerServiceName); |
Mathias Agopian | 8b736f1 | 2012-08-13 17:54:26 -0700 | [diff] [blame] | 228 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 229 | ~HWComposer() override; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 230 | |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 231 | void setConfiguration(HWC2::ComposerCallback* callback, int32_t sequenceId) override; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 232 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 233 | bool getDisplayIdentificationData(hal::HWDisplayId, uint8_t* outPort, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 234 | DisplayIdentificationData* outData) const override; |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 235 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 236 | bool hasCapability(hal::Capability) const override; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 237 | bool hasDisplayCapability(HalDisplayId, hal::DisplayCapability) const override; |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 238 | |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 239 | // Attempts to allocate a virtual display and returns its ID if created on the HWC device. |
| 240 | std::optional<DisplayId> allocateVirtualDisplay(uint32_t width, uint32_t height, |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 241 | ui::PixelFormat*) override; |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 242 | |
Marin Shalamanov | bdd5915 | 2020-02-14 15:30:06 +0100 | [diff] [blame] | 243 | // Called from SurfaceFlinger, when the state for a new physical display needs to be recreated. |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 244 | void allocatePhysicalDisplay(hal::HWDisplayId, PhysicalDisplayId) override; |
Marin Shalamanov | bdd5915 | 2020-02-14 15:30:06 +0100 | [diff] [blame] | 245 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 246 | // Attempts to create a new layer on this display |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 247 | HWC2::Layer* createLayer(HalDisplayId) override; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 248 | // Destroy a previously created layer |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 249 | void destroyLayer(HalDisplayId, HWC2::Layer*) override; |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 250 | |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 251 | status_t getDeviceCompositionChanges( |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 252 | HalDisplayId, bool frameUsesClientComposition, |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 253 | std::optional<DeviceRequestedChanges>* outChanges) override; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 254 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 255 | status_t setClientTarget(HalDisplayId, uint32_t slot, const sp<Fence>& acquireFence, |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 256 | const sp<GraphicBuffer>& target, ui::Dataspace) override; |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 257 | |
Fabien Sanglard | a87aa7b | 2016-11-30 16:27:22 -0800 | [diff] [blame] | 258 | // Present layers to the display and read releaseFences. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 259 | status_t presentAndGetReleaseFences(HalDisplayId) override; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 260 | |
Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 261 | // set power mode |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 262 | status_t setPowerMode(PhysicalDisplayId, hal::PowerMode mode) override; |
Colin Cross | 10fbdb6 | 2012-07-12 17:56:34 -0700 | [diff] [blame] | 263 | |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 264 | // Sets a color transform to be applied to the result of composition |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 265 | status_t setColorTransform(HalDisplayId, const mat4& transform) override; |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 266 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 267 | // reset state when a display is disconnected |
| 268 | void disconnectDisplay(HalDisplayId) override; |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 269 | |
Fabien Sanglard | 11d0fc3 | 2016-12-01 15:43:01 -0800 | [diff] [blame] | 270 | // get the present fence received from the last call to present. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 271 | sp<Fence> getPresentFence(HalDisplayId) const override; |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 272 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 273 | // Get last release fence for the given layer |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 274 | sp<Fence> getLayerReleaseFence(HalDisplayId, HWC2::Layer*) const override; |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 275 | |
Jesse Hall | 851cfe8 | 2013-03-20 13:44:00 -0700 | [diff] [blame] | 276 | // Set the output buffer and acquire fence for a virtual display. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 277 | status_t setOutputBuffer(HalVirtualDisplayId, const sp<Fence>& acquireFence, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 278 | const sp<GraphicBuffer>& buffer) override; |
Jesse Hall | 851cfe8 | 2013-03-20 13:44:00 -0700 | [diff] [blame] | 279 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 280 | // After SurfaceFlinger has retrieved the release fences for all the frames, |
| 281 | // it can call this to clear the shared pointers in the release fence map |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 282 | void clearReleaseFences(HalDisplayId) override; |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 283 | |
Peiyong Lin | 6266589 | 2018-04-16 11:07:44 -0700 | [diff] [blame] | 284 | // Fetches the HDR capabilities of the given display |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 285 | status_t getHdrCapabilities(HalDisplayId, HdrCapabilities* outCapabilities) override; |
Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 286 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 287 | int32_t getSupportedPerFrameMetadata(HalDisplayId) const override; |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 288 | |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 289 | // Returns the available RenderIntent of the given display. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 290 | std::vector<ui::RenderIntent> getRenderIntents(HalDisplayId, ui::ColorMode) const override; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 291 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 292 | mat4 getDataspaceSaturationMatrix(HalDisplayId, ui::Dataspace) override; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 293 | |
Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 294 | // Returns the attributes of the color sampling engine. |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 295 | status_t getDisplayedContentSamplingAttributes(HalDisplayId, ui::PixelFormat* outFormat, |
Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 296 | ui::Dataspace* outDataspace, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 297 | uint8_t* outComponentMask) override; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 298 | status_t setDisplayContentSamplingEnabled(HalDisplayId, bool enabled, uint8_t componentMask, |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 299 | uint64_t maxFrames) override; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 300 | status_t getDisplayedContentSample(HalDisplayId, uint64_t maxFrames, uint64_t timestamp, |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 301 | DisplayedFrameStats* outStats) override; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 302 | std::future<status_t> setDisplayBrightness(PhysicalDisplayId, float brightness) override; |
Kevin DuBois | 9c0a176 | 2018-10-16 13:32:31 -0700 | [diff] [blame] | 303 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 304 | // Events handling --------------------------------------------------------- |
| 305 | |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 306 | // Returns stable display ID (and display name on connection of new or previously disconnected |
| 307 | // display), or std::nullopt if hotplug event was ignored. |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 308 | std::optional<DisplayIdentificationInfo> onHotplug(hal::HWDisplayId, hal::Connection) override; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 309 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 310 | bool onVsync(hal::HWDisplayId, int64_t timestamp) override; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 311 | void setVsyncEnabled(PhysicalDisplayId, hal::Vsync enabled) override; |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 312 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 313 | nsecs_t getRefreshTimestamp(PhysicalDisplayId) const override; |
| 314 | bool isConnected(PhysicalDisplayId) const override; |
Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 315 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 316 | // Non-const because it can update configMap inside of mDisplayData |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 317 | std::vector<std::shared_ptr<const HWC2::Display::Config>> getConfigs( |
| 318 | PhysicalDisplayId) const override; |
Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 319 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 320 | std::shared_ptr<const HWC2::Display::Config> getActiveConfig(PhysicalDisplayId) const override; |
| 321 | int getActiveConfigIndex(PhysicalDisplayId) const override; |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 322 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 323 | std::vector<ui::ColorMode> getColorModes(PhysicalDisplayId) const override; |
Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 324 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 325 | status_t setActiveColorMode(PhysicalDisplayId, ui::ColorMode, ui::RenderIntent) override; |
Courtney Goeltzenleuchter | fad9d8c | 2016-06-23 11:49:50 -0600 | [diff] [blame] | 326 | |
Ady Abraham | 3a77a7b | 2019-12-02 18:46:59 -0800 | [diff] [blame] | 327 | // Composer 2.4 |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 328 | DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const override; |
| 329 | bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const override; |
| 330 | nsecs_t getDisplayVsyncPeriod(PhysicalDisplayId) const override; |
| 331 | status_t setActiveConfigWithConstraints(PhysicalDisplayId, size_t configId, |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 332 | const hal::VsyncPeriodChangeConstraints&, |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 333 | hal::VsyncPeriodChangeTimeline* outTimeline) override; |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 334 | status_t setAutoLowLatencyMode(PhysicalDisplayId, bool) override; |
| 335 | status_t getSupportedContentTypes(PhysicalDisplayId, std::vector<hal::ContentType>*) override; |
| 336 | status_t setContentType(PhysicalDisplayId, hal::ContentType) override; |
Ady Abraham | 3a77a7b | 2019-12-02 18:46:59 -0800 | [diff] [blame] | 337 | |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 338 | const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata() const override; |
| 339 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 340 | // for debugging ---------------------------------------------------------- |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 341 | void dump(std::string& out) const override; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 342 | |
Peiyong Lin | bdd08cc | 2019-12-17 21:35:14 -0800 | [diff] [blame] | 343 | Hwc2::Composer* getComposer() const override { return mComposer.get(); } |
Steven Thomas | 6e8f706 | 2017-11-22 14:15:29 -0800 | [diff] [blame] | 344 | |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 345 | // TODO(b/74619554): Remove special cases for internal/external display. |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 346 | std::optional<hal::HWDisplayId> getInternalHwcDisplayId() const override { |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 347 | return mInternalHwcDisplayId; |
| 348 | } |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 349 | std::optional<hal::HWDisplayId> getExternalHwcDisplayId() const override { |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 350 | return mExternalHwcDisplayId; |
| 351 | } |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 352 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 353 | std::optional<PhysicalDisplayId> toPhysicalDisplayId(hal::HWDisplayId) const override; |
| 354 | std::optional<hal::HWDisplayId> fromPhysicalDisplayId(PhysicalDisplayId) const override; |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 355 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 356 | private: |
Lloyd Pique | e39cad2 | 2017-12-20 17:01:29 -0800 | [diff] [blame] | 357 | // For unit tests |
| 358 | friend TestableSurfaceFlinger; |
| 359 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 360 | std::optional<DisplayIdentificationInfo> onHotplugConnect(hal::HWDisplayId); |
| 361 | std::optional<DisplayIdentificationInfo> onHotplugDisconnect(hal::HWDisplayId); |
| 362 | bool shouldIgnoreHotplugConnect(hal::HWDisplayId, bool hasDisplayIdentificationData) const; |
Marin Shalamanov | bdd5915 | 2020-02-14 15:30:06 +0100 | [diff] [blame] | 363 | |
Peiyong Lin | bdd08cc | 2019-12-17 21:35:14 -0800 | [diff] [blame] | 364 | void loadCapabilities(); |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 365 | void loadLayerMetadataSupport(); |
Peiyong Lin | bdd08cc | 2019-12-17 21:35:14 -0800 | [diff] [blame] | 366 | uint32_t getMaxVirtualDisplayCount() const; |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 367 | |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 368 | struct DisplayData { |
Dominik Laskowski | c1f18f6 | 2018-06-13 15:17:55 -0700 | [diff] [blame] | 369 | bool isVirtual = false; |
Peiyong Lin | bdd08cc | 2019-12-17 21:35:14 -0800 | [diff] [blame] | 370 | std::unique_ptr<HWC2::Display> hwcDisplay; |
Dominik Laskowski | f9750f2 | 2018-06-06 12:24:53 -0700 | [diff] [blame] | 371 | sp<Fence> lastPresentFence = Fence::NO_FENCE; // signals when the last set op retires |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 372 | std::unordered_map<HWC2::Layer*, sp<Fence>> releaseFences; |
Dominik Laskowski | f9750f2 | 2018-06-06 12:24:53 -0700 | [diff] [blame] | 373 | buffer_handle_t outbufHandle = nullptr; |
| 374 | sp<Fence> outbufAcquireFence = Fence::NO_FENCE; |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 375 | mutable std::unordered_map<int32_t, |
| 376 | std::shared_ptr<const HWC2::Display::Config>> configMap; |
Jamie Gennis | 2ec3e07 | 2012-11-11 16:24:33 -0800 | [diff] [blame] | 377 | |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 378 | bool validateWasSkipped; |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 379 | hal::Error presentError; |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 380 | |
| 381 | bool vsyncTraceToggle = false; |
| 382 | |
| 383 | std::mutex vsyncEnabledLock; |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 384 | hal::Vsync vsyncEnabled GUARDED_BY(vsyncEnabledLock) = hal::Vsync::DISABLE; |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 385 | |
| 386 | mutable std::mutex lastHwVsyncLock; |
| 387 | nsecs_t lastHwVsync GUARDED_BY(lastHwVsyncLock) = 0; |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 388 | }; |
| 389 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 390 | std::unordered_map<HalDisplayId, DisplayData> mDisplayData; |
Dominik Laskowski | b04f98a | 2018-11-07 21:07:16 -0800 | [diff] [blame] | 391 | |
Peiyong Lin | bdd08cc | 2019-12-17 21:35:14 -0800 | [diff] [blame] | 392 | std::unique_ptr<android::Hwc2::Composer> mComposer; |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 393 | std::unordered_set<hal::Capability> mCapabilities; |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 394 | std::unordered_map<std::string, bool> mSupportedLayerGenericMetadata; |
Peiyong Lin | bdd08cc | 2019-12-17 21:35:14 -0800 | [diff] [blame] | 395 | bool mRegisteredCallback = false; |
Dominik Laskowski | b04f98a | 2018-11-07 21:07:16 -0800 | [diff] [blame] | 396 | |
Marin Shalamanov | a524a09 | 2020-07-27 21:39:55 +0200 | [diff] [blame] | 397 | std::unordered_map<hal::HWDisplayId, PhysicalDisplayId> mPhysicalDisplayIdMap; |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 398 | std::optional<hal::HWDisplayId> mInternalHwcDisplayId; |
| 399 | std::optional<hal::HWDisplayId> mExternalHwcDisplayId; |
Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 400 | bool mHasMultiDisplaySupport = false; |
| 401 | |
Marin Shalamanov | 0f10d0d | 2020-08-06 20:04:06 +0200 | [diff] [blame^] | 402 | RandomDisplayIdGenerator<HalVirtualDisplayId> mVirtualIdGenerator{getMaxVirtualDisplayCount()}; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 403 | }; |
| 404 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 405 | } // namespace impl |
Dominik Laskowski | 1af4793 | 2018-11-12 10:20:46 -0800 | [diff] [blame] | 406 | } // namespace android |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 407 | |
| 408 | #endif // ANDROID_SF_HWCOMPOSER_H |