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