Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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_HWC2_H |
| 18 | #define ANDROID_SF_HWC2_H |
| 19 | |
| 20 | #define HWC2_INCLUDE_STRINGIFICATION |
| 21 | #define HWC2_USE_CPP11 |
| 22 | #include <hardware/hwcomposer2.h> |
| 23 | #undef HWC2_INCLUDE_STRINGIFICATION |
| 24 | #undef HWC2_USE_CPP11 |
| 25 | |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame^] | 26 | #include <gui/HdrMetadata.h> |
Mathias Agopian | 1d77b71 | 2017-02-17 15:46:13 -0800 | [diff] [blame] | 27 | #include <math/mat4.h> |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame^] | 28 | #include <ui/HdrCapabilities.h> |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 29 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 30 | #include <utils/Log.h> |
| 31 | #include <utils/StrongPointer.h> |
| 32 | #include <utils/Timers.h> |
| 33 | |
| 34 | #include <functional> |
| 35 | #include <string> |
| 36 | #include <unordered_map> |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 37 | #include <unordered_set> |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 38 | #include <vector> |
Alistair Strachan | c175253 | 2017-06-07 16:34:44 -0700 | [diff] [blame] | 39 | #include <map> |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 40 | |
| 41 | namespace android { |
| 42 | class Fence; |
Dan Stoza | 5a423ea | 2017-02-16 14:10:39 -0800 | [diff] [blame] | 43 | class FloatRect; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 44 | class GraphicBuffer; |
| 45 | class Rect; |
| 46 | class Region; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 47 | namespace Hwc2 { |
| 48 | class Composer; |
Dan Stoza | 71bded5 | 2016-10-19 11:10:33 -0700 | [diff] [blame] | 49 | } |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | namespace HWC2 { |
| 53 | |
| 54 | class Display; |
| 55 | class Layer; |
| 56 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 57 | // Implement this interface to receive hardware composer events. |
| 58 | // |
| 59 | // These callback functions will generally be called on a hwbinder thread, but |
| 60 | // when first registering the callback the onHotplugReceived() function will |
| 61 | // immediately be called on the thread calling registerCallback(). |
| 62 | // |
| 63 | // All calls receive a sequenceId, which will be the value that was supplied to |
| 64 | // HWC2::Device::registerCallback(). It's used to help differentiate callbacks |
| 65 | // from different hardware composer instances. |
| 66 | class ComposerCallback { |
| 67 | public: |
| 68 | virtual void onHotplugReceived(int32_t sequenceId, hwc2_display_t display, |
Lloyd Pique | 715a2c1 | 2017-12-14 17:18:08 -0800 | [diff] [blame] | 69 | Connection connection) = 0; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 70 | virtual void onRefreshReceived(int32_t sequenceId, |
| 71 | hwc2_display_t display) = 0; |
| 72 | virtual void onVsyncReceived(int32_t sequenceId, hwc2_display_t display, |
| 73 | int64_t timestamp) = 0; |
| 74 | virtual ~ComposerCallback() = default; |
| 75 | }; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 76 | |
Fabien Sanglard | 3396070 | 2016-11-29 17:58:21 -0800 | [diff] [blame] | 77 | // C++ Wrapper around hwc2_device_t. Load all functions pointers |
| 78 | // and handle callback registration. |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 79 | class Device |
| 80 | { |
| 81 | public: |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 82 | explicit Device(std::unique_ptr<android::Hwc2::Composer> composer); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 83 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 84 | void registerCallback(ComposerCallback* callback, int32_t sequenceId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 85 | |
| 86 | // Required by HWC2 |
| 87 | |
| 88 | std::string dump() const; |
| 89 | |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 90 | const std::unordered_set<Capability>& getCapabilities() const { |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 91 | return mCapabilities; |
| 92 | }; |
| 93 | |
| 94 | uint32_t getMaxVirtualDisplayCount() const; |
| 95 | Error createVirtualDisplay(uint32_t width, uint32_t height, |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 96 | android_pixel_format_t* format, Display** outDisplay); |
| 97 | void destroyDisplay(hwc2_display_t displayId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 98 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 99 | void onHotplug(hwc2_display_t displayId, Connection connection); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 100 | |
| 101 | // Other Device methods |
| 102 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 103 | Display* getDisplayById(hwc2_display_t id); |
Dan Stoza | 09e7a27 | 2016-04-14 12:31:01 -0700 | [diff] [blame] | 104 | |
Hendrik Wagenaar | 87670ff | 2017-02-01 12:10:46 -0800 | [diff] [blame] | 105 | android::Hwc2::Composer* getComposer() { return mComposer.get(); } |
Hendrik Wagenaar | 87670ff | 2017-02-01 12:10:46 -0800 | [diff] [blame] | 106 | |
Chia-I Wu | ae5a6b8 | 2017-10-10 09:09:22 -0700 | [diff] [blame] | 107 | // We buffer most state changes and flush them implicitly with |
| 108 | // Display::validate, Display::present, and Display::presentOrValidate. |
| 109 | // This method provides an explicit way to flush state changes to HWC. |
| 110 | Error flushCommands(); |
| 111 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 112 | private: |
| 113 | // Initialization methods |
| 114 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 115 | void loadCapabilities(); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 116 | |
| 117 | // Member variables |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 118 | std::unique_ptr<android::Hwc2::Composer> mComposer; |
Dan Stoza | 9f26a9c | 2016-06-22 14:51:09 -0700 | [diff] [blame] | 119 | std::unordered_set<Capability> mCapabilities; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 120 | std::unordered_map<hwc2_display_t, std::unique_ptr<Display>> mDisplays; |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 121 | bool mRegisteredCallback = false; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
Fabien Sanglard | 3396070 | 2016-11-29 17:58:21 -0800 | [diff] [blame] | 124 | // Convenience C++ class to access hwc2_device_t Display functions directly. |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 125 | class Display |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 126 | { |
| 127 | public: |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 128 | Display(android::Hwc2::Composer& composer, |
| 129 | const std::unordered_set<Capability>& capabilities, |
| 130 | hwc2_display_t id, DisplayType type); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 131 | ~Display(); |
| 132 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 133 | class Config |
| 134 | { |
| 135 | public: |
| 136 | class Builder |
| 137 | { |
| 138 | public: |
| 139 | Builder(Display& display, hwc2_config_t id); |
| 140 | |
| 141 | std::shared_ptr<const Config> build() { |
| 142 | return std::const_pointer_cast<const Config>( |
| 143 | std::move(mConfig)); |
| 144 | } |
| 145 | |
| 146 | Builder& setWidth(int32_t width) { |
| 147 | mConfig->mWidth = width; |
| 148 | return *this; |
| 149 | } |
| 150 | Builder& setHeight(int32_t height) { |
| 151 | mConfig->mHeight = height; |
| 152 | return *this; |
| 153 | } |
| 154 | Builder& setVsyncPeriod(int32_t vsyncPeriod) { |
| 155 | mConfig->mVsyncPeriod = vsyncPeriod; |
| 156 | return *this; |
| 157 | } |
| 158 | Builder& setDpiX(int32_t dpiX) { |
| 159 | if (dpiX == -1) { |
| 160 | mConfig->mDpiX = getDefaultDensity(); |
| 161 | } else { |
| 162 | mConfig->mDpiX = dpiX / 1000.0f; |
| 163 | } |
| 164 | return *this; |
| 165 | } |
| 166 | Builder& setDpiY(int32_t dpiY) { |
| 167 | if (dpiY == -1) { |
| 168 | mConfig->mDpiY = getDefaultDensity(); |
| 169 | } else { |
| 170 | mConfig->mDpiY = dpiY / 1000.0f; |
| 171 | } |
| 172 | return *this; |
| 173 | } |
| 174 | |
| 175 | private: |
| 176 | float getDefaultDensity(); |
| 177 | std::shared_ptr<Config> mConfig; |
| 178 | }; |
| 179 | |
| 180 | hwc2_display_t getDisplayId() const { return mDisplay.getId(); } |
| 181 | hwc2_config_t getId() const { return mId; } |
| 182 | |
| 183 | int32_t getWidth() const { return mWidth; } |
| 184 | int32_t getHeight() const { return mHeight; } |
| 185 | nsecs_t getVsyncPeriod() const { return mVsyncPeriod; } |
| 186 | float getDpiX() const { return mDpiX; } |
| 187 | float getDpiY() const { return mDpiY; } |
| 188 | |
| 189 | private: |
| 190 | Config(Display& display, hwc2_config_t id); |
| 191 | |
| 192 | Display& mDisplay; |
| 193 | hwc2_config_t mId; |
| 194 | |
| 195 | int32_t mWidth; |
| 196 | int32_t mHeight; |
| 197 | nsecs_t mVsyncPeriod; |
| 198 | float mDpiX; |
| 199 | float mDpiY; |
| 200 | }; |
| 201 | |
| 202 | // Required by HWC2 |
| 203 | |
| 204 | [[clang::warn_unused_result]] Error acceptChanges(); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 205 | [[clang::warn_unused_result]] Error createLayer(Layer** outLayer); |
| 206 | [[clang::warn_unused_result]] Error destroyLayer(Layer* layer); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 207 | [[clang::warn_unused_result]] Error getActiveConfig( |
| 208 | std::shared_ptr<const Config>* outConfig) const; |
| 209 | [[clang::warn_unused_result]] Error getChangedCompositionTypes( |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 210 | std::unordered_map<Layer*, Composition>* outTypes); |
Dan Stoza | 076ac67 | 2016-03-14 10:47:53 -0700 | [diff] [blame] | 211 | [[clang::warn_unused_result]] Error getColorModes( |
Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 212 | std::vector<android_color_mode_t>* outModes) const; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 213 | |
| 214 | // Doesn't call into the HWC2 device, so no errors are possible |
| 215 | std::vector<std::shared_ptr<const Config>> getConfigs() const; |
| 216 | |
| 217 | [[clang::warn_unused_result]] Error getName(std::string* outName) const; |
| 218 | [[clang::warn_unused_result]] Error getRequests( |
| 219 | DisplayRequest* outDisplayRequests, |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 220 | std::unordered_map<Layer*, LayerRequest>* outLayerRequests); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 221 | [[clang::warn_unused_result]] Error getType(DisplayType* outType) const; |
| 222 | [[clang::warn_unused_result]] Error supportsDoze(bool* outSupport) const; |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 223 | [[clang::warn_unused_result]] Error getHdrCapabilities( |
| 224 | std::unique_ptr<android::HdrCapabilities>* outCapabilities) const; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 225 | [[clang::warn_unused_result]] Error getReleaseFences( |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 226 | std::unordered_map<Layer*, |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 227 | android::sp<android::Fence>>* outFences) const; |
| 228 | [[clang::warn_unused_result]] Error present( |
Fabien Sanglard | 11d0fc3 | 2016-12-01 15:43:01 -0800 | [diff] [blame] | 229 | android::sp<android::Fence>* outPresentFence); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 230 | [[clang::warn_unused_result]] Error setActiveConfig( |
| 231 | const std::shared_ptr<const Config>& config); |
| 232 | [[clang::warn_unused_result]] Error setClientTarget( |
Daniel Nicoara | 1f42e3a | 2017-04-10 13:27:32 -0400 | [diff] [blame] | 233 | uint32_t slot, const android::sp<android::GraphicBuffer>& target, |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 234 | const android::sp<android::Fence>& acquireFence, |
| 235 | android_dataspace_t dataspace); |
Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 236 | [[clang::warn_unused_result]] Error setColorMode(android_color_mode_t mode); |
Dan Stoza | 5df2a86 | 2016-03-24 16:19:37 -0700 | [diff] [blame] | 237 | [[clang::warn_unused_result]] Error setColorTransform( |
| 238 | const android::mat4& matrix, android_color_transform_t hint); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 239 | [[clang::warn_unused_result]] Error setOutputBuffer( |
| 240 | const android::sp<android::GraphicBuffer>& buffer, |
| 241 | const android::sp<android::Fence>& releaseFence); |
| 242 | [[clang::warn_unused_result]] Error setPowerMode(PowerMode mode); |
| 243 | [[clang::warn_unused_result]] Error setVsyncEnabled(Vsync enabled); |
| 244 | [[clang::warn_unused_result]] Error validate(uint32_t* outNumTypes, |
| 245 | uint32_t* outNumRequests); |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 246 | [[clang::warn_unused_result]] Error presentOrValidate(uint32_t* outNumTypes, |
| 247 | uint32_t* outNumRequests, |
| 248 | android::sp<android::Fence>* outPresentFence, uint32_t* state); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 249 | |
| 250 | // Other Display methods |
| 251 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 252 | hwc2_display_t getId() const { return mId; } |
| 253 | bool isConnected() const { return mIsConnected; } |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 254 | void setConnected(bool connected); // For use by Device only |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 255 | |
| 256 | private: |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 257 | int32_t getAttribute(hwc2_config_t configId, Attribute attribute); |
| 258 | void loadConfig(hwc2_config_t configId); |
| 259 | void loadConfigs(); |
| 260 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 261 | // This may fail (and return a null pointer) if no layer with this ID exists |
| 262 | // on this display |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 263 | Layer* getLayerById(hwc2_layer_t id) const; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 264 | |
| 265 | // Member variables |
| 266 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 267 | // These are references to data owned by HWC2::Device, which will outlive |
| 268 | // this HWC2::Display, so these references are guaranteed to be valid for |
| 269 | // the lifetime of this object. |
| 270 | android::Hwc2::Composer& mComposer; |
| 271 | const std::unordered_set<Capability>& mCapabilities; |
| 272 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 273 | hwc2_display_t mId; |
| 274 | bool mIsConnected; |
Chris Forbes | 016d73c | 2017-04-11 10:04:31 -0700 | [diff] [blame] | 275 | DisplayType mType; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 276 | std::unordered_map<hwc2_layer_t, std::unique_ptr<Layer>> mLayers; |
Alistair Strachan | c175253 | 2017-06-07 16:34:44 -0700 | [diff] [blame] | 277 | // The ordering in this map matters, for getConfigs(), when it is |
| 278 | // converted to a vector |
| 279 | std::map<hwc2_config_t, std::shared_ptr<const Config>> mConfigs; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 280 | }; |
| 281 | |
Fabien Sanglard | 3396070 | 2016-11-29 17:58:21 -0800 | [diff] [blame] | 282 | // Convenience C++ class to access hwc2_device_t Layer functions directly. |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 283 | class Layer |
| 284 | { |
| 285 | public: |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 286 | Layer(android::Hwc2::Composer& composer, |
| 287 | const std::unordered_set<Capability>& capabilities, |
| 288 | hwc2_display_t displayId, hwc2_layer_t layerId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 289 | ~Layer(); |
| 290 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 291 | hwc2_layer_t getId() const { return mId; } |
| 292 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 293 | // Register a listener to be notified when the layer is destroyed. When the |
| 294 | // listener function is called, the Layer will be in the process of being |
| 295 | // destroyed, so it's not safe to call methods on it. |
| 296 | void setLayerDestroyedListener(std::function<void(Layer*)> listener); |
| 297 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 298 | [[clang::warn_unused_result]] Error setCursorPosition(int32_t x, int32_t y); |
Chia-I Wu | 06d63de | 2017-01-04 14:58:51 +0800 | [diff] [blame] | 299 | [[clang::warn_unused_result]] Error setBuffer(uint32_t slot, |
Daniel Nicoara | 1f42e3a | 2017-04-10 13:27:32 -0400 | [diff] [blame] | 300 | const android::sp<android::GraphicBuffer>& buffer, |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 301 | const android::sp<android::Fence>& acquireFence); |
| 302 | [[clang::warn_unused_result]] Error setSurfaceDamage( |
| 303 | const android::Region& damage); |
| 304 | |
| 305 | [[clang::warn_unused_result]] Error setBlendMode(BlendMode mode); |
| 306 | [[clang::warn_unused_result]] Error setColor(hwc_color_t color); |
| 307 | [[clang::warn_unused_result]] Error setCompositionType(Composition type); |
Dan Stoza | 5df2a86 | 2016-03-24 16:19:37 -0700 | [diff] [blame] | 308 | [[clang::warn_unused_result]] Error setDataspace( |
| 309 | android_dataspace_t dataspace); |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame^] | 310 | [[clang::warn_unused_result]] Error setHdrMetadata(const android::HdrMetadata& metadata); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 311 | [[clang::warn_unused_result]] Error setDisplayFrame( |
| 312 | const android::Rect& frame); |
| 313 | [[clang::warn_unused_result]] Error setPlaneAlpha(float alpha); |
| 314 | [[clang::warn_unused_result]] Error setSidebandStream( |
| 315 | const native_handle_t* stream); |
| 316 | [[clang::warn_unused_result]] Error setSourceCrop( |
Dan Stoza | 5a423ea | 2017-02-16 14:10:39 -0800 | [diff] [blame] | 317 | const android::FloatRect& crop); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 318 | [[clang::warn_unused_result]] Error setTransform(Transform transform); |
| 319 | [[clang::warn_unused_result]] Error setVisibleRegion( |
| 320 | const android::Region& region); |
| 321 | [[clang::warn_unused_result]] Error setZOrder(uint32_t z); |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 322 | [[clang::warn_unused_result]] Error setInfo(uint32_t type, uint32_t appId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 323 | |
| 324 | private: |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 325 | // These are references to data owned by HWC2::Device, which will outlive |
| 326 | // this HWC2::Layer, so these references are guaranteed to be valid for |
| 327 | // the lifetime of this object. |
| 328 | android::Hwc2::Composer& mComposer; |
| 329 | const std::unordered_set<Capability>& mCapabilities; |
| 330 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 331 | hwc2_display_t mDisplayId; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 332 | hwc2_layer_t mId; |
Courtney Goeltzenleuchter | c988ee4 | 2017-05-31 17:56:46 -0600 | [diff] [blame] | 333 | android_dataspace mDataSpace = HAL_DATASPACE_UNKNOWN; |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame^] | 334 | android::HdrMetadata mHdrMetadata; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 335 | std::function<void(Layer*)> mLayerDestroyedListener; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 336 | }; |
| 337 | |
| 338 | } // namespace HWC2 |
| 339 | |
| 340 | #endif // ANDROID_SF_HWC2_H |