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 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 20 | #include "HWC2.h" |
| 21 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 22 | #include <stdint.h> |
| 23 | #include <sys/types.h> |
| 24 | |
Jamie Gennis | 2ec3e07 | 2012-11-11 16:24:33 -0800 | [diff] [blame] | 25 | #include <ui/Fence.h> |
Peiyong Lin | fd997e0 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 26 | #include <ui/GraphicTypes.h> |
Jamie Gennis | 2ec3e07 | 2012-11-11 16:24:33 -0800 | [diff] [blame] | 27 | #include <utils/BitSet.h> |
Mathias Agopian | 921e6ac | 2012-07-23 23:11:29 -0700 | [diff] [blame] | 28 | #include <utils/Condition.h> |
| 29 | #include <utils/Mutex.h> |
Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 30 | #include <utils/StrongPointer.h> |
Mathias Agopian | 921e6ac | 2012-07-23 23:11:29 -0700 | [diff] [blame] | 31 | #include <utils/Thread.h> |
| 32 | #include <utils/Timers.h> |
Mathias Agopian | 22da60c | 2011-09-09 00:49:11 -0700 | [diff] [blame] | 33 | #include <utils/Vector.h> |
Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 34 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 35 | #include <memory> |
Steven Thomas | 6e8f706 | 2017-11-22 14:15:29 -0800 | [diff] [blame] | 36 | #include <optional> |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 37 | #include <set> |
| 38 | #include <vector> |
| 39 | |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 40 | #include "DisplayIdentification.h" |
| 41 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 42 | extern "C" int clock_nanosleep(clockid_t clock_id, int flags, |
| 43 | const struct timespec *request, |
| 44 | struct timespec *remain); |
| 45 | |
Mathias Agopian | 8b736f1 | 2012-08-13 17:54:26 -0700 | [diff] [blame] | 46 | struct framebuffer_device_t; |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 47 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 48 | namespace HWC2 { |
| 49 | class Device; |
| 50 | class Display; |
| 51 | } |
| 52 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 53 | namespace android { |
| 54 | // --------------------------------------------------------------------------- |
| 55 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 56 | class DisplayDevice; |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 57 | class Fence; |
Mathias Agopian | 6b44267 | 2013-07-09 21:24:52 -0700 | [diff] [blame] | 58 | class FloatRect; |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 59 | class GraphicBuffer; |
| 60 | class NativeHandle; |
Jamie Gennis | 1a4d883 | 2012-08-02 20:11:05 -0700 | [diff] [blame] | 61 | class Region; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 62 | class String8; |
Lloyd Pique | e39cad2 | 2017-12-20 17:01:29 -0800 | [diff] [blame] | 63 | class TestableSurfaceFlinger; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 64 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 65 | namespace Hwc2 { |
| 66 | class Composer; |
| 67 | } // namespace Hwc2 |
| 68 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 69 | class HWComposer |
| 70 | { |
| 71 | public: |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 72 | explicit HWComposer(std::unique_ptr<android::Hwc2::Composer> composer); |
Mathias Agopian | 8b736f1 | 2012-08-13 17:54:26 -0700 | [diff] [blame] | 73 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 74 | ~HWComposer(); |
| 75 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 76 | void registerCallback(HWC2::ComposerCallback* callback, |
| 77 | int32_t sequenceId); |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 78 | |
Dominik Laskowski | a2edf61 | 2018-06-01 13:15:16 -0700 | [diff] [blame^] | 79 | bool getDisplayIdentificationData(hwc2_display_t hwcDisplayId, uint8_t* outPort, |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 80 | DisplayIdentificationData* outData) const; |
| 81 | |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 82 | bool hasCapability(HWC2::Capability capability) const; |
| 83 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 84 | // Attempts to allocate a virtual display. If the virtual display is created |
| 85 | // on the HWC device, outId will contain its HWC ID. |
| 86 | status_t allocateVirtualDisplay(uint32_t width, uint32_t height, |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 87 | ui::PixelFormat* format, int32_t* outId); |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 88 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 89 | // Attempts to create a new layer on this display |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 90 | HWC2::Layer* createLayer(int32_t displayId); |
| 91 | // Destroy a previously created layer |
| 92 | void destroyLayer(int32_t displayId, HWC2::Layer* layer); |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 93 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 94 | // Asks the HAL what it can do |
Dominik Laskowski | eecd659 | 2018-05-29 10:25:41 -0700 | [diff] [blame] | 95 | status_t prepare(DisplayDevice& display); |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 96 | |
Chia-I Wu | 06d63de | 2017-01-04 14:58:51 +0800 | [diff] [blame] | 97 | status_t setClientTarget(int32_t displayId, uint32_t slot, |
| 98 | const sp<Fence>& acquireFence, |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 99 | const sp<GraphicBuffer>& target, ui::Dataspace dataspace); |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 100 | |
Fabien Sanglard | a87aa7b | 2016-11-30 16:27:22 -0800 | [diff] [blame] | 101 | // Present layers to the display and read releaseFences. |
| 102 | status_t presentAndGetReleaseFences(int32_t displayId); |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 103 | |
Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 104 | // set power mode |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 105 | status_t setPowerMode(int32_t displayId, int mode); |
Colin Cross | 10fbdb6 | 2012-07-12 17:56:34 -0700 | [diff] [blame] | 106 | |
Michael Lentine | 6c9e34a | 2014-07-14 13:48:55 -0700 | [diff] [blame] | 107 | // set active config |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 108 | status_t setActiveConfig(int32_t displayId, size_t configId); |
Michael Lentine | 6c9e34a | 2014-07-14 13:48:55 -0700 | [diff] [blame] | 109 | |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 110 | // Sets a color transform to be applied to the result of composition |
| 111 | status_t setColorTransform(int32_t displayId, const mat4& transform); |
| 112 | |
Andy McFadden | 27ec573 | 2012-10-02 19:04:45 -0700 | [diff] [blame] | 113 | // reset state when an external, non-virtual display is disconnected |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 114 | void disconnectDisplay(int32_t displayId); |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 115 | |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 116 | // does this display have layers handled by HWC |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 117 | bool hasDeviceComposition(int32_t displayId) const; |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 118 | |
Madhuri Athota | 88a905b | 2017-05-04 16:58:15 +0530 | [diff] [blame] | 119 | // does this display have pending request to flip client target |
| 120 | bool hasFlipClientTargetRequest(int32_t displayId) const; |
| 121 | |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 122 | // does this display have layers handled by GLES |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 123 | bool hasClientComposition(int32_t displayId) const; |
Mathias Agopian | 9c6e297 | 2011-09-20 17:21:56 -0700 | [diff] [blame] | 124 | |
Fabien Sanglard | 11d0fc3 | 2016-12-01 15:43:01 -0800 | [diff] [blame] | 125 | // get the present fence received from the last call to present. |
| 126 | sp<Fence> getPresentFence(int32_t displayId) const; |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 127 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 128 | // Get last release fence for the given layer |
| 129 | sp<Fence> getLayerReleaseFence(int32_t displayId, |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 130 | HWC2::Layer* layer) const; |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 131 | |
Jesse Hall | 851cfe8 | 2013-03-20 13:44:00 -0700 | [diff] [blame] | 132 | // Set the output buffer and acquire fence for a virtual display. |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 133 | // Returns INVALID_OPERATION if displayId is not a virtual display. |
| 134 | status_t setOutputBuffer(int32_t displayId, const sp<Fence>& acquireFence, |
Jesse Hall | 851cfe8 | 2013-03-20 13:44:00 -0700 | [diff] [blame] | 135 | const sp<GraphicBuffer>& buf); |
| 136 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 137 | // After SurfaceFlinger has retrieved the release fences for all the frames, |
| 138 | // it can call this to clear the shared pointers in the release fence map |
| 139 | void clearReleaseFences(int32_t displayId); |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 140 | |
Peiyong Lin | 6266589 | 2018-04-16 11:07:44 -0700 | [diff] [blame] | 141 | // Fetches the HDR capabilities of the given display |
| 142 | status_t getHdrCapabilities(int32_t displayId, HdrCapabilities* outCapabilities); |
Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 143 | |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 144 | int32_t getSupportedPerFrameMetadata(int32_t displayId) const; |
| 145 | |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 146 | // Returns the available RenderIntent of the given display. |
| 147 | std::vector<ui::RenderIntent> getRenderIntents(int32_t displayId, ui::ColorMode colorMode) const; |
| 148 | |
| 149 | mat4 getDataspaceSaturationMatrix(int32_t displayId, ui::Dataspace dataspace); |
| 150 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 151 | // Events handling --------------------------------------------------------- |
| 152 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 153 | // Returns true if successful, false otherwise. The |
| 154 | // DisplayDevice::DisplayType of the display is returned as an output param. |
Dominik Laskowski | a2edf61 | 2018-06-01 13:15:16 -0700 | [diff] [blame^] | 155 | bool onVsync(hwc2_display_t hwcDisplayId, int64_t timestamp, int32_t* outDisplay); |
| 156 | std::optional<DisplayId> onHotplug(hwc2_display_t hwcDisplayId, int32_t displayType, |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame] | 157 | HWC2::Connection connection); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 158 | |
Fabien Sanglard | df0b705 | 2016-11-30 15:51:53 -0800 | [diff] [blame] | 159 | void setVsyncEnabled(int32_t displayId, HWC2::Vsync enabled); |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 160 | |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 161 | // Query display parameters. Pass in a display index (e.g. |
| 162 | // HWC_DISPLAY_PRIMARY). |
Fabien Sanglard | df0b705 | 2016-11-30 15:51:53 -0800 | [diff] [blame] | 163 | nsecs_t getRefreshTimestamp(int32_t displayId) const; |
| 164 | bool isConnected(int32_t displayId) const; |
Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 165 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 166 | // Non-const because it can update configMap inside of mDisplayData |
| 167 | std::vector<std::shared_ptr<const HWC2::Display::Config>> |
| 168 | getConfigs(int32_t displayId) const; |
Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 169 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 170 | std::shared_ptr<const HWC2::Display::Config> |
| 171 | getActiveConfig(int32_t displayId) const; |
Lloyd Pique | 3c085a0 | 2018-05-09 19:38:32 -0700 | [diff] [blame] | 172 | int getActiveConfigIndex(int32_t displayId) const; |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 173 | |
Peiyong Lin | fd997e0 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 174 | std::vector<ui::ColorMode> getColorModes(int32_t displayId) const; |
Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 175 | |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 176 | status_t setActiveColorMode(int32_t displayId, ui::ColorMode mode, |
| 177 | ui::RenderIntent renderIntent); |
Courtney Goeltzenleuchter | fad9d8c | 2016-06-23 11:49:50 -0600 | [diff] [blame] | 178 | |
Hendrik Wagenaar | 87670ff | 2017-02-01 12:10:46 -0800 | [diff] [blame] | 179 | bool isUsingVrComposer() const; |
| 180 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 181 | // for debugging ---------------------------------------------------------- |
Mathias Agopian | 74d211a | 2013-04-22 16:55:35 +0200 | [diff] [blame] | 182 | void dump(String8& out) const; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 183 | |
Hendrik Wagenaar | 87670ff | 2017-02-01 12:10:46 -0800 | [diff] [blame] | 184 | android::Hwc2::Composer* getComposer() const { return mHwcDevice->getComposer(); } |
Steven Thomas | 6e8f706 | 2017-11-22 14:15:29 -0800 | [diff] [blame] | 185 | |
| 186 | std::optional<hwc2_display_t> getHwcDisplayId(int32_t displayId) const; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 187 | private: |
Lloyd Pique | e39cad2 | 2017-12-20 17:01:29 -0800 | [diff] [blame] | 188 | // For unit tests |
| 189 | friend TestableSurfaceFlinger; |
| 190 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 191 | static const int32_t VIRTUAL_DISPLAY_ID_BASE = 2; |
Jesse Hall | b685c54 | 2012-07-31 14:32:56 -0700 | [diff] [blame] | 192 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 193 | bool isValidDisplay(int32_t displayId) const; |
| 194 | static void validateChange(HWC2::Composition from, HWC2::Composition to); |
Mathias Agopian | 31d2843 | 2012-04-03 16:31:39 -0700 | [diff] [blame] | 195 | |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 196 | struct cb_context; |
Mathias Agopian | 31d2843 | 2012-04-03 16:31:39 -0700 | [diff] [blame] | 197 | |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 198 | struct DisplayData { |
Dominik Laskowski | f9750f2 | 2018-06-06 12:24:53 -0700 | [diff] [blame] | 199 | bool hasClientComposition = false; |
| 200 | bool hasDeviceComposition = false; |
| 201 | HWC2::Display* hwcDisplay = nullptr; |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 202 | HWC2::DisplayRequest displayRequests; |
Dominik Laskowski | f9750f2 | 2018-06-06 12:24:53 -0700 | [diff] [blame] | 203 | 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] | 204 | std::unordered_map<HWC2::Layer*, sp<Fence>> releaseFences; |
Dominik Laskowski | f9750f2 | 2018-06-06 12:24:53 -0700 | [diff] [blame] | 205 | buffer_handle_t outbufHandle = nullptr; |
| 206 | sp<Fence> outbufAcquireFence = Fence::NO_FENCE; |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 207 | mutable std::unordered_map<int32_t, |
| 208 | std::shared_ptr<const HWC2::Display::Config>> configMap; |
Jamie Gennis | 2ec3e07 | 2012-11-11 16:24:33 -0800 | [diff] [blame] | 209 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 210 | // protected by mVsyncLock |
Dominik Laskowski | f9750f2 | 2018-06-06 12:24:53 -0700 | [diff] [blame] | 211 | HWC2::Vsync vsyncEnabled = HWC2::Vsync::Disable; |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 212 | |
| 213 | bool validateWasSkipped; |
| 214 | HWC2::Error presentError; |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 215 | }; |
| 216 | |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 217 | std::unique_ptr<HWC2::Device> mHwcDevice; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 218 | std::vector<DisplayData> mDisplayData{HWC_NUM_PHYSICAL_DISPLAY_TYPES}; |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 219 | std::set<size_t> mFreeDisplaySlots; |
| 220 | std::unordered_map<hwc2_display_t, int32_t> mHwcDisplaySlots; |
Manoj Kumar AVM | e04e4ed | 2015-06-11 14:18:14 -0700 | [diff] [blame] | 221 | // protect mDisplayData from races between prepare and dump |
| 222 | mutable Mutex mDisplayLock; |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 223 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 224 | cb_context* mCBContext = nullptr; |
| 225 | size_t mVSyncCounts[HWC_NUM_PHYSICAL_DISPLAY_TYPES]{0, 0}; |
| 226 | uint32_t mRemainingHwcVirtualDisplays{mHwcDevice->getMaxVirtualDisplayCount()}; |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 227 | |
| 228 | // protected by mLock |
| 229 | mutable Mutex mLock; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 230 | mutable std::unordered_map<int32_t, nsecs_t> mLastHwVSync{ |
| 231 | {{HWC_DISPLAY_PRIMARY, 0}, {HWC_DISPLAY_EXTERNAL, 0}}}; |
Mathias Agopian | 81cd5d3 | 2012-10-04 02:34:38 -0700 | [diff] [blame] | 232 | |
| 233 | // thread-safe |
Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 234 | mutable Mutex mVsyncLock; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 235 | }; |
| 236 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 237 | // --------------------------------------------------------------------------- |
| 238 | }; // namespace android |
| 239 | |
| 240 | #endif // ANDROID_SF_HWCOMPOSER_H |