Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 1 | #ifndef ANDROID_DVR_SERVICES_DISPLAYD_HARDWARE_COMPOSER_H_ |
| 2 | #define ANDROID_DVR_SERVICES_DISPLAYD_HARDWARE_COMPOSER_H_ |
| 3 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 4 | #include <ui/GraphicBuffer.h> |
| 5 | #include "DisplayHardware/ComposerHal.h" |
| 6 | #include "hwc_types.h" |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 7 | |
Okan Arikan | 822b710 | 2017-05-08 13:31:34 -0700 | [diff] [blame] | 8 | #include <dvr/dvr_shared_buffers.h> |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 9 | #include <hardware/gralloc.h> |
| 10 | #include <log/log.h> |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 11 | |
| 12 | #include <array> |
| 13 | #include <condition_variable> |
| 14 | #include <memory> |
| 15 | #include <mutex> |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 16 | #include <optional> |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 17 | #include <thread> |
| 18 | #include <tuple> |
| 19 | #include <vector> |
| 20 | |
Okan Arikan | 6f468c6 | 2017-05-31 14:48:30 -0700 | [diff] [blame] | 21 | #include <dvr/dvr_config.h> |
Okan Arikan | 822b710 | 2017-05-08 13:31:34 -0700 | [diff] [blame] | 22 | #include <dvr/dvr_vsync.h> |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 23 | #include <pdx/file_handle.h> |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 24 | #include <pdx/rpc/variant.h> |
Okan Arikan | 822b710 | 2017-05-08 13:31:34 -0700 | [diff] [blame] | 25 | #include <private/dvr/shared_buffer_helpers.h> |
Steven Thomas | dfde8fa | 2018-04-19 16:00:58 -0700 | [diff] [blame] | 26 | #include <private/dvr/vsync_service.h> |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 27 | |
mamik | 913cc13 | 2019-09-13 14:58:43 -0700 | [diff] [blame] | 28 | #include "DisplayHardware/DisplayIdentification.h" |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 29 | #include "acquired_buffer.h" |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 30 | #include "display_surface.h" |
| 31 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 32 | // Hardware composer HAL doesn't define HWC_TRANSFORM_NONE as of this writing. |
| 33 | #ifndef HWC_TRANSFORM_NONE |
| 34 | #define HWC_TRANSFORM_NONE static_cast<hwc_transform_t>(0) |
| 35 | #endif |
| 36 | |
| 37 | namespace android { |
| 38 | namespace dvr { |
| 39 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 40 | // Basic display metrics for physical displays. |
| 41 | struct DisplayParams { |
| 42 | hwc2_display_t id; |
| 43 | bool is_primary; |
| 44 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 45 | int width; |
| 46 | int height; |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 47 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 48 | struct { |
| 49 | int x; |
| 50 | int y; |
| 51 | } dpi; |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 52 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 53 | int vsync_period_ns; |
| 54 | }; |
| 55 | |
| 56 | // Layer represents the connection between a hardware composer layer and the |
| 57 | // source supplying buffers for the layer's contents. |
| 58 | class Layer { |
| 59 | public: |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 60 | Layer() = default; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 61 | |
| 62 | // Sets up the layer to use a display surface as its content source. The Layer |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 63 | // automatically handles ACQUIRE/RELEASE phases for the surface's buffer train |
| 64 | // every frame. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 65 | // |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 66 | // |composer| The composer instance. |
| 67 | // |display_params| Info about the display to use. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 68 | // |blending| receives HWC_BLENDING_* values. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 69 | // |composition_type| receives either HWC_FRAMEBUFFER for most layers or |
| 70 | // HWC_FRAMEBUFFER_TARGET (unless you know what you are doing). |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 71 | // |index| is the index of this surface in the DirectDisplaySurface array. |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 72 | Layer(Hwc2::Composer* composer, const DisplayParams& display_params, |
| 73 | const std::shared_ptr<DirectDisplaySurface>& surface, |
| 74 | HWC::BlendMode blending, HWC::Composition composition_type, |
| 75 | size_t z_order); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 76 | |
| 77 | // Sets up the layer to use a direct buffer as its content source. No special |
| 78 | // handling of the buffer is performed; responsibility for updating or |
| 79 | // changing the buffer each frame is on the caller. |
| 80 | // |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 81 | // |composer| The composer instance. |
| 82 | // |display_params| Info about the display to use. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 83 | // |blending| receives HWC_BLENDING_* values. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 84 | // |composition_type| receives either HWC_FRAMEBUFFER for most layers or |
| 85 | // HWC_FRAMEBUFFER_TARGET (unless you know what you are doing). |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 86 | Layer(Hwc2::Composer* composer, const DisplayParams& display_params, |
| 87 | const std::shared_ptr<IonBuffer>& buffer, HWC::BlendMode blending, |
| 88 | HWC::Composition composition_type, size_t z_order); |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 89 | |
Chih-Hung Hsieh | 5bc849f | 2018-09-25 14:21:50 -0700 | [diff] [blame] | 90 | Layer(Layer&&) noexcept; |
| 91 | Layer& operator=(Layer&&) noexcept; |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 92 | |
| 93 | ~Layer(); |
| 94 | |
| 95 | // Releases any shared pointers and fence handles held by this instance. |
| 96 | void Reset(); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 97 | |
| 98 | // Layers that use a direct IonBuffer should call this each frame to update |
| 99 | // which buffer will be used for the next PostLayers. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 100 | void UpdateBuffer(const std::shared_ptr<IonBuffer>& buffer); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 101 | |
| 102 | // Sets up the hardware composer layer for the next frame. When the layer is |
| 103 | // associated with a display surface, this method automatically ACQUIRES a new |
| 104 | // buffer if one is available. |
| 105 | void Prepare(); |
| 106 | |
| 107 | // After calling prepare, if this frame is to be dropped instead of passing |
| 108 | // along to the HWC, call Drop to close the contained fence(s). |
| 109 | void Drop(); |
| 110 | |
| 111 | // Performs fence bookkeeping after the frame has been posted to hardware |
| 112 | // composer. |
| 113 | void Finish(int release_fence_fd); |
| 114 | |
| 115 | // Sets the blending for the layer. |blending| receives HWC_BLENDING_* values. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 116 | void SetBlending(HWC::BlendMode blending); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 117 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 118 | // Sets the z-order of this layer |
| 119 | void SetZOrder(size_t z_order); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 120 | |
| 121 | // Gets the current IonBuffer associated with this layer. Ownership of the |
| 122 | // buffer DOES NOT pass to the caller and the pointer is not guaranteed to |
| 123 | // remain valid across calls to Layer::Setup(), Layer::Prepare(), or |
| 124 | // Layer::Reset(). YOU HAVE BEEN WARNED. |
| 125 | IonBuffer* GetBuffer(); |
| 126 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 127 | HWC::Composition GetCompositionType() const { return composition_type_; } |
| 128 | HWC::Layer GetLayerHandle() const { return hardware_composer_layer_; } |
| 129 | bool IsLayerSetup() const { return !source_.empty(); } |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 130 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 131 | int GetSurfaceId() const { |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 132 | int surface_id = -1; |
| 133 | pdx::rpc::IfAnyOf<SourceSurface>::Call( |
| 134 | &source_, [&surface_id](const SourceSurface& surface_source) { |
Corey Tabaka | 0b485c9 | 2017-05-19 12:02:58 -0700 | [diff] [blame] | 135 | surface_id = surface_source.GetSurfaceId(); |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 136 | }); |
| 137 | return surface_id; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 138 | } |
| 139 | |
Corey Tabaka | 0b485c9 | 2017-05-19 12:02:58 -0700 | [diff] [blame] | 140 | int GetBufferId() const { |
| 141 | int buffer_id = -1; |
| 142 | pdx::rpc::IfAnyOf<SourceSurface>::Call( |
| 143 | &source_, [&buffer_id](const SourceSurface& surface_source) { |
| 144 | buffer_id = surface_source.GetBufferId(); |
| 145 | }); |
| 146 | return buffer_id; |
| 147 | } |
| 148 | |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 149 | // Compares Layers by surface id. |
| 150 | bool operator<(const Layer& other) const { |
| 151 | return GetSurfaceId() < other.GetSurfaceId(); |
| 152 | } |
Corey Tabaka | b3732f0 | 2017-09-16 00:58:54 -0700 | [diff] [blame] | 153 | bool operator<(int surface_id) const { return GetSurfaceId() < surface_id; } |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 154 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 155 | void IgnoreBadDisplayErrorsOnDestroy(bool ignore) { |
| 156 | ignore_bad_display_errors_on_destroy_ = ignore; |
Steven Thomas | 6e8f706 | 2017-11-22 14:15:29 -0800 | [diff] [blame] | 157 | } |
| 158 | |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 159 | private: |
| 160 | void CommonLayerSetup(); |
| 161 | |
| 162 | // Applies all of the settings to this layer using the hwc functions |
| 163 | void UpdateLayerSettings(); |
| 164 | |
| 165 | // Applies visibility settings that may have changed. |
| 166 | void UpdateVisibilitySettings(); |
| 167 | |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 168 | // Checks whether the buffer, given by id, is associated with the given slot |
| 169 | // in the HWC buffer cache. If the slot is not associated with the given |
| 170 | // buffer the cache is updated to establish the association and the buffer |
| 171 | // should be sent to HWC using setLayerBuffer. Returns true if the association |
| 172 | // was already established, false if not. A buffer_id of -1 is never |
| 173 | // associated and always returns false. |
| 174 | bool CheckAndUpdateCachedBuffer(std::size_t slot, int buffer_id); |
| 175 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 176 | // Composer instance. |
| 177 | Hwc2::Composer* composer_ = nullptr; |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 178 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 179 | // Parameters of the display to use for this layer. |
| 180 | DisplayParams display_params_; |
Steven Thomas | 6e8f706 | 2017-11-22 14:15:29 -0800 | [diff] [blame] | 181 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 182 | // The hardware composer layer and metrics to use during the prepare cycle. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 183 | hwc2_layer_t hardware_composer_layer_ = 0; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 184 | |
| 185 | // Layer properties used to setup the hardware composer layer during the |
| 186 | // Prepare phase. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 187 | size_t z_order_ = 0; |
| 188 | HWC::BlendMode blending_ = HWC::BlendMode::None; |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 189 | HWC::Composition composition_type_ = HWC::Composition::Invalid; |
| 190 | HWC::Composition target_composition_type_ = HWC::Composition::Device; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 191 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 192 | // State when the layer is connected to a surface. Provides the same interface |
| 193 | // as SourceBuffer to simplify internal use by Layer. |
| 194 | struct SourceSurface { |
| 195 | std::shared_ptr<DirectDisplaySurface> surface; |
| 196 | AcquiredBuffer acquired_buffer; |
| 197 | pdx::LocalHandle release_fence; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 198 | |
Chih-Hung Hsieh | 79e7f1b | 2018-12-20 15:53:43 -0800 | [diff] [blame] | 199 | explicit SourceSurface(const std::shared_ptr<DirectDisplaySurface>& surface) |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 200 | : surface(surface) {} |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 201 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 202 | // Attempts to acquire a new buffer from the surface and return a tuple with |
| 203 | // width, height, buffer handle, and fence. If a new buffer is not available |
| 204 | // the previous buffer is returned or an empty value if no buffer has ever |
| 205 | // been posted. When a new buffer is acquired the previous buffer's release |
| 206 | // fence is passed out automatically. |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 207 | std::tuple<int, int, int, sp<GraphicBuffer>, pdx::LocalHandle, std::size_t> |
| 208 | Acquire() { |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 209 | if (surface->IsBufferAvailable()) { |
| 210 | acquired_buffer.Release(std::move(release_fence)); |
| 211 | acquired_buffer = surface->AcquireCurrentBuffer(); |
| 212 | ATRACE_ASYNC_END("BufferPost", acquired_buffer.buffer()->id()); |
| 213 | } |
| 214 | if (!acquired_buffer.IsEmpty()) { |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 215 | return std::make_tuple( |
| 216 | acquired_buffer.buffer()->width(), |
| 217 | acquired_buffer.buffer()->height(), acquired_buffer.buffer()->id(), |
| 218 | acquired_buffer.buffer()->buffer()->buffer(), |
| 219 | acquired_buffer.ClaimAcquireFence(), acquired_buffer.slot()); |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 220 | } else { |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 221 | return std::make_tuple(0, 0, -1, nullptr, pdx::LocalHandle{}, 0); |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 222 | } |
| 223 | } |
| 224 | |
| 225 | void Finish(pdx::LocalHandle fence) { release_fence = std::move(fence); } |
| 226 | |
| 227 | // Gets a pointer to the current acquired buffer or returns nullptr if there |
| 228 | // isn't one. |
| 229 | IonBuffer* GetBuffer() { |
| 230 | if (acquired_buffer.IsAvailable()) |
| 231 | return acquired_buffer.buffer()->buffer(); |
| 232 | else |
| 233 | return nullptr; |
| 234 | } |
| 235 | |
| 236 | // Returns the surface id of the surface. |
Corey Tabaka | 0b485c9 | 2017-05-19 12:02:58 -0700 | [diff] [blame] | 237 | int GetSurfaceId() const { return surface->surface_id(); } |
| 238 | |
| 239 | // Returns the buffer id for the current buffer. |
| 240 | int GetBufferId() const { |
| 241 | if (acquired_buffer.IsAvailable()) |
| 242 | return acquired_buffer.buffer()->id(); |
| 243 | else |
| 244 | return -1; |
| 245 | } |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 246 | }; |
| 247 | |
| 248 | // State when the layer is connected to a buffer. Provides the same interface |
| 249 | // as SourceSurface to simplify internal use by Layer. |
| 250 | struct SourceBuffer { |
| 251 | std::shared_ptr<IonBuffer> buffer; |
| 252 | |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 253 | std::tuple<int, int, int, sp<GraphicBuffer>, pdx::LocalHandle, std::size_t> |
| 254 | Acquire() { |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 255 | if (buffer) |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 256 | return std::make_tuple(buffer->width(), buffer->height(), -1, |
| 257 | buffer->buffer(), pdx::LocalHandle{}, 0); |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 258 | else |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 259 | return std::make_tuple(0, 0, -1, nullptr, pdx::LocalHandle{}, 0); |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | void Finish(pdx::LocalHandle /*fence*/) {} |
| 263 | |
| 264 | IonBuffer* GetBuffer() { return buffer.get(); } |
| 265 | |
| 266 | int GetSurfaceId() const { return -1; } |
Corey Tabaka | 0b485c9 | 2017-05-19 12:02:58 -0700 | [diff] [blame] | 267 | int GetBufferId() const { return -1; } |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 268 | }; |
| 269 | |
| 270 | // The underlying hardware composer layer is supplied buffers either from a |
| 271 | // surface buffer train or from a buffer directly. |
| 272 | pdx::rpc::Variant<SourceSurface, SourceBuffer> source_; |
| 273 | |
| 274 | pdx::LocalHandle acquire_fence_; |
| 275 | bool surface_rect_functions_applied_ = false; |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 276 | bool pending_visibility_settings_ = true; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 277 | |
Corey Tabaka | 0d07cdd | 2017-09-28 11:15:50 -0700 | [diff] [blame] | 278 | // Map of buffer slot assignments that have already been established with HWC: |
| 279 | // slot -> buffer_id. When this map contains a matching slot and buffer_id the |
| 280 | // buffer argument to setLayerBuffer may be nullptr to avoid the cost of |
| 281 | // importing a buffer HWC already knows about. |
| 282 | std::map<std::size_t, int> cached_buffer_map_; |
| 283 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 284 | // When calling destroyLayer() on an external display that's been removed we |
| 285 | // typically get HWC2_ERROR_BAD_DISPLAY errors. If |
| 286 | // ignore_bad_display_errors_on_destroy_ is true, don't log the bad display |
| 287 | // errors, since they're expected. |
| 288 | bool ignore_bad_display_errors_on_destroy_ = false; |
| 289 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 290 | Layer(const Layer&) = delete; |
| 291 | void operator=(const Layer&) = delete; |
| 292 | }; |
| 293 | |
| 294 | // HardwareComposer encapsulates the hardware composer HAL, exposing a |
| 295 | // simplified API to post buffers to the display. |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 296 | // |
| 297 | // HardwareComposer is accessed by both the vr flinger dispatcher thread and the |
| 298 | // surface flinger main thread, in addition to internally running a separate |
| 299 | // thread for compositing/EDS and posting layers to the HAL. When changing how |
| 300 | // variables are used or adding new state think carefully about which threads |
| 301 | // will access the state and whether it needs to be synchronized. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 302 | class HardwareComposer { |
| 303 | public: |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 304 | using RequestDisplayCallback = std::function<void(bool)>; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 305 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 306 | HardwareComposer(); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 307 | ~HardwareComposer(); |
| 308 | |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 309 | bool Initialize(Hwc2::Composer* composer, |
Steven Thomas | 6e8f706 | 2017-11-22 14:15:29 -0800 | [diff] [blame] | 310 | hwc2_display_t primary_display_id, |
Steven Thomas | d7f49c5 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 311 | RequestDisplayCallback request_display_callback); |
Stephen Kiazyk | 016e5e3 | 2017-02-21 17:09:22 -0800 | [diff] [blame] | 312 | |
| 313 | bool IsInitialized() const { return initialized_; } |
| 314 | |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 315 | // Start the post thread if there's work to do (i.e. visible layers). This |
| 316 | // should only be called from surface flinger's main thread. |
| 317 | void Enable(); |
| 318 | // Pause the post thread, blocking until the post thread has signaled that |
| 319 | // it's paused. This should only be called from surface flinger's main thread. |
| 320 | void Disable(); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 321 | |
Steven Thomas | af33627 | 2018-01-04 17:36:47 -0800 | [diff] [blame] | 322 | // Called on a binder thread. |
| 323 | void OnBootFinished(); |
| 324 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 325 | std::string Dump(); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 326 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 327 | const DisplayParams& GetPrimaryDisplayParams() const { |
| 328 | return primary_display_; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 329 | } |
| 330 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 331 | // Sets the display surfaces to compose the hardware layer stack. |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 332 | void SetDisplaySurfaces( |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 333 | std::vector<std::shared_ptr<DirectDisplaySurface>> surfaces); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 334 | |
John Bates | 954796e | 2017-05-11 11:00:31 -0700 | [diff] [blame] | 335 | int OnNewGlobalBuffer(DvrGlobalBufferKey key, IonBuffer& ion_buffer); |
| 336 | void OnDeletedGlobalBuffer(DvrGlobalBufferKey key); |
| 337 | |
mamik | 913cc13 | 2019-09-13 14:58:43 -0700 | [diff] [blame] | 338 | // Gets the edid data for the current active display (internal or external) |
| 339 | DisplayIdentificationData GetCurrentDisplayIdentificationData() { |
| 340 | return display_identification_data_; |
| 341 | } |
| 342 | |
| 343 | // Gets the edid port for the current active display (internal or external) |
| 344 | uint8_t GetCurrentDisplayPort() { return display_port_; } |
| 345 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 346 | private: |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 347 | DisplayParams GetDisplayParams(Hwc2::Composer* composer, |
| 348 | hwc2_display_t display, bool is_primary); |
Steven Thomas | d7f49c5 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 349 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 350 | // Turn display vsync on/off. Returns true on success, false on failure. |
| 351 | bool EnableVsync(const DisplayParams& display, bool enabled); |
| 352 | // Turn display power on/off. Returns true on success, false on failure. |
| 353 | bool SetPowerMode(const DisplayParams& display, bool active); |
| 354 | // Convenience function to turn a display on/off. Turns both power and vsync |
| 355 | // on/off. Returns true on success, false on failure. |
| 356 | bool EnableDisplay(const DisplayParams& display, bool enabled); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 357 | |
Steven Thomas | dfde8fa | 2018-04-19 16:00:58 -0700 | [diff] [blame] | 358 | class VsyncService : public BnVsyncService { |
| 359 | public: |
| 360 | status_t registerCallback(const sp<IVsyncCallback> callback) override; |
| 361 | status_t unregisterCallback(const sp<IVsyncCallback> callback) override; |
| 362 | void OnVsync(int64_t vsync_timestamp); |
| 363 | private: |
| 364 | std::vector<sp<IVsyncCallback>>::const_iterator FindCallback( |
| 365 | const sp<IVsyncCallback>& callback) const; |
| 366 | std::mutex mutex_; |
| 367 | std::vector<sp<IVsyncCallback>> callbacks_; |
| 368 | }; |
| 369 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 370 | class ComposerCallback : public Hwc2::IComposerCallback { |
| 371 | public: |
Corey Tabaka | b3732f0 | 2017-09-16 00:58:54 -0700 | [diff] [blame] | 372 | ComposerCallback() = default; |
Steven Thomas | d7f49c5 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 373 | hardware::Return<void> onHotplug(Hwc2::Display display, |
| 374 | Connection conn) override; |
| 375 | hardware::Return<void> onRefresh(Hwc2::Display display) override; |
| 376 | hardware::Return<void> onVsync(Hwc2::Display display, |
| 377 | int64_t timestamp) override; |
Ady Abraham | 7159f57 | 2019-10-11 11:10:18 -0700 | [diff] [blame] | 378 | hardware::Return<void> onVsync_2_4( |
| 379 | Hwc2::Display display, int64_t timestamp, |
| 380 | Hwc2::VsyncPeriodNanos vsyncPeriodNanos) override; |
| 381 | hardware::Return<void> onVsyncPeriodTimingChanged( |
| 382 | Hwc2::Display display, |
| 383 | const Hwc2::VsyncPeriodChangeTimeline& updatedTimeline) override; |
Ady Abraham | b0433bc | 2020-01-08 17:31:06 -0800 | [diff] [blame] | 384 | hardware::Return<void> onSeamlessPossible(Hwc2::Display display) override; |
Corey Tabaka | b3732f0 | 2017-09-16 00:58:54 -0700 | [diff] [blame] | 385 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 386 | bool GotFirstHotplug() { return got_first_hotplug_; } |
Steven Thomas | dfde8fa | 2018-04-19 16:00:58 -0700 | [diff] [blame] | 387 | void SetVsyncService(const sp<VsyncService>& vsync_service); |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 388 | |
| 389 | struct Displays { |
| 390 | hwc2_display_t primary_display = 0; |
| 391 | std::optional<hwc2_display_t> external_display; |
| 392 | bool external_display_was_hotplugged = false; |
| 393 | }; |
| 394 | |
| 395 | Displays GetDisplays(); |
| 396 | pdx::Status<int64_t> GetVsyncTime(hwc2_display_t display); |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 397 | |
Steven Thomas | d7f49c5 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 398 | private: |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 399 | struct DisplayInfo { |
| 400 | hwc2_display_t id = 0; |
| 401 | pdx::LocalHandle driver_vsync_event_fd; |
| 402 | int64_t callback_vsync_timestamp{0}; |
| 403 | }; |
| 404 | |
| 405 | DisplayInfo* GetDisplayInfo(hwc2_display_t display); |
| 406 | |
| 407 | std::mutex mutex_; |
| 408 | |
| 409 | bool got_first_hotplug_ = false; |
| 410 | DisplayInfo primary_display_; |
| 411 | std::optional<DisplayInfo> external_display_; |
| 412 | bool external_display_was_hotplugged_ = false; |
Steven Thomas | dfde8fa | 2018-04-19 16:00:58 -0700 | [diff] [blame] | 413 | sp<VsyncService> vsync_service_; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 414 | }; |
| 415 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 416 | HWC::Error Validate(hwc2_display_t display); |
| 417 | HWC::Error Present(hwc2_display_t display); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 418 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 419 | void PostLayers(hwc2_display_t display); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 420 | void PostThread(); |
| 421 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 422 | // The post thread has two controlling states: |
| 423 | // 1. Idle: no work to do (no visible surfaces). |
| 424 | // 2. Suspended: explicitly halted (system is not in VR mode). |
| 425 | // When either #1 or #2 is true then the post thread is quiescent, otherwise |
| 426 | // it is active. |
| 427 | using PostThreadStateType = uint32_t; |
| 428 | struct PostThreadState { |
| 429 | enum : PostThreadStateType { |
| 430 | Active = 0, |
| 431 | Idle = (1 << 0), |
| 432 | Suspended = (1 << 1), |
| 433 | Quit = (1 << 2), |
| 434 | }; |
| 435 | }; |
| 436 | |
| 437 | void UpdatePostThreadState(uint32_t state, bool suspend); |
| 438 | |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 439 | // Blocks until either event_fd becomes readable, or we're interrupted by a |
Steven Thomas | d7f49c5 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 440 | // control thread, or timeout_ms is reached before any events occur. Any |
| 441 | // errors are returned as negative errno values, with -ETIMEDOUT returned in |
| 442 | // the case of a timeout. If we're interrupted, kPostThreadInterrupted will be |
| 443 | // returned. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 444 | int PostThreadPollInterruptible(const pdx::LocalHandle& event_fd, |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 445 | int requested_events, int timeout_ms); |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 446 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 447 | // WaitForPredictedVSync and SleepUntil are blocking calls made on the post |
| 448 | // thread that can be interrupted by a control thread. If interrupted, these |
| 449 | // calls return kPostThreadInterrupted. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 450 | int ReadWaitPPState(); |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 451 | pdx::Status<int64_t> WaitForPredictedVSync(); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 452 | int SleepUntil(int64_t wakeup_timestamp); |
| 453 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 454 | // Initialize any newly connected displays, and set target_display_ to the |
| 455 | // display we should render to. Returns true if target_display_ |
| 456 | // changed. Called only from the post thread. |
| 457 | bool UpdateTargetDisplay(); |
| 458 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 459 | // Reconfigures the layer stack if the display surfaces changed since the last |
| 460 | // frame. Called only from the post thread. |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 461 | void UpdateLayerConfig(); |
| 462 | |
| 463 | // Called on the post thread to create the Composer instance. |
| 464 | void CreateComposer(); |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 465 | |
| 466 | // Called on the post thread when the post thread is resumed. |
| 467 | void OnPostThreadResumed(); |
| 468 | // Called on the post thread when the post thread is paused or quits. |
| 469 | void OnPostThreadPaused(); |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 470 | |
Steven Thomas | af33627 | 2018-01-04 17:36:47 -0800 | [diff] [blame] | 471 | // Use post_thread_wait_ to wait for a specific condition, specified by pred. |
| 472 | // timeout_sec < 0 means wait indefinitely, otherwise it specifies the timeout |
| 473 | // in seconds. |
| 474 | // The lock must be held when this function is called. |
| 475 | // Returns true if the wait was interrupted because the post thread was asked |
| 476 | // to quit. |
| 477 | bool PostThreadCondWait(std::unique_lock<std::mutex>& lock, |
| 478 | int timeout_sec, |
| 479 | const std::function<bool()>& pred); |
| 480 | |
John Bates | 954796e | 2017-05-11 11:00:31 -0700 | [diff] [blame] | 481 | // Map the given shared memory buffer to our broadcast ring to track updates |
| 482 | // to the config parameters. |
| 483 | int MapConfigBuffer(IonBuffer& ion_buffer); |
| 484 | void ConfigBufferDeleted(); |
| 485 | // Poll for config udpates. |
| 486 | void UpdateConfigBuffer(); |
| 487 | |
Stephen Kiazyk | 016e5e3 | 2017-02-21 17:09:22 -0800 | [diff] [blame] | 488 | bool initialized_; |
Corey Tabaka | 7024b8f | 2017-08-22 11:59:15 -0700 | [diff] [blame] | 489 | bool is_standalone_device_; |
Stephen Kiazyk | 016e5e3 | 2017-02-21 17:09:22 -0800 | [diff] [blame] | 490 | |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 491 | std::unique_ptr<Hwc2::Composer> composer_; |
| 492 | sp<ComposerCallback> composer_callback_; |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 493 | RequestDisplayCallback request_display_callback_; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 494 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 495 | DisplayParams primary_display_; |
| 496 | std::optional<DisplayParams> external_display_; |
| 497 | DisplayParams* target_display_ = &primary_display_; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 498 | |
Steven Thomas | bfe46a0 | 2018-02-16 14:27:35 -0800 | [diff] [blame] | 499 | // The list of surfaces we should draw. Set by the display service when |
| 500 | // DirectSurfaces are added, removed, or change visibility. Written by the |
| 501 | // message dispatch thread and read by the post thread. |
| 502 | std::vector<std::shared_ptr<DirectDisplaySurface>> surfaces_; |
| 503 | // Set to true by the dispatch thread whenever surfaces_ changes. Set to false |
| 504 | // by the post thread when the new list of surfaces is processed. |
| 505 | bool surfaces_changed_ = false; |
| 506 | |
| 507 | std::vector<std::shared_ptr<DirectDisplaySurface>> current_surfaces_; |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 508 | |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 509 | // Layer set for handling buffer flow into hardware composer layers. This |
| 510 | // vector must be sorted by surface_id in ascending order. |
| 511 | std::vector<Layer> layers_; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 512 | |
Steven Thomas | 282a5ed | 2017-02-07 18:07:01 -0800 | [diff] [blame] | 513 | // The layer posting thread. This thread wakes up a short time before vsync to |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 514 | // hand buffers to hardware composer. |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 515 | std::thread post_thread_; |
| 516 | |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 517 | // Post thread state machine and synchronization primitives. |
Corey Tabaka | 2c4aea3 | 2017-08-31 20:01:15 -0700 | [diff] [blame] | 518 | PostThreadStateType post_thread_state_{PostThreadState::Idle | |
| 519 | PostThreadState::Suspended}; |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 520 | std::atomic<bool> post_thread_quiescent_{true}; |
| 521 | bool post_thread_resumed_{false}; |
| 522 | pdx::LocalHandle post_thread_event_fd_; |
| 523 | std::mutex post_thread_mutex_; |
| 524 | std::condition_variable post_thread_wait_; |
| 525 | std::condition_variable post_thread_ready_; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 526 | |
Steven Thomas | af33627 | 2018-01-04 17:36:47 -0800 | [diff] [blame] | 527 | // When boot is finished this will be set to true and the post thread will be |
| 528 | // notified via post_thread_wait_. |
| 529 | bool boot_finished_ = false; |
| 530 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 531 | // VSync sleep timerfd. |
| 532 | pdx::LocalHandle vsync_sleep_timer_fd_; |
| 533 | |
| 534 | // The timestamp of the last vsync. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 535 | int64_t last_vsync_timestamp_ = 0; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 536 | |
Corey Tabaka | b3732f0 | 2017-09-16 00:58:54 -0700 | [diff] [blame] | 537 | // The number of vsync intervals to predict since the last vsync. |
| 538 | int vsync_prediction_interval_ = 1; |
| 539 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 540 | // Vsync count since display on. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 541 | uint32_t vsync_count_ = 0; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 542 | |
| 543 | // Counter tracking the number of skipped frames. |
Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 544 | int frame_skip_count_ = 0; |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 545 | |
| 546 | // Fd array for tracking retire fences that are returned by hwc. This allows |
| 547 | // us to detect when the display driver begins queuing frames. |
| 548 | std::vector<pdx::LocalHandle> retire_fence_fds_; |
| 549 | |
Okan Arikan | 822b710 | 2017-05-08 13:31:34 -0700 | [diff] [blame] | 550 | // If we are publishing vsync data, we will put it here. |
| 551 | std::unique_ptr<CPUMappedBroadcastRing<DvrVsyncRing>> vsync_ring_; |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 552 | |
John Bates | 954796e | 2017-05-11 11:00:31 -0700 | [diff] [blame] | 553 | // Broadcast ring for receiving config data from the DisplayManager. |
Okan Arikan | 6f468c6 | 2017-05-31 14:48:30 -0700 | [diff] [blame] | 554 | DvrConfigRing shared_config_ring_; |
John Bates | 954796e | 2017-05-11 11:00:31 -0700 | [diff] [blame] | 555 | uint32_t shared_config_ring_sequence_{0}; |
| 556 | // Config buffer for reading from the post thread. |
Okan Arikan | 6f468c6 | 2017-05-31 14:48:30 -0700 | [diff] [blame] | 557 | DvrConfig post_thread_config_; |
John Bates | 954796e | 2017-05-11 11:00:31 -0700 | [diff] [blame] | 558 | std::mutex shared_config_mutex_; |
| 559 | |
Steven Thomas | dfde8fa | 2018-04-19 16:00:58 -0700 | [diff] [blame] | 560 | bool vsync_trace_parity_ = false; |
| 561 | sp<VsyncService> vsync_service_; |
| 562 | |
mamik | 913cc13 | 2019-09-13 14:58:43 -0700 | [diff] [blame] | 563 | // Edid section. |
| 564 | void UpdateEdidData(Hwc2::Composer* composer, hwc2_display_t hw_id); |
| 565 | DisplayIdentificationData display_identification_data_; |
| 566 | uint8_t display_port_; |
| 567 | |
Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 568 | static constexpr int kPostThreadInterrupted = 1; |
| 569 | |
Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 570 | HardwareComposer(const HardwareComposer&) = delete; |
| 571 | void operator=(const HardwareComposer&) = delete; |
| 572 | }; |
| 573 | |
| 574 | } // namespace dvr |
| 575 | } // namespace android |
| 576 | |
| 577 | #endif // ANDROID_DVR_SERVICES_DISPLAYD_HARDWARE_COMPOSER_H_ |