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 | // #define LOG_NDEBUG 0 |
| 18 | |
| 19 | #undef LOG_TAG |
| 20 | #define LOG_TAG "HWC2" |
| 21 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS |
| 22 | |
| 23 | #include "HWC2.h" |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 24 | #include "ComposerHal.h" |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 25 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 26 | #include <ui/Fence.h> |
Dan Stoza | 5a423ea | 2017-02-16 14:10:39 -0800 | [diff] [blame] | 27 | #include <ui/FloatRect.h> |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 28 | #include <ui/GraphicBuffer.h> |
| 29 | #include <ui/Region.h> |
| 30 | |
| 31 | #include <android/configuration.h> |
| 32 | |
Dan Stoza | 09e7a27 | 2016-04-14 12:31:01 -0700 | [diff] [blame] | 33 | #include <algorithm> |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 34 | #include <inttypes.h> |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 35 | #include <set> |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 36 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 37 | using android::Fence; |
Dan Stoza | 5a423ea | 2017-02-16 14:10:39 -0800 | [diff] [blame] | 38 | using android::FloatRect; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 39 | using android::GraphicBuffer; |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 40 | using android::HdrCapabilities; |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame] | 41 | using android::HdrMetadata; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 42 | using android::Rect; |
| 43 | using android::Region; |
| 44 | using android::sp; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 45 | using android::hardware::Return; |
| 46 | using android::hardware::Void; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 47 | |
| 48 | namespace HWC2 { |
| 49 | |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 50 | namespace Hwc2 = android::Hwc2; |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 51 | using android::ui::ColorMode; |
| 52 | using android::ui::Dataspace; |
| 53 | using android::ui::PixelFormat; |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 54 | using android::ui::RenderIntent; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 55 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 56 | namespace { |
| 57 | |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 58 | inline bool hasMetadataKey(const std::set<Hwc2::PerFrameMetadataKey>& keys, |
| 59 | const Hwc2::PerFrameMetadataKey& key) { |
| 60 | return keys.find(key) != keys.end(); |
| 61 | } |
| 62 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 63 | class ComposerCallbackBridge : public Hwc2::IComposerCallback { |
| 64 | public: |
| 65 | ComposerCallbackBridge(ComposerCallback* callback, int32_t sequenceId) |
Lloyd Pique | 715a2c1 | 2017-12-14 17:18:08 -0800 | [diff] [blame] | 66 | : mCallback(callback), mSequenceId(sequenceId) {} |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 67 | |
| 68 | Return<void> onHotplug(Hwc2::Display display, |
| 69 | IComposerCallback::Connection conn) override |
| 70 | { |
| 71 | HWC2::Connection connection = static_cast<HWC2::Connection>(conn); |
Lloyd Pique | 715a2c1 | 2017-12-14 17:18:08 -0800 | [diff] [blame] | 72 | mCallback->onHotplugReceived(mSequenceId, display, connection); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 73 | return Void(); |
| 74 | } |
| 75 | |
| 76 | Return<void> onRefresh(Hwc2::Display display) override |
| 77 | { |
| 78 | mCallback->onRefreshReceived(mSequenceId, display); |
| 79 | return Void(); |
| 80 | } |
| 81 | |
| 82 | Return<void> onVsync(Hwc2::Display display, int64_t timestamp) override |
| 83 | { |
| 84 | mCallback->onVsyncReceived(mSequenceId, display, timestamp); |
| 85 | return Void(); |
| 86 | } |
| 87 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 88 | private: |
| 89 | ComposerCallback* mCallback; |
| 90 | int32_t mSequenceId; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | } // namespace anonymous |
| 94 | |
| 95 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 96 | // Device methods |
| 97 | |
Lloyd Pique | a822d52 | 2017-12-20 16:42:57 -0800 | [diff] [blame] | 98 | Device::Device(std::unique_ptr<android::Hwc2::Composer> composer) : mComposer(std::move(composer)) { |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 99 | loadCapabilities(); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 100 | } |
| 101 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 102 | void Device::registerCallback(ComposerCallback* callback, int32_t sequenceId) { |
| 103 | if (mRegisteredCallback) { |
| 104 | ALOGW("Callback already registered. Ignored extra registration " |
| 105 | "attempt."); |
| 106 | return; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 107 | } |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 108 | mRegisteredCallback = true; |
| 109 | sp<ComposerCallbackBridge> callbackBridge( |
| 110 | new ComposerCallbackBridge(callback, sequenceId)); |
| 111 | mComposer->registerCallback(callbackBridge); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | // Required by HWC2 device |
| 115 | |
| 116 | std::string Device::dump() const |
| 117 | { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 118 | return mComposer->dumpDebugInfo(); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | uint32_t Device::getMaxVirtualDisplayCount() const |
| 122 | { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 123 | return mComposer->getMaxVirtualDisplayCount(); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | Error Device::createVirtualDisplay(uint32_t width, uint32_t height, |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 127 | PixelFormat* format, Display** outDisplay) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 128 | { |
| 129 | ALOGI("Creating virtual display"); |
| 130 | |
| 131 | hwc2_display_t displayId = 0; |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 132 | auto intError = mComposer->createVirtualDisplay(width, height, |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 133 | format, &displayId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 134 | auto error = static_cast<Error>(intError); |
| 135 | if (error != Error::None) { |
| 136 | return error; |
| 137 | } |
| 138 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 139 | auto display = std::make_unique<Display>( |
| 140 | *mComposer.get(), mCapabilities, displayId, DisplayType::Virtual); |
Lloyd Pique | bc79209 | 2018-01-17 11:52:30 -0800 | [diff] [blame] | 141 | display->setConnected(true); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 142 | *outDisplay = display.get(); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 143 | mDisplays.emplace(displayId, std::move(display)); |
| 144 | ALOGI("Created virtual display"); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 145 | return Error::None; |
| 146 | } |
| 147 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 148 | void Device::destroyDisplay(hwc2_display_t displayId) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 149 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 150 | ALOGI("Destroying display %" PRIu64, displayId); |
| 151 | mDisplays.erase(displayId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 152 | } |
| 153 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 154 | void Device::onHotplug(hwc2_display_t displayId, Connection connection) { |
| 155 | if (connection == Connection::Connected) { |
Steven Thomas | 3bed052 | 2018-03-20 15:40:48 -0700 | [diff] [blame] | 156 | // If we get a hotplug connected event for a display we already have, |
| 157 | // destroy the display and recreate it. This will force us to requery |
| 158 | // the display params and recreate all layers on that display. |
| 159 | auto oldDisplay = getDisplayById(displayId); |
| 160 | if (oldDisplay != nullptr && oldDisplay->isConnected()) { |
| 161 | ALOGI("Hotplug connecting an already connected display." |
| 162 | " Clearing old display state."); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 163 | } |
Steven Thomas | 3bed052 | 2018-03-20 15:40:48 -0700 | [diff] [blame] | 164 | mDisplays.erase(displayId); |
| 165 | |
| 166 | DisplayType displayType; |
| 167 | auto intError = mComposer->getDisplayType(displayId, |
| 168 | reinterpret_cast<Hwc2::IComposerClient::DisplayType *>( |
| 169 | &displayType)); |
| 170 | auto error = static_cast<Error>(intError); |
| 171 | if (error != Error::None) { |
| 172 | ALOGE("getDisplayType(%" PRIu64 ") failed: %s (%d). " |
| 173 | "Aborting hotplug attempt.", |
| 174 | displayId, to_string(error).c_str(), intError); |
| 175 | return; |
| 176 | } |
| 177 | |
| 178 | auto newDisplay = std::make_unique<Display>( |
| 179 | *mComposer.get(), mCapabilities, displayId, displayType); |
Lloyd Pique | bc79209 | 2018-01-17 11:52:30 -0800 | [diff] [blame] | 180 | newDisplay->setConnected(true); |
Steven Thomas | 3bed052 | 2018-03-20 15:40:48 -0700 | [diff] [blame] | 181 | mDisplays.emplace(displayId, std::move(newDisplay)); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 182 | } else if (connection == Connection::Disconnected) { |
| 183 | // The display will later be destroyed by a call to |
| 184 | // destroyDisplay(). For now we just mark it disconnected. |
| 185 | auto display = getDisplayById(displayId); |
| 186 | if (display) { |
| 187 | display->setConnected(false); |
| 188 | } else { |
| 189 | ALOGW("Attempted to disconnect unknown display %" PRIu64, |
| 190 | displayId); |
| 191 | } |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 192 | } |
| 193 | } |
| 194 | |
| 195 | // Other Device methods |
| 196 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 197 | Display* Device::getDisplayById(hwc2_display_t id) { |
| 198 | auto iter = mDisplays.find(id); |
| 199 | return iter == mDisplays.end() ? nullptr : iter->second.get(); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | // Device initialization methods |
| 203 | |
| 204 | void Device::loadCapabilities() |
| 205 | { |
| 206 | static_assert(sizeof(Capability) == sizeof(int32_t), |
| 207 | "Capability size has changed"); |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 208 | auto capabilities = mComposer->getCapabilities(); |
| 209 | for (auto capability : capabilities) { |
| 210 | mCapabilities.emplace(static_cast<Capability>(capability)); |
| 211 | } |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 212 | } |
| 213 | |
Chia-I Wu | ae5a6b8 | 2017-10-10 09:09:22 -0700 | [diff] [blame] | 214 | Error Device::flushCommands() |
| 215 | { |
| 216 | return static_cast<Error>(mComposer->executeCommands()); |
| 217 | } |
| 218 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 219 | // Display methods |
| 220 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 221 | Display::Display(android::Hwc2::Composer& composer, |
Lloyd Pique | bc79209 | 2018-01-17 11:52:30 -0800 | [diff] [blame] | 222 | const std::unordered_set<Capability>& capabilities, hwc2_display_t id, |
| 223 | DisplayType type) |
| 224 | : mComposer(composer), |
| 225 | mCapabilities(capabilities), |
| 226 | mId(id), |
| 227 | mIsConnected(false), |
| 228 | mType(type) { |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 229 | ALOGV("Created display %" PRIu64, id); |
| 230 | } |
| 231 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 232 | Display::~Display() { |
| 233 | mLayers.clear(); |
| 234 | |
Chris Forbes | ceb67d1 | 2017-04-11 12:20:00 -0700 | [diff] [blame] | 235 | if (mType == DisplayType::Virtual) { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 236 | ALOGV("Destroying virtual display"); |
| 237 | auto intError = mComposer.destroyVirtualDisplay(mId); |
| 238 | auto error = static_cast<Error>(intError); |
| 239 | ALOGE_IF(error != Error::None, "destroyVirtualDisplay(%" PRIu64 |
| 240 | ") failed: %s (%d)", mId, to_string(error).c_str(), intError); |
| 241 | } else if (mType == DisplayType::Physical) { |
| 242 | auto error = setVsyncEnabled(HWC2::Vsync::Disable); |
| 243 | if (error != Error::None) { |
| 244 | ALOGE("~Display: Failed to disable vsync for display %" PRIu64 |
| 245 | ": %s (%d)", mId, to_string(error).c_str(), |
| 246 | static_cast<int32_t>(error)); |
| 247 | } |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 248 | } |
| 249 | } |
| 250 | |
| 251 | Display::Config::Config(Display& display, hwc2_config_t id) |
| 252 | : mDisplay(display), |
| 253 | mId(id), |
| 254 | mWidth(-1), |
| 255 | mHeight(-1), |
| 256 | mVsyncPeriod(-1), |
| 257 | mDpiX(-1), |
| 258 | mDpiY(-1) {} |
| 259 | |
| 260 | Display::Config::Builder::Builder(Display& display, hwc2_config_t id) |
| 261 | : mConfig(new Config(display, id)) {} |
| 262 | |
| 263 | float Display::Config::Builder::getDefaultDensity() { |
| 264 | // Default density is based on TVs: 1080p displays get XHIGH density, lower- |
| 265 | // resolution displays get TV density. Maybe eventually we'll need to update |
| 266 | // it for 4k displays, though hopefully those will just report accurate DPI |
| 267 | // information to begin with. This is also used for virtual displays and |
| 268 | // older HWC implementations, so be careful about orientation. |
| 269 | |
| 270 | auto longDimension = std::max(mConfig->mWidth, mConfig->mHeight); |
| 271 | if (longDimension >= 1080) { |
| 272 | return ACONFIGURATION_DENSITY_XHIGH; |
| 273 | } else { |
| 274 | return ACONFIGURATION_DENSITY_TV; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | // Required by HWC2 display |
| 279 | |
| 280 | Error Display::acceptChanges() |
| 281 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 282 | auto intError = mComposer.acceptDisplayChanges(mId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 283 | return static_cast<Error>(intError); |
| 284 | } |
| 285 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 286 | Error Display::createLayer(Layer** outLayer) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 287 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 288 | if (!outLayer) { |
| 289 | return Error::BadParameter; |
| 290 | } |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 291 | hwc2_layer_t layerId = 0; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 292 | auto intError = mComposer.createLayer(mId, &layerId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 293 | auto error = static_cast<Error>(intError); |
| 294 | if (error != Error::None) { |
| 295 | return error; |
| 296 | } |
| 297 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 298 | auto layer = std::make_unique<Layer>( |
| 299 | mComposer, mCapabilities, mId, layerId); |
| 300 | *outLayer = layer.get(); |
| 301 | mLayers.emplace(layerId, std::move(layer)); |
| 302 | return Error::None; |
| 303 | } |
| 304 | |
| 305 | Error Display::destroyLayer(Layer* layer) |
| 306 | { |
| 307 | if (!layer) { |
| 308 | return Error::BadParameter; |
| 309 | } |
| 310 | mLayers.erase(layer->getId()); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 311 | return Error::None; |
| 312 | } |
| 313 | |
| 314 | Error Display::getActiveConfig( |
| 315 | std::shared_ptr<const Display::Config>* outConfig) const |
| 316 | { |
| 317 | ALOGV("[%" PRIu64 "] getActiveConfig", mId); |
| 318 | hwc2_config_t configId = 0; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 319 | auto intError = mComposer.getActiveConfig(mId, &configId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 320 | auto error = static_cast<Error>(intError); |
| 321 | |
| 322 | if (error != Error::None) { |
Fabien Sanglard | b7432cc | 2016-11-11 09:40:27 -0800 | [diff] [blame] | 323 | ALOGE("Unable to get active config for mId:[%" PRIu64 "]", mId); |
| 324 | *outConfig = nullptr; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 325 | return error; |
| 326 | } |
| 327 | |
| 328 | if (mConfigs.count(configId) != 0) { |
| 329 | *outConfig = mConfigs.at(configId); |
| 330 | } else { |
| 331 | ALOGE("[%" PRIu64 "] getActiveConfig returned unknown config %u", mId, |
| 332 | configId); |
| 333 | // Return no error, but the caller needs to check for a null pointer to |
| 334 | // detect this case |
| 335 | *outConfig = nullptr; |
| 336 | } |
| 337 | |
| 338 | return Error::None; |
| 339 | } |
| 340 | |
| 341 | Error Display::getChangedCompositionTypes( |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 342 | std::unordered_map<Layer*, Composition>* outTypes) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 343 | { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 344 | std::vector<Hwc2::Layer> layerIds; |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 345 | std::vector<Hwc2::IComposerClient::Composition> types; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 346 | auto intError = mComposer.getChangedCompositionTypes( |
| 347 | mId, &layerIds, &types); |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 348 | uint32_t numElements = layerIds.size(); |
| 349 | auto error = static_cast<Error>(intError); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 350 | error = static_cast<Error>(intError); |
| 351 | if (error != Error::None) { |
| 352 | return error; |
| 353 | } |
| 354 | |
| 355 | outTypes->clear(); |
| 356 | outTypes->reserve(numElements); |
| 357 | for (uint32_t element = 0; element < numElements; ++element) { |
| 358 | auto layer = getLayerById(layerIds[element]); |
| 359 | if (layer) { |
| 360 | auto type = static_cast<Composition>(types[element]); |
| 361 | ALOGV("getChangedCompositionTypes: adding %" PRIu64 " %s", |
| 362 | layer->getId(), to_string(type).c_str()); |
| 363 | outTypes->emplace(layer, type); |
| 364 | } else { |
| 365 | ALOGE("getChangedCompositionTypes: invalid layer %" PRIu64 " found" |
| 366 | " on display %" PRIu64, layerIds[element], mId); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | return Error::None; |
| 371 | } |
| 372 | |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 373 | Error Display::getColorModes(std::vector<ColorMode>* outModes) const |
Dan Stoza | 076ac67 | 2016-03-14 10:47:53 -0700 | [diff] [blame] | 374 | { |
Peiyong Lin | fd997e0 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 375 | auto intError = mComposer.getColorModes(mId, outModes); |
| 376 | return static_cast<Error>(intError); |
Dan Stoza | 076ac67 | 2016-03-14 10:47:53 -0700 | [diff] [blame] | 377 | } |
| 378 | |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 379 | Error Display::getSupportedPerFrameMetadata(int32_t* outSupportedPerFrameMetadata) const |
| 380 | { |
| 381 | *outSupportedPerFrameMetadata = 0; |
| 382 | std::vector<Hwc2::PerFrameMetadataKey> tmpKeys; |
| 383 | auto intError = mComposer.getPerFrameMetadataKeys(mId, &tmpKeys); |
| 384 | auto error = static_cast<Error>(intError); |
| 385 | if (error != Error::None) { |
| 386 | return error; |
| 387 | } |
| 388 | |
| 389 | // Check whether a specific metadata type is supported. A metadata type is considered |
| 390 | // supported if and only if all required fields are supported. |
| 391 | |
| 392 | // SMPTE2086 |
| 393 | std::set<Hwc2::PerFrameMetadataKey> keys(tmpKeys.begin(), tmpKeys.end()); |
| 394 | if (hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::DISPLAY_RED_PRIMARY_X) && |
| 395 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::DISPLAY_RED_PRIMARY_Y) && |
| 396 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_X) && |
| 397 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_Y) && |
| 398 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_X) && |
| 399 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_Y) && |
| 400 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::WHITE_POINT_X) && |
| 401 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::WHITE_POINT_Y) && |
| 402 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::MAX_LUMINANCE) && |
| 403 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::MIN_LUMINANCE)) { |
| 404 | *outSupportedPerFrameMetadata |= HdrMetadata::Type::SMPTE2086; |
| 405 | } |
| 406 | // CTA861_3 |
| 407 | if (hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::MAX_CONTENT_LIGHT_LEVEL) && |
| 408 | hasMetadataKey(keys, Hwc2::PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL)) { |
| 409 | *outSupportedPerFrameMetadata |= HdrMetadata::Type::CTA861_3; |
| 410 | } |
| 411 | |
| 412 | return Error::None; |
| 413 | } |
| 414 | |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 415 | Error Display::getRenderIntents(ColorMode colorMode, |
| 416 | std::vector<RenderIntent>* outRenderIntents) const |
| 417 | { |
| 418 | auto intError = mComposer.getRenderIntents(mId, colorMode, outRenderIntents); |
| 419 | return static_cast<Error>(intError); |
| 420 | } |
| 421 | |
| 422 | Error Display::getDataspaceSaturationMatrix(Dataspace dataspace, android::mat4* outMatrix) |
| 423 | { |
| 424 | auto intError = mComposer.getDataspaceSaturationMatrix(dataspace, outMatrix); |
| 425 | return static_cast<Error>(intError); |
| 426 | } |
| 427 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 428 | std::vector<std::shared_ptr<const Display::Config>> Display::getConfigs() const |
| 429 | { |
| 430 | std::vector<std::shared_ptr<const Config>> configs; |
| 431 | for (const auto& element : mConfigs) { |
| 432 | configs.emplace_back(element.second); |
| 433 | } |
| 434 | return configs; |
| 435 | } |
| 436 | |
Dominik Laskowski | e9ef7c4 | 2018-03-12 19:34:30 -0700 | [diff] [blame^] | 437 | Error Display::getIdentificationData(uint8_t* outPort, std::vector<uint8_t>* outData) const { |
| 438 | auto intError = mComposer.getDisplayIdentificationData(mId, outPort, outData); |
| 439 | return static_cast<Error>(intError); |
| 440 | } |
| 441 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 442 | Error Display::getName(std::string* outName) const |
| 443 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 444 | auto intError = mComposer.getDisplayName(mId, outName); |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 445 | return static_cast<Error>(intError); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 446 | } |
| 447 | |
| 448 | Error Display::getRequests(HWC2::DisplayRequest* outDisplayRequests, |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 449 | std::unordered_map<Layer*, LayerRequest>* outLayerRequests) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 450 | { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 451 | uint32_t intDisplayRequests; |
| 452 | std::vector<Hwc2::Layer> layerIds; |
| 453 | std::vector<uint32_t> layerRequests; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 454 | auto intError = mComposer.getDisplayRequests( |
| 455 | mId, &intDisplayRequests, &layerIds, &layerRequests); |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 456 | uint32_t numElements = layerIds.size(); |
| 457 | auto error = static_cast<Error>(intError); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 458 | if (error != Error::None) { |
| 459 | return error; |
| 460 | } |
| 461 | |
| 462 | *outDisplayRequests = static_cast<DisplayRequest>(intDisplayRequests); |
| 463 | outLayerRequests->clear(); |
| 464 | outLayerRequests->reserve(numElements); |
| 465 | for (uint32_t element = 0; element < numElements; ++element) { |
| 466 | auto layer = getLayerById(layerIds[element]); |
| 467 | if (layer) { |
| 468 | auto layerRequest = |
| 469 | static_cast<LayerRequest>(layerRequests[element]); |
| 470 | outLayerRequests->emplace(layer, layerRequest); |
| 471 | } else { |
| 472 | ALOGE("getRequests: invalid layer %" PRIu64 " found on display %" |
| 473 | PRIu64, layerIds[element], mId); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | return Error::None; |
| 478 | } |
| 479 | |
| 480 | Error Display::getType(DisplayType* outType) const |
| 481 | { |
Chris Forbes | 016d73c | 2017-04-11 10:04:31 -0700 | [diff] [blame] | 482 | *outType = mType; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 483 | return Error::None; |
| 484 | } |
| 485 | |
| 486 | Error Display::supportsDoze(bool* outSupport) const |
| 487 | { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 488 | bool intSupport = false; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 489 | auto intError = mComposer.getDozeSupport(mId, &intSupport); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 490 | auto error = static_cast<Error>(intError); |
| 491 | if (error != Error::None) { |
| 492 | return error; |
| 493 | } |
| 494 | *outSupport = static_cast<bool>(intSupport); |
| 495 | return Error::None; |
| 496 | } |
| 497 | |
Peiyong Lin | 6266589 | 2018-04-16 11:07:44 -0700 | [diff] [blame] | 498 | Error Display::getHdrCapabilities(HdrCapabilities* outCapabilities) const |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 499 | { |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 500 | float maxLuminance = -1.0f; |
| 501 | float maxAverageLuminance = -1.0f; |
| 502 | float minLuminance = -1.0f; |
Peiyong Lin | 6266589 | 2018-04-16 11:07:44 -0700 | [diff] [blame] | 503 | std::vector<Hwc2::Hdr> types; |
| 504 | auto intError = mComposer.getHdrCapabilities(mId, &types, |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 505 | &maxLuminance, &maxAverageLuminance, &minLuminance); |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 506 | auto error = static_cast<HWC2::Error>(intError); |
| 507 | |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 508 | if (error != Error::None) { |
| 509 | return error; |
| 510 | } |
| 511 | |
Peiyong Lin | 6266589 | 2018-04-16 11:07:44 -0700 | [diff] [blame] | 512 | *outCapabilities = HdrCapabilities(std::move(types), |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 513 | maxLuminance, maxAverageLuminance, minLuminance); |
| 514 | return Error::None; |
| 515 | } |
| 516 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 517 | Error Display::getReleaseFences( |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 518 | std::unordered_map<Layer*, sp<Fence>>* outFences) const |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 519 | { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 520 | std::vector<Hwc2::Layer> layerIds; |
| 521 | std::vector<int> fenceFds; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 522 | auto intError = mComposer.getReleaseFences(mId, &layerIds, &fenceFds); |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 523 | auto error = static_cast<Error>(intError); |
| 524 | uint32_t numElements = layerIds.size(); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 525 | if (error != Error::None) { |
| 526 | return error; |
| 527 | } |
| 528 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 529 | std::unordered_map<Layer*, sp<Fence>> releaseFences; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 530 | releaseFences.reserve(numElements); |
| 531 | for (uint32_t element = 0; element < numElements; ++element) { |
| 532 | auto layer = getLayerById(layerIds[element]); |
| 533 | if (layer) { |
| 534 | sp<Fence> fence(new Fence(fenceFds[element])); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 535 | releaseFences.emplace(layer, fence); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 536 | } else { |
| 537 | ALOGE("getReleaseFences: invalid layer %" PRIu64 |
| 538 | " found on display %" PRIu64, layerIds[element], mId); |
Chia-I Wu | 5e74c65 | 2017-05-17 13:43:16 -0700 | [diff] [blame] | 539 | for (; element < numElements; ++element) { |
| 540 | close(fenceFds[element]); |
| 541 | } |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 542 | return Error::BadLayer; |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | *outFences = std::move(releaseFences); |
| 547 | return Error::None; |
| 548 | } |
| 549 | |
Fabien Sanglard | 11d0fc3 | 2016-12-01 15:43:01 -0800 | [diff] [blame] | 550 | Error Display::present(sp<Fence>* outPresentFence) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 551 | { |
Naseer Ahmed | 847650b | 2016-06-17 11:14:25 -0400 | [diff] [blame] | 552 | int32_t presentFenceFd = -1; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 553 | auto intError = mComposer.presentDisplay(mId, &presentFenceFd); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 554 | auto error = static_cast<Error>(intError); |
| 555 | if (error != Error::None) { |
| 556 | return error; |
| 557 | } |
| 558 | |
Fabien Sanglard | 11d0fc3 | 2016-12-01 15:43:01 -0800 | [diff] [blame] | 559 | *outPresentFence = new Fence(presentFenceFd); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 560 | return Error::None; |
| 561 | } |
| 562 | |
| 563 | Error Display::setActiveConfig(const std::shared_ptr<const Config>& config) |
| 564 | { |
| 565 | if (config->getDisplayId() != mId) { |
| 566 | ALOGE("setActiveConfig received config %u for the wrong display %" |
| 567 | PRIu64 " (expected %" PRIu64 ")", config->getId(), |
| 568 | config->getDisplayId(), mId); |
| 569 | return Error::BadConfig; |
| 570 | } |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 571 | auto intError = mComposer.setActiveConfig(mId, config->getId()); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 572 | return static_cast<Error>(intError); |
| 573 | } |
| 574 | |
Daniel Nicoara | 1f42e3a | 2017-04-10 13:27:32 -0400 | [diff] [blame] | 575 | Error Display::setClientTarget(uint32_t slot, const sp<GraphicBuffer>& target, |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 576 | const sp<Fence>& acquireFence, Dataspace dataspace) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 577 | { |
Dan Stoza | 5cf424b | 2016-05-20 14:02:39 -0700 | [diff] [blame] | 578 | // TODO: Properly encode client target surface damage |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 579 | int32_t fenceFd = acquireFence->dup(); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 580 | auto intError = mComposer.setClientTarget(mId, slot, target, |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 581 | fenceFd, dataspace, std::vector<Hwc2::IComposerClient::Rect>()); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 582 | return static_cast<Error>(intError); |
| 583 | } |
| 584 | |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 585 | Error Display::setColorMode(ColorMode mode, RenderIntent renderIntent) |
Dan Stoza | 076ac67 | 2016-03-14 10:47:53 -0700 | [diff] [blame] | 586 | { |
Peiyong Lin | 0e7a791 | 2018-04-05 14:36:36 -0700 | [diff] [blame] | 587 | auto intError = mComposer.setColorMode(mId, mode, renderIntent); |
Dan Stoza | 076ac67 | 2016-03-14 10:47:53 -0700 | [diff] [blame] | 588 | return static_cast<Error>(intError); |
| 589 | } |
| 590 | |
Dan Stoza | 5df2a86 | 2016-03-24 16:19:37 -0700 | [diff] [blame] | 591 | Error Display::setColorTransform(const android::mat4& matrix, |
| 592 | android_color_transform_t hint) |
| 593 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 594 | auto intError = mComposer.setColorTransform(mId, |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 595 | matrix.asArray(), static_cast<Hwc2::ColorTransform>(hint)); |
Dan Stoza | 5df2a86 | 2016-03-24 16:19:37 -0700 | [diff] [blame] | 596 | return static_cast<Error>(intError); |
| 597 | } |
| 598 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 599 | Error Display::setOutputBuffer(const sp<GraphicBuffer>& buffer, |
| 600 | const sp<Fence>& releaseFence) |
| 601 | { |
| 602 | int32_t fenceFd = releaseFence->dup(); |
| 603 | auto handle = buffer->getNativeBuffer()->handle; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 604 | auto intError = mComposer.setOutputBuffer(mId, handle, fenceFd); |
Dan Stoza | 3862898 | 2016-07-13 15:48:58 -0700 | [diff] [blame] | 605 | close(fenceFd); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 606 | return static_cast<Error>(intError); |
| 607 | } |
| 608 | |
| 609 | Error Display::setPowerMode(PowerMode mode) |
| 610 | { |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 611 | auto intMode = static_cast<Hwc2::IComposerClient::PowerMode>(mode); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 612 | auto intError = mComposer.setPowerMode(mId, intMode); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 613 | return static_cast<Error>(intError); |
| 614 | } |
| 615 | |
| 616 | Error Display::setVsyncEnabled(Vsync enabled) |
| 617 | { |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 618 | auto intEnabled = static_cast<Hwc2::IComposerClient::Vsync>(enabled); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 619 | auto intError = mComposer.setVsyncEnabled(mId, intEnabled); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 620 | return static_cast<Error>(intError); |
| 621 | } |
| 622 | |
| 623 | Error Display::validate(uint32_t* outNumTypes, uint32_t* outNumRequests) |
| 624 | { |
| 625 | uint32_t numTypes = 0; |
| 626 | uint32_t numRequests = 0; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 627 | auto intError = mComposer.validateDisplay(mId, &numTypes, &numRequests); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 628 | auto error = static_cast<Error>(intError); |
| 629 | if (error != Error::None && error != Error::HasChanges) { |
| 630 | return error; |
| 631 | } |
| 632 | |
| 633 | *outNumTypes = numTypes; |
| 634 | *outNumRequests = numRequests; |
| 635 | return error; |
| 636 | } |
| 637 | |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 638 | Error Display::presentOrValidate(uint32_t* outNumTypes, uint32_t* outNumRequests, |
| 639 | sp<android::Fence>* outPresentFence, uint32_t* state) { |
| 640 | |
| 641 | uint32_t numTypes = 0; |
| 642 | uint32_t numRequests = 0; |
| 643 | int32_t presentFenceFd = -1; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 644 | auto intError = mComposer.presentOrValidateDisplay( |
| 645 | mId, &numTypes, &numRequests, &presentFenceFd, state); |
Fabien Sanglard | 249c0ae | 2017-06-19 19:22:36 -0700 | [diff] [blame] | 646 | auto error = static_cast<Error>(intError); |
| 647 | if (error != Error::None && error != Error::HasChanges) { |
| 648 | return error; |
| 649 | } |
| 650 | |
| 651 | if (*state == 1) { |
| 652 | *outPresentFence = new Fence(presentFenceFd); |
| 653 | } |
| 654 | |
| 655 | if (*state == 0) { |
| 656 | *outNumTypes = numTypes; |
| 657 | *outNumRequests = numRequests; |
| 658 | } |
| 659 | return error; |
| 660 | } |
Chia-I Wu | 0c6ce46 | 2017-06-22 10:48:28 -0700 | [diff] [blame] | 661 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 662 | // For use by Device |
| 663 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 664 | void Display::setConnected(bool connected) { |
Steven Thomas | b6c6ad4 | 2018-01-29 12:22:00 -0800 | [diff] [blame] | 665 | if (!mIsConnected && connected) { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 666 | mComposer.setClientTargetSlotCount(mId); |
Steven Thomas | b6c6ad4 | 2018-01-29 12:22:00 -0800 | [diff] [blame] | 667 | if (mType == DisplayType::Physical) { |
| 668 | loadConfigs(); |
| 669 | } |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 670 | } |
| 671 | mIsConnected = connected; |
| 672 | } |
| 673 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 674 | int32_t Display::getAttribute(hwc2_config_t configId, Attribute attribute) |
| 675 | { |
| 676 | int32_t value = 0; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 677 | auto intError = mComposer.getDisplayAttribute(mId, configId, |
Chia-I Wu | 67e376d | 2016-12-19 11:36:22 +0800 | [diff] [blame] | 678 | static_cast<Hwc2::IComposerClient::Attribute>(attribute), |
| 679 | &value); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 680 | auto error = static_cast<Error>(intError); |
| 681 | if (error != Error::None) { |
| 682 | ALOGE("getDisplayAttribute(%" PRIu64 ", %u, %s) failed: %s (%d)", mId, |
| 683 | configId, to_string(attribute).c_str(), |
| 684 | to_string(error).c_str(), intError); |
| 685 | return -1; |
| 686 | } |
| 687 | return value; |
| 688 | } |
| 689 | |
| 690 | void Display::loadConfig(hwc2_config_t configId) |
| 691 | { |
| 692 | ALOGV("[%" PRIu64 "] loadConfig(%u)", mId, configId); |
| 693 | |
| 694 | auto config = Config::Builder(*this, configId) |
| 695 | .setWidth(getAttribute(configId, Attribute::Width)) |
| 696 | .setHeight(getAttribute(configId, Attribute::Height)) |
| 697 | .setVsyncPeriod(getAttribute(configId, Attribute::VsyncPeriod)) |
| 698 | .setDpiX(getAttribute(configId, Attribute::DpiX)) |
| 699 | .setDpiY(getAttribute(configId, Attribute::DpiY)) |
| 700 | .build(); |
| 701 | mConfigs.emplace(configId, std::move(config)); |
| 702 | } |
| 703 | |
| 704 | void Display::loadConfigs() |
| 705 | { |
| 706 | ALOGV("[%" PRIu64 "] loadConfigs", mId); |
| 707 | |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 708 | std::vector<Hwc2::Config> configIds; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 709 | auto intError = mComposer.getDisplayConfigs(mId, &configIds); |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 710 | auto error = static_cast<Error>(intError); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 711 | if (error != Error::None) { |
| 712 | ALOGE("[%" PRIu64 "] getDisplayConfigs [2] failed: %s (%d)", mId, |
| 713 | to_string(error).c_str(), intError); |
| 714 | return; |
| 715 | } |
| 716 | |
| 717 | for (auto configId : configIds) { |
| 718 | loadConfig(configId); |
| 719 | } |
| 720 | } |
| 721 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 722 | // Other Display methods |
| 723 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 724 | Layer* Display::getLayerById(hwc2_layer_t id) const |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 725 | { |
| 726 | if (mLayers.count(id) == 0) { |
| 727 | return nullptr; |
| 728 | } |
| 729 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 730 | return mLayers.at(id).get(); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 731 | } |
| 732 | |
| 733 | // Layer methods |
| 734 | |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame] | 735 | Layer::Layer(android::Hwc2::Composer& composer, const std::unordered_set<Capability>& capabilities, |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 736 | hwc2_display_t displayId, hwc2_layer_t layerId) |
| 737 | : mComposer(composer), |
| 738 | mCapabilities(capabilities), |
| 739 | mDisplayId(displayId), |
| 740 | mId(layerId) |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 741 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 742 | ALOGV("Created layer %" PRIu64 " on display %" PRIu64, layerId, displayId); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 743 | } |
| 744 | |
| 745 | Layer::~Layer() |
| 746 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 747 | auto intError = mComposer.destroyLayer(mDisplayId, mId); |
| 748 | auto error = static_cast<Error>(intError); |
| 749 | ALOGE_IF(error != Error::None, "destroyLayer(%" PRIu64 ", %" PRIu64 ")" |
| 750 | " failed: %s (%d)", mDisplayId, mId, to_string(error).c_str(), |
| 751 | intError); |
| 752 | if (mLayerDestroyedListener) { |
| 753 | mLayerDestroyedListener(this); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 754 | } |
| 755 | } |
| 756 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 757 | void Layer::setLayerDestroyedListener(std::function<void(Layer*)> listener) { |
| 758 | LOG_ALWAYS_FATAL_IF(mLayerDestroyedListener && listener, |
| 759 | "Attempt to set layer destroyed listener multiple times"); |
| 760 | mLayerDestroyedListener = listener; |
| 761 | } |
| 762 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 763 | Error Layer::setCursorPosition(int32_t x, int32_t y) |
| 764 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 765 | auto intError = mComposer.setCursorPosition(mDisplayId, mId, x, y); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 766 | return static_cast<Error>(intError); |
| 767 | } |
| 768 | |
Daniel Nicoara | 1f42e3a | 2017-04-10 13:27:32 -0400 | [diff] [blame] | 769 | Error Layer::setBuffer(uint32_t slot, const sp<GraphicBuffer>& buffer, |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 770 | const sp<Fence>& acquireFence) |
| 771 | { |
| 772 | int32_t fenceFd = acquireFence->dup(); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 773 | auto intError = mComposer.setLayerBuffer(mDisplayId, mId, slot, buffer, |
| 774 | fenceFd); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 775 | return static_cast<Error>(intError); |
| 776 | } |
| 777 | |
| 778 | Error Layer::setSurfaceDamage(const Region& damage) |
| 779 | { |
| 780 | // We encode default full-screen damage as INVALID_RECT upstream, but as 0 |
| 781 | // rects for HWC |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 782 | Hwc2::Error intError = Hwc2::Error::NONE; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 783 | if (damage.isRect() && damage.getBounds() == Rect::INVALID_RECT) { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 784 | intError = mComposer.setLayerSurfaceDamage(mDisplayId, |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 785 | mId, std::vector<Hwc2::IComposerClient::Rect>()); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 786 | } else { |
| 787 | size_t rectCount = 0; |
| 788 | auto rectArray = damage.getArray(&rectCount); |
| 789 | |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 790 | std::vector<Hwc2::IComposerClient::Rect> hwcRects; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 791 | for (size_t rect = 0; rect < rectCount; ++rect) { |
| 792 | hwcRects.push_back({rectArray[rect].left, rectArray[rect].top, |
| 793 | rectArray[rect].right, rectArray[rect].bottom}); |
| 794 | } |
| 795 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 796 | intError = mComposer.setLayerSurfaceDamage(mDisplayId, mId, hwcRects); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | return static_cast<Error>(intError); |
| 800 | } |
| 801 | |
| 802 | Error Layer::setBlendMode(BlendMode mode) |
| 803 | { |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 804 | auto intMode = static_cast<Hwc2::IComposerClient::BlendMode>(mode); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 805 | auto intError = mComposer.setLayerBlendMode(mDisplayId, mId, intMode); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 806 | return static_cast<Error>(intError); |
| 807 | } |
| 808 | |
| 809 | Error Layer::setColor(hwc_color_t color) |
| 810 | { |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 811 | Hwc2::IComposerClient::Color hwcColor{color.r, color.g, color.b, color.a}; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 812 | auto intError = mComposer.setLayerColor(mDisplayId, mId, hwcColor); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 813 | return static_cast<Error>(intError); |
| 814 | } |
| 815 | |
| 816 | Error Layer::setCompositionType(Composition type) |
| 817 | { |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 818 | auto intType = static_cast<Hwc2::IComposerClient::Composition>(type); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 819 | auto intError = mComposer.setLayerCompositionType( |
| 820 | mDisplayId, mId, intType); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 821 | return static_cast<Error>(intError); |
| 822 | } |
| 823 | |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 824 | Error Layer::setDataspace(Dataspace dataspace) |
Dan Stoza | 5df2a86 | 2016-03-24 16:19:37 -0700 | [diff] [blame] | 825 | { |
Courtney Goeltzenleuchter | c988ee4 | 2017-05-31 17:56:46 -0600 | [diff] [blame] | 826 | if (dataspace == mDataSpace) { |
| 827 | return Error::None; |
| 828 | } |
| 829 | mDataSpace = dataspace; |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 830 | auto intError = mComposer.setLayerDataspace(mDisplayId, mId, mDataSpace); |
Dan Stoza | 5df2a86 | 2016-03-24 16:19:37 -0700 | [diff] [blame] | 831 | return static_cast<Error>(intError); |
| 832 | } |
| 833 | |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 834 | Error Layer::setPerFrameMetadata(const int32_t supportedPerFrameMetadata, |
| 835 | const android::HdrMetadata& metadata) |
| 836 | { |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame] | 837 | if (metadata == mHdrMetadata) { |
| 838 | return Error::None; |
| 839 | } |
| 840 | |
| 841 | mHdrMetadata = metadata; |
Peiyong Lin | 0ac5f4e | 2018-04-19 22:06:34 -0700 | [diff] [blame] | 842 | int validTypes = mHdrMetadata.validTypes & supportedPerFrameMetadata; |
| 843 | std::vector<Hwc2::PerFrameMetadata> perFrameMetadatas; |
| 844 | if (validTypes & HdrMetadata::SMPTE2086) { |
| 845 | perFrameMetadatas.insert(perFrameMetadatas.end(), |
| 846 | {{Hwc2::PerFrameMetadataKey::DISPLAY_RED_PRIMARY_X, |
| 847 | mHdrMetadata.smpte2086.displayPrimaryRed.x}, |
| 848 | {Hwc2::PerFrameMetadataKey::DISPLAY_RED_PRIMARY_Y, |
| 849 | mHdrMetadata.smpte2086.displayPrimaryRed.y}, |
| 850 | {Hwc2::PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_X, |
| 851 | mHdrMetadata.smpte2086.displayPrimaryGreen.x}, |
| 852 | {Hwc2::PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_Y, |
| 853 | mHdrMetadata.smpte2086.displayPrimaryGreen.y}, |
| 854 | {Hwc2::PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_X, |
| 855 | mHdrMetadata.smpte2086.displayPrimaryBlue.x}, |
| 856 | {Hwc2::PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_Y, |
| 857 | mHdrMetadata.smpte2086.displayPrimaryBlue.y}, |
| 858 | {Hwc2::PerFrameMetadataKey::WHITE_POINT_X, |
| 859 | mHdrMetadata.smpte2086.whitePoint.x}, |
| 860 | {Hwc2::PerFrameMetadataKey::WHITE_POINT_Y, |
| 861 | mHdrMetadata.smpte2086.whitePoint.y}, |
| 862 | {Hwc2::PerFrameMetadataKey::MAX_LUMINANCE, |
| 863 | mHdrMetadata.smpte2086.maxLuminance}, |
| 864 | {Hwc2::PerFrameMetadataKey::MIN_LUMINANCE, |
| 865 | mHdrMetadata.smpte2086.minLuminance}}); |
| 866 | } |
| 867 | |
| 868 | if (validTypes & HdrMetadata::CTA861_3) { |
| 869 | perFrameMetadatas.insert(perFrameMetadatas.end(), |
| 870 | {{Hwc2::PerFrameMetadataKey::MAX_CONTENT_LIGHT_LEVEL, |
| 871 | mHdrMetadata.cta8613.maxContentLightLevel}, |
| 872 | {Hwc2::PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL, |
| 873 | mHdrMetadata.cta8613.maxFrameAverageLightLevel}}); |
| 874 | } |
| 875 | |
| 876 | auto intError = mComposer.setLayerPerFrameMetadata(mDisplayId, mId, perFrameMetadatas); |
Courtney Goeltzenleuchter | f9c98e5 | 2018-02-12 07:23:17 -0700 | [diff] [blame] | 877 | return static_cast<Error>(intError); |
| 878 | } |
| 879 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 880 | Error Layer::setDisplayFrame(const Rect& frame) |
| 881 | { |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 882 | Hwc2::IComposerClient::Rect hwcRect{frame.left, frame.top, |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 883 | frame.right, frame.bottom}; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 884 | auto intError = mComposer.setLayerDisplayFrame(mDisplayId, mId, hwcRect); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 885 | return static_cast<Error>(intError); |
| 886 | } |
| 887 | |
| 888 | Error Layer::setPlaneAlpha(float alpha) |
| 889 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 890 | auto intError = mComposer.setLayerPlaneAlpha(mDisplayId, mId, alpha); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 891 | return static_cast<Error>(intError); |
| 892 | } |
| 893 | |
| 894 | Error Layer::setSidebandStream(const native_handle_t* stream) |
| 895 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 896 | if (mCapabilities.count(Capability::SidebandStream) == 0) { |
Dan Stoza | 09e7a27 | 2016-04-14 12:31:01 -0700 | [diff] [blame] | 897 | ALOGE("Attempted to call setSidebandStream without checking that the " |
| 898 | "device supports sideband streams"); |
| 899 | return Error::Unsupported; |
| 900 | } |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 901 | auto intError = mComposer.setLayerSidebandStream(mDisplayId, mId, stream); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 902 | return static_cast<Error>(intError); |
| 903 | } |
| 904 | |
| 905 | Error Layer::setSourceCrop(const FloatRect& crop) |
| 906 | { |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 907 | Hwc2::IComposerClient::FRect hwcRect{ |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 908 | crop.left, crop.top, crop.right, crop.bottom}; |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 909 | auto intError = mComposer.setLayerSourceCrop(mDisplayId, mId, hwcRect); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 910 | return static_cast<Error>(intError); |
| 911 | } |
| 912 | |
| 913 | Error Layer::setTransform(Transform transform) |
| 914 | { |
Chia-I Wu | aab99f5 | 2016-10-05 12:59:58 +0800 | [diff] [blame] | 915 | auto intTransform = static_cast<Hwc2::Transform>(transform); |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 916 | auto intError = mComposer.setLayerTransform(mDisplayId, mId, intTransform); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 917 | return static_cast<Error>(intError); |
| 918 | } |
| 919 | |
| 920 | Error Layer::setVisibleRegion(const Region& region) |
| 921 | { |
| 922 | size_t rectCount = 0; |
| 923 | auto rectArray = region.getArray(&rectCount); |
| 924 | |
Chia-I Wu | cd8d7f0 | 2016-11-16 11:02:31 +0800 | [diff] [blame] | 925 | std::vector<Hwc2::IComposerClient::Rect> hwcRects; |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 926 | for (size_t rect = 0; rect < rectCount; ++rect) { |
| 927 | hwcRects.push_back({rectArray[rect].left, rectArray[rect].top, |
| 928 | rectArray[rect].right, rectArray[rect].bottom}); |
| 929 | } |
| 930 | |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 931 | auto intError = mComposer.setLayerVisibleRegion(mDisplayId, mId, hwcRects); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 932 | return static_cast<Error>(intError); |
| 933 | } |
| 934 | |
| 935 | Error Layer::setZOrder(uint32_t z) |
| 936 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 937 | auto intError = mComposer.setLayerZOrder(mDisplayId, mId, z); |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 938 | return static_cast<Error>(intError); |
| 939 | } |
| 940 | |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 941 | Error Layer::setInfo(uint32_t type, uint32_t appId) |
| 942 | { |
Steven Thomas | 94e35b9 | 2017-07-26 18:48:28 -0700 | [diff] [blame] | 943 | auto intError = mComposer.setLayerInfo(mDisplayId, mId, type, appId); |
Daniel Nicoara | 2f5f8a5 | 2016-12-20 16:11:58 -0500 | [diff] [blame] | 944 | return static_cast<Error>(intError); |
| 945 | } |
| 946 | |
Dan Stoza | 651bf31 | 2015-10-23 17:03:17 -0700 | [diff] [blame] | 947 | } // namespace HWC2 |