| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2007 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 |  | 
| Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 17 | // #define LOG_NDEBUG 0 | 
|  | 18 | #undef LOG_TAG | 
|  | 19 | #define LOG_TAG "DisplayDevice" | 
|  | 20 |  | 
| Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 21 | #include "DisplayDevice.h" | 
|  | 22 |  | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 23 | #include <array> | 
|  | 24 | #include <unordered_set> | 
|  | 25 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | #include <stdlib.h> | 
|  | 27 | #include <stdio.h> | 
|  | 28 | #include <string.h> | 
|  | 29 | #include <math.h> | 
|  | 30 |  | 
| Dominik Laskowski | 9b17b2c2 | 2018-11-01 14:49:03 -0700 | [diff] [blame] | 31 | #include <android-base/stringprintf.h> | 
| Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 32 | #include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> | 
|  | 33 | #include <configstore/Utils.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | #include <cutils/properties.h> | 
| Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 35 | #include <gui/Surface.h> | 
|  | 36 | #include <hardware/gralloc.h> | 
|  | 37 | #include <renderengine/RenderEngine.h> | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 38 | #include <sync/sync.h> | 
|  | 39 | #include <system/window.h> | 
| Courtney Goeltzenleuchter | 152279d | 2017-08-14 18:18:30 -0600 | [diff] [blame] | 40 | #include <ui/DebugUtils.h> | 
| Mathias Agopian | c666cae | 2012-07-25 18:56:13 -0700 | [diff] [blame] | 41 | #include <ui/DisplayInfo.h> | 
| Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 42 | #include <ui/PixelFormat.h> | 
| Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 43 | #include <utils/Log.h> | 
| Valerie Hau | 9758ae0 | 2018-10-09 16:05:09 -0700 | [diff] [blame] | 44 | #include <utils/RefBase.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 |  | 
| Jesse Hall | 99c7dbb | 2013-03-14 14:29:29 -0700 | [diff] [blame] | 46 | #include "DisplayHardware/DisplaySurface.h" | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 47 | #include "DisplayHardware/HWComposer.h" | 
| Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 48 | #include "DisplayHardware/HWC2.h" | 
| Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 49 | #include "SurfaceFlinger.h" | 
| Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 50 | #include "Layer.h" | 
| Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 51 |  | 
| Peiyong Lin | fd997e0 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 52 | namespace android { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 |  | 
| Jaesoo Lee | 720a724 | 2017-01-31 15:26:18 +0900 | [diff] [blame] | 54 | // retrieve triple buffer setting from configstore | 
|  | 55 | using namespace android::hardware::configstore; | 
|  | 56 | using namespace android::hardware::configstore::V1_0; | 
| Yiwei Zhang | 5434a78 | 2018-12-05 18:06:32 -0800 | [diff] [blame] | 57 | using android::base::StringAppendF; | 
| Peiyong Lin | fd997e0 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 58 | using android::ui::ColorMode; | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 59 | using android::ui::Dataspace; | 
| Peiyong Lin | 6266589 | 2018-04-16 11:07:44 -0700 | [diff] [blame] | 60 | using android::ui::Hdr; | 
| Peiyong Lin | dd9b2ae | 2018-03-01 16:22:45 -0800 | [diff] [blame] | 61 | using android::ui::RenderIntent; | 
| Jaesoo Lee | 720a724 | 2017-01-31 15:26:18 +0900 | [diff] [blame] | 62 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | /* | 
|  | 64 | * Initialize the display to the specified values. | 
|  | 65 | * | 
|  | 66 | */ | 
|  | 67 |  | 
| Pablo Ceballos | 021623b | 2016-04-15 17:31:51 -0700 | [diff] [blame] | 68 | uint32_t DisplayDevice::sPrimaryDisplayOrientation = 0; | 
|  | 69 |  | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 70 | namespace { | 
|  | 71 |  | 
|  | 72 | // ordered list of known SDR color modes | 
| Valerie Hau | 9758ae0 | 2018-10-09 16:05:09 -0700 | [diff] [blame] | 73 | const std::array<ColorMode, 3> sSdrColorModes = { | 
|  | 74 | ColorMode::DISPLAY_BT2020, | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 75 | ColorMode::DISPLAY_P3, | 
|  | 76 | ColorMode::SRGB, | 
|  | 77 | }; | 
|  | 78 |  | 
|  | 79 | // ordered list of known HDR color modes | 
|  | 80 | const std::array<ColorMode, 2> sHdrColorModes = { | 
|  | 81 | ColorMode::BT2100_PQ, | 
|  | 82 | ColorMode::BT2100_HLG, | 
|  | 83 | }; | 
|  | 84 |  | 
|  | 85 | // ordered list of known SDR render intents | 
|  | 86 | const std::array<RenderIntent, 2> sSdrRenderIntents = { | 
|  | 87 | RenderIntent::ENHANCE, | 
|  | 88 | RenderIntent::COLORIMETRIC, | 
|  | 89 | }; | 
|  | 90 |  | 
|  | 91 | // ordered list of known HDR render intents | 
|  | 92 | const std::array<RenderIntent, 2> sHdrRenderIntents = { | 
|  | 93 | RenderIntent::TONE_MAP_ENHANCE, | 
|  | 94 | RenderIntent::TONE_MAP_COLORIMETRIC, | 
|  | 95 | }; | 
|  | 96 |  | 
|  | 97 | // map known color mode to dataspace | 
|  | 98 | Dataspace colorModeToDataspace(ColorMode mode) { | 
|  | 99 | switch (mode) { | 
|  | 100 | case ColorMode::SRGB: | 
|  | 101 | return Dataspace::SRGB; | 
|  | 102 | case ColorMode::DISPLAY_P3: | 
|  | 103 | return Dataspace::DISPLAY_P3; | 
| Valerie Hau | 9758ae0 | 2018-10-09 16:05:09 -0700 | [diff] [blame] | 104 | case ColorMode::DISPLAY_BT2020: | 
|  | 105 | return Dataspace::DISPLAY_BT2020; | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 106 | case ColorMode::BT2100_HLG: | 
|  | 107 | return Dataspace::BT2020_HLG; | 
|  | 108 | case ColorMode::BT2100_PQ: | 
|  | 109 | return Dataspace::BT2020_PQ; | 
|  | 110 | default: | 
|  | 111 | return Dataspace::UNKNOWN; | 
|  | 112 | } | 
|  | 113 | } | 
|  | 114 |  | 
|  | 115 | // Return a list of candidate color modes. | 
|  | 116 | std::vector<ColorMode> getColorModeCandidates(ColorMode mode) { | 
|  | 117 | std::vector<ColorMode> candidates; | 
|  | 118 |  | 
|  | 119 | // add mode itself | 
|  | 120 | candidates.push_back(mode); | 
|  | 121 |  | 
|  | 122 | // check if mode is HDR | 
|  | 123 | bool isHdr = false; | 
|  | 124 | for (auto hdrMode : sHdrColorModes) { | 
|  | 125 | if (hdrMode == mode) { | 
|  | 126 | isHdr = true; | 
|  | 127 | break; | 
|  | 128 | } | 
|  | 129 | } | 
|  | 130 |  | 
|  | 131 | // add other HDR candidates when mode is HDR | 
|  | 132 | if (isHdr) { | 
|  | 133 | for (auto hdrMode : sHdrColorModes) { | 
|  | 134 | if (hdrMode != mode) { | 
|  | 135 | candidates.push_back(hdrMode); | 
|  | 136 | } | 
|  | 137 | } | 
|  | 138 | } | 
|  | 139 |  | 
|  | 140 | // add other SDR candidates | 
|  | 141 | for (auto sdrMode : sSdrColorModes) { | 
|  | 142 | if (sdrMode != mode) { | 
|  | 143 | candidates.push_back(sdrMode); | 
|  | 144 | } | 
|  | 145 | } | 
|  | 146 |  | 
|  | 147 | return candidates; | 
|  | 148 | } | 
|  | 149 |  | 
|  | 150 | // Return a list of candidate render intents. | 
|  | 151 | std::vector<RenderIntent> getRenderIntentCandidates(RenderIntent intent) { | 
|  | 152 | std::vector<RenderIntent> candidates; | 
|  | 153 |  | 
|  | 154 | // add intent itself | 
|  | 155 | candidates.push_back(intent); | 
|  | 156 |  | 
|  | 157 | // check if intent is HDR | 
|  | 158 | bool isHdr = false; | 
|  | 159 | for (auto hdrIntent : sHdrRenderIntents) { | 
|  | 160 | if (hdrIntent == intent) { | 
|  | 161 | isHdr = true; | 
|  | 162 | break; | 
|  | 163 | } | 
|  | 164 | } | 
|  | 165 |  | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 166 | if (isHdr) { | 
| Chia-I Wu | c4b08bd | 2018-05-29 12:57:23 -0700 | [diff] [blame] | 167 | // add other HDR candidates when intent is HDR | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 168 | for (auto hdrIntent : sHdrRenderIntents) { | 
|  | 169 | if (hdrIntent != intent) { | 
|  | 170 | candidates.push_back(hdrIntent); | 
|  | 171 | } | 
|  | 172 | } | 
| Chia-I Wu | c4b08bd | 2018-05-29 12:57:23 -0700 | [diff] [blame] | 173 | } else { | 
|  | 174 | // add other SDR candidates when intent is SDR | 
|  | 175 | for (auto sdrIntent : sSdrRenderIntents) { | 
|  | 176 | if (sdrIntent != intent) { | 
|  | 177 | candidates.push_back(sdrIntent); | 
|  | 178 | } | 
|  | 179 | } | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 180 | } | 
|  | 181 |  | 
|  | 182 | return candidates; | 
|  | 183 | } | 
|  | 184 |  | 
|  | 185 | // Return the best color mode supported by HWC. | 
|  | 186 | ColorMode getHwcColorMode( | 
|  | 187 | const std::unordered_map<ColorMode, std::vector<RenderIntent>>& hwcColorModes, | 
|  | 188 | ColorMode mode) { | 
|  | 189 | std::vector<ColorMode> candidates = getColorModeCandidates(mode); | 
|  | 190 | for (auto candidate : candidates) { | 
|  | 191 | auto iter = hwcColorModes.find(candidate); | 
|  | 192 | if (iter != hwcColorModes.end()) { | 
|  | 193 | return candidate; | 
|  | 194 | } | 
|  | 195 | } | 
|  | 196 |  | 
|  | 197 | return ColorMode::NATIVE; | 
|  | 198 | } | 
|  | 199 |  | 
|  | 200 | // Return the best render intent supported by HWC. | 
|  | 201 | RenderIntent getHwcRenderIntent(const std::vector<RenderIntent>& hwcIntents, RenderIntent intent) { | 
|  | 202 | std::vector<RenderIntent> candidates = getRenderIntentCandidates(intent); | 
|  | 203 | for (auto candidate : candidates) { | 
|  | 204 | for (auto hwcIntent : hwcIntents) { | 
|  | 205 | if (candidate == hwcIntent) { | 
|  | 206 | return candidate; | 
|  | 207 | } | 
|  | 208 | } | 
|  | 209 | } | 
|  | 210 |  | 
|  | 211 | return RenderIntent::COLORIMETRIC; | 
|  | 212 | } | 
|  | 213 |  | 
|  | 214 | } // anonymous namespace | 
|  | 215 |  | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 216 | DisplayDeviceCreationArgs::DisplayDeviceCreationArgs(const sp<SurfaceFlinger>& flinger, | 
|  | 217 | const wp<IBinder>& displayToken, | 
| Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 218 | const std::optional<DisplayId>& displayId) | 
|  | 219 | : flinger(flinger), displayToken(displayToken), displayId(displayId) {} | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 220 |  | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 221 | DisplayDevice::DisplayDevice(DisplayDeviceCreationArgs&& args) | 
|  | 222 | : lastCompositionHadVisibleLayers(false), | 
|  | 223 | mFlinger(args.flinger), | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 224 | mDisplayToken(args.displayToken), | 
| Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 225 | mId(args.displayId), | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 226 | mNativeWindow(args.nativeWindow), | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 227 | mGraphicBuffer(nullptr), | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 228 | mDisplaySurface(args.displaySurface), | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 229 | mDisplayInstallOrientation(args.displayInstallOrientation), | 
|  | 230 | mPageFlipCount(0), | 
| Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 231 | mIsVirtual(args.isVirtual), | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 232 | mIsSecure(args.isSecure), | 
|  | 233 | mLayerStack(NO_LAYER_STACK), | 
|  | 234 | mOrientation(), | 
|  | 235 | mViewport(Rect::INVALID_RECT), | 
|  | 236 | mFrame(Rect::INVALID_RECT), | 
|  | 237 | mPowerMode(args.initialPowerMode), | 
|  | 238 | mActiveConfig(0), | 
|  | 239 | mColorTransform(HAL_COLOR_TRANSFORM_IDENTITY), | 
|  | 240 | mHasWideColorGamut(args.hasWideColorGamut), | 
|  | 241 | mHasHdr10(false), | 
|  | 242 | mHasHLG(false), | 
|  | 243 | mHasDolbyVision(false), | 
| Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 244 | mSupportedPerFrameMetadata(args.supportedPerFrameMetadata), | 
|  | 245 | mIsPrimary(args.isPrimary) { | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 246 | populateColorModes(args.hwcColorModes); | 
|  | 247 |  | 
|  | 248 | ALOGE_IF(!mNativeWindow, "No native window was set for display"); | 
|  | 249 | ALOGE_IF(!mDisplaySurface, "No display surface was set for display"); | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 250 |  | 
|  | 251 | std::vector<Hdr> types = args.hdrCapabilities.getSupportedHdrTypes(); | 
| Peiyong Lin | fb06930 | 2018-04-25 14:34:31 -0700 | [diff] [blame] | 252 | for (Hdr hdrType : types) { | 
| Peiyong Lin | 6266589 | 2018-04-16 11:07:44 -0700 | [diff] [blame] | 253 | switch (hdrType) { | 
|  | 254 | case Hdr::HDR10: | 
|  | 255 | mHasHdr10 = true; | 
|  | 256 | break; | 
|  | 257 | case Hdr::HLG: | 
|  | 258 | mHasHLG = true; | 
|  | 259 | break; | 
|  | 260 | case Hdr::DOLBY_VISION: | 
|  | 261 | mHasDolbyVision = true; | 
|  | 262 | break; | 
|  | 263 | default: | 
|  | 264 | ALOGE("UNKNOWN HDR capability: %d", static_cast<int32_t>(hdrType)); | 
|  | 265 | } | 
|  | 266 | } | 
| Jesse Hall | ffe1f19 | 2013-03-22 15:13:48 -0700 | [diff] [blame] | 267 |  | 
| Lloyd Pique | 2eef1d2 | 2018-09-18 21:30:04 -0700 | [diff] [blame] | 268 | float minLuminance = args.hdrCapabilities.getDesiredMinLuminance(); | 
|  | 269 | float maxLuminance = args.hdrCapabilities.getDesiredMaxLuminance(); | 
|  | 270 | float maxAverageLuminance = args.hdrCapabilities.getDesiredMaxAverageLuminance(); | 
| Peiyong Lin | fb06930 | 2018-04-25 14:34:31 -0700 | [diff] [blame] | 271 |  | 
|  | 272 | minLuminance = minLuminance <= 0.0 ? sDefaultMinLumiance : minLuminance; | 
|  | 273 | maxLuminance = maxLuminance <= 0.0 ? sDefaultMaxLumiance : maxLuminance; | 
|  | 274 | maxAverageLuminance = maxAverageLuminance <= 0.0 ? sDefaultMaxLumiance : maxAverageLuminance; | 
|  | 275 | if (this->hasWideColorGamut()) { | 
|  | 276 | // insert HDR10/HLG as we will force client composition for HDR10/HLG | 
|  | 277 | // layers | 
|  | 278 | if (!hasHDR10Support()) { | 
|  | 279 | types.push_back(Hdr::HDR10); | 
|  | 280 | } | 
|  | 281 |  | 
|  | 282 | if (!hasHLGSupport()) { | 
|  | 283 | types.push_back(Hdr::HLG); | 
|  | 284 | } | 
|  | 285 | } | 
|  | 286 | mHdrCapabilities = HdrCapabilities(types, maxLuminance, maxAverageLuminance, minLuminance); | 
|  | 287 |  | 
| Alec Mouri | ba013fa | 2018-10-16 12:43:11 -0700 | [diff] [blame] | 288 | ANativeWindow* const window = mNativeWindow.get(); | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 289 |  | 
| Alec Mouri | 4efb6c2 | 2018-11-16 13:07:47 -0800 | [diff] [blame] | 290 | int status = native_window_api_connect(window, NATIVE_WINDOW_API_EGL); | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 291 | ALOGE_IF(status != NO_ERROR, "Unable to connect BQ producer: %d", status); | 
| Alec Mouri | 4efb6c2 | 2018-11-16 13:07:47 -0800 | [diff] [blame] | 292 | status = native_window_set_buffers_format(window, HAL_PIXEL_FORMAT_RGBA_8888); | 
|  | 293 | ALOGE_IF(status != NO_ERROR, "Unable to set BQ format to RGBA888: %d", status); | 
|  | 294 | status = native_window_set_usage(window, GRALLOC_USAGE_HW_RENDER); | 
|  | 295 | ALOGE_IF(status != NO_ERROR, "Unable to set BQ usage bits for GPU rendering: %d", status); | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 296 |  | 
| Alec Mouri | ba013fa | 2018-10-16 12:43:11 -0700 | [diff] [blame] | 297 | mDisplayWidth = ANativeWindow_getWidth(window); | 
|  | 298 | mDisplayHeight = ANativeWindow_getHeight(window); | 
|  | 299 |  | 
| Jesse Hall | ffe1f19 | 2013-03-22 15:13:48 -0700 | [diff] [blame] | 300 | // initialize the display orientation transform. | 
|  | 301 | setProjection(DisplayState::eOrientationDefault, mViewport, mFrame); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 302 | } | 
|  | 303 |  | 
| Lloyd Pique | 0959483 | 2018-01-22 17:48:03 -0800 | [diff] [blame] | 304 | DisplayDevice::~DisplayDevice() = default; | 
| Mathias Agopian | 92a979a | 2012-08-02 18:32:23 -0700 | [diff] [blame] | 305 |  | 
| Jesse Hall | 02d8656 | 2013-03-25 14:43:23 -0700 | [diff] [blame] | 306 | void DisplayDevice::disconnect(HWComposer& hwc) { | 
| Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 307 | if (mId) { | 
|  | 308 | hwc.disconnectDisplay(*mId); | 
|  | 309 | mId.reset(); | 
| Jesse Hall | 02d8656 | 2013-03-25 14:43:23 -0700 | [diff] [blame] | 310 | } | 
|  | 311 | } | 
|  | 312 |  | 
| Mathias Agopian | 0f2f5ff | 2012-07-31 23:09:07 -0700 | [diff] [blame] | 313 | int DisplayDevice::getWidth() const { | 
| Mathias Agopian | a491260 | 2012-07-12 14:25:33 -0700 | [diff] [blame] | 314 | return mDisplayWidth; | 
|  | 315 | } | 
|  | 316 |  | 
| Mathias Agopian | 0f2f5ff | 2012-07-31 23:09:07 -0700 | [diff] [blame] | 317 | int DisplayDevice::getHeight() const { | 
| Mathias Agopian | a491260 | 2012-07-12 14:25:33 -0700 | [diff] [blame] | 318 | return mDisplayHeight; | 
|  | 319 | } | 
|  | 320 |  | 
| Dominik Laskowski | bf170d9 | 2018-04-19 15:08:05 -0700 | [diff] [blame] | 321 | void DisplayDevice::setDisplayName(const std::string& displayName) { | 
|  | 322 | if (!displayName.empty()) { | 
| Mathias Agopian | 9e2463e | 2012-09-21 18:26:16 -0700 | [diff] [blame] | 323 | // never override the name with an empty name | 
|  | 324 | mDisplayName = displayName; | 
|  | 325 | } | 
|  | 326 | } | 
|  | 327 |  | 
| Mathias Agopian | 0f2f5ff | 2012-07-31 23:09:07 -0700 | [diff] [blame] | 328 | uint32_t DisplayDevice::getPageFlipCount() const { | 
| Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 329 | return mPageFlipCount; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 330 | } | 
|  | 331 |  | 
| Chia-I Wu | b02087d | 2017-11-09 10:19:54 -0800 | [diff] [blame] | 332 | void DisplayDevice::flip() const | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 333 | { | 
| Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 334 | mPageFlipCount++; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 335 | } | 
|  | 336 |  | 
| Dan Stoza | 7143316 | 2014-02-04 16:22:36 -0800 | [diff] [blame] | 337 | status_t DisplayDevice::beginFrame(bool mustRecompose) const { | 
|  | 338 | return mDisplaySurface->beginFrame(mustRecompose); | 
| Jesse Hall | 028dc8f | 2013-08-20 16:35:32 -0700 | [diff] [blame] | 339 | } | 
|  | 340 |  | 
| David Sodman | fb95bcc | 2017-12-22 15:45:30 -0800 | [diff] [blame] | 341 | status_t DisplayDevice::prepareFrame(HWComposer& hwc, | 
|  | 342 | std::vector<CompositionInfo>& compositionData) { | 
| Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 343 | if (mId) { | 
|  | 344 | status_t error = hwc.prepare(*mId, compositionData); | 
|  | 345 | if (error != NO_ERROR) { | 
|  | 346 | return error; | 
|  | 347 | } | 
| Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 348 | } | 
|  | 349 |  | 
|  | 350 | DisplaySurface::CompositionType compositionType; | 
| Dominik Laskowski | 7e04546 | 2018-05-30 13:02:02 -0700 | [diff] [blame] | 351 | bool hasClient = hwc.hasClientComposition(mId); | 
|  | 352 | bool hasDevice = hwc.hasDeviceComposition(mId); | 
| Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 353 | if (hasClient && hasDevice) { | 
|  | 354 | compositionType = DisplaySurface::COMPOSITION_MIXED; | 
|  | 355 | } else if (hasClient) { | 
|  | 356 | compositionType = DisplaySurface::COMPOSITION_GLES; | 
|  | 357 | } else if (hasDevice) { | 
|  | 358 | compositionType = DisplaySurface::COMPOSITION_HWC; | 
|  | 359 | } else { | 
|  | 360 | // Nothing to do -- when turning the screen off we get a frame like | 
|  | 361 | // this. Call it a HWC frame since we won't be doing any GLES work but | 
|  | 362 | // will do a prepare/set cycle. | 
|  | 363 | compositionType = DisplaySurface::COMPOSITION_HWC; | 
|  | 364 | } | 
|  | 365 | return mDisplaySurface->prepareFrame(compositionType); | 
|  | 366 | } | 
| Jesse Hall | 38efe86 | 2013-04-06 23:12:29 -0700 | [diff] [blame] | 367 |  | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 368 | sp<GraphicBuffer> DisplayDevice::dequeueBuffer() { | 
|  | 369 | int fd; | 
|  | 370 | ANativeWindowBuffer* buffer; | 
|  | 371 |  | 
|  | 372 | status_t res = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buffer, &fd); | 
|  | 373 |  | 
|  | 374 | if (res != NO_ERROR) { | 
|  | 375 | ALOGE("ANativeWindow::dequeueBuffer failed for display [%s] with error: %d", | 
|  | 376 | getDisplayName().c_str(), res); | 
|  | 377 | // Return fast here as we can't do much more - any rendering we do | 
|  | 378 | // now will just be wrong. | 
|  | 379 | return mGraphicBuffer; | 
|  | 380 | } | 
|  | 381 |  | 
|  | 382 | ALOGW_IF(mGraphicBuffer != nullptr, "Clobbering a non-null pointer to a buffer [%p].", | 
|  | 383 | mGraphicBuffer->getNativeBuffer()->handle); | 
|  | 384 | mGraphicBuffer = GraphicBuffer::from(buffer); | 
|  | 385 |  | 
|  | 386 | // Block until the buffer is ready | 
|  | 387 | // TODO(alecmouri): it's perhaps more appropriate to block renderengine so | 
|  | 388 | // that the gl driver can block instead. | 
|  | 389 | if (fd >= 0) { | 
|  | 390 | sync_wait(fd, -1); | 
|  | 391 | close(fd); | 
|  | 392 | } | 
|  | 393 |  | 
|  | 394 | return mGraphicBuffer; | 
|  | 395 | } | 
|  | 396 |  | 
|  | 397 | void DisplayDevice::queueBuffer(HWComposer& hwc) { | 
| Dominik Laskowski | 7e04546 | 2018-05-30 13:02:02 -0700 | [diff] [blame] | 398 | if (hwc.hasClientComposition(mId) || hwc.hasFlipClientTargetRequest(mId)) { | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 399 | // hasFlipClientTargetRequest could return true even if we haven't | 
|  | 400 | // dequeued a buffer before. Try dequeueing one if we don't have a | 
|  | 401 | // buffer ready. | 
|  | 402 | if (mGraphicBuffer == nullptr) { | 
|  | 403 | ALOGI("Attempting to queue a client composited buffer without one " | 
|  | 404 | "previously dequeued for display [%s]. Attempting to dequeue " | 
|  | 405 | "a scratch buffer now", | 
|  | 406 | mDisplayName.c_str()); | 
|  | 407 | // We shouldn't deadlock here, since mGraphicBuffer == nullptr only | 
|  | 408 | // after a successful call to queueBuffer, or if dequeueBuffer has | 
|  | 409 | // never been called. | 
|  | 410 | dequeueBuffer(); | 
|  | 411 | } | 
|  | 412 |  | 
|  | 413 | if (mGraphicBuffer == nullptr) { | 
|  | 414 | ALOGE("No buffer is ready for display [%s]", mDisplayName.c_str()); | 
|  | 415 | } else { | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 416 | status_t res = mNativeWindow->queueBuffer(mNativeWindow.get(), | 
| Alec Mouri | 745163a | 2018-12-04 15:15:50 -0800 | [diff] [blame] | 417 | mGraphicBuffer->getNativeBuffer(), | 
|  | 418 | dup(mBufferReady)); | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 419 | if (res != NO_ERROR) { | 
|  | 420 | ALOGE("Error when queueing buffer for display [%s]: %d", mDisplayName.c_str(), res); | 
|  | 421 | // We risk blocking on dequeueBuffer if the primary display failed | 
|  | 422 | // to queue up its buffer, so crash here. | 
|  | 423 | if (isPrimary()) { | 
|  | 424 | LOG_ALWAYS_FATAL("ANativeWindow::queueBuffer failed with error: %d", res); | 
|  | 425 | } else { | 
|  | 426 | mNativeWindow->cancelBuffer(mNativeWindow.get(), | 
| Alec Mouri | 745163a | 2018-12-04 15:15:50 -0800 | [diff] [blame] | 427 | mGraphicBuffer->getNativeBuffer(), | 
|  | 428 | dup(mBufferReady)); | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 429 | } | 
|  | 430 | } | 
| Alec Mouri | 745163a | 2018-12-04 15:15:50 -0800 | [diff] [blame] | 431 |  | 
|  | 432 | mBufferReady.reset(); | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 433 | mGraphicBuffer = nullptr; | 
|  | 434 | } | 
| Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 435 | } | 
| Mathias Agopian | 52e2148 | 2012-09-24 18:07:21 -0700 | [diff] [blame] | 436 |  | 
| Jesse Hall | 99c7dbb | 2013-03-14 14:29:29 -0700 | [diff] [blame] | 437 | status_t result = mDisplaySurface->advanceFrame(); | 
|  | 438 | if (result != NO_ERROR) { | 
| Dominik Laskowski | bf170d9 | 2018-04-19 15:08:05 -0700 | [diff] [blame] | 439 | ALOGE("[%s] failed pushing new frame to HWC: %d", mDisplayName.c_str(), result); | 
| Mathias Agopian | 3234138 | 2012-09-25 19:16:28 -0700 | [diff] [blame] | 440 | } | 
| Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 441 | } | 
|  | 442 |  | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 443 | void DisplayDevice::onPresentDisplayCompleted() { | 
| Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 444 | mDisplaySurface->onFrameCommitted(); | 
|  | 445 | } | 
| Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 446 |  | 
| Mathias Agopian | 875d8e1 | 2013-06-07 15:35:48 -0700 | [diff] [blame] | 447 | void DisplayDevice::setViewportAndProjection() const { | 
|  | 448 | size_t w = mDisplayWidth; | 
|  | 449 | size_t h = mDisplayHeight; | 
| Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 450 | Rect sourceCrop(0, 0, w, h); | 
| Chia-I Wu | 1be50b5 | 2018-08-29 10:44:48 -0700 | [diff] [blame] | 451 | mFlinger->getRenderEngine().setViewportAndProjection(w, h, sourceCrop, ui::Transform::ROT_0); | 
| Mathias Agopian | bae92d0 | 2012-09-28 01:00:47 -0700 | [diff] [blame] | 452 | } | 
|  | 453 |  | 
| Alec Mouri | 0a9c7b8 | 2018-11-16 13:05:25 -0800 | [diff] [blame] | 454 | void DisplayDevice::finishBuffer() { | 
|  | 455 | mBufferReady = mFlinger->getRenderEngine().flush(); | 
|  | 456 | if (mBufferReady.get() < 0) { | 
|  | 457 | mFlinger->getRenderEngine().finish(); | 
|  | 458 | } | 
|  | 459 | } | 
|  | 460 |  | 
| Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 461 | const sp<Fence>& DisplayDevice::getClientTargetAcquireFence() const { | 
|  | 462 | return mDisplaySurface->getClientTargetAcquireFence(); | 
|  | 463 | } | 
| Dan Stoza | 9e56aa0 | 2015-11-02 13:00:03 -0800 | [diff] [blame] | 464 |  | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 465 | // ---------------------------------------------------------------------------- | 
|  | 466 |  | 
| Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 467 | void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers) { | 
| Mathias Agopian | 3b1d2b6 | 2012-07-11 13:48:17 -0700 | [diff] [blame] | 468 | mVisibleLayersSortedByZ = layers; | 
| Mathias Agopian | 3b1d2b6 | 2012-07-11 13:48:17 -0700 | [diff] [blame] | 469 | } | 
|  | 470 |  | 
| Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 471 | const Vector< sp<Layer> >& DisplayDevice::getVisibleLayersSortedByZ() const { | 
| Mathias Agopian | 3b1d2b6 | 2012-07-11 13:48:17 -0700 | [diff] [blame] | 472 | return mVisibleLayersSortedByZ; | 
|  | 473 | } | 
|  | 474 |  | 
| Chia-I Wu | 8380689 | 2017-11-16 10:50:20 -0800 | [diff] [blame] | 475 | void DisplayDevice::setLayersNeedingFences(const Vector< sp<Layer> >& layers) { | 
|  | 476 | mLayersNeedingFences = layers; | 
|  | 477 | } | 
|  | 478 |  | 
|  | 479 | const Vector< sp<Layer> >& DisplayDevice::getLayersNeedingFences() const { | 
|  | 480 | return mLayersNeedingFences; | 
|  | 481 | } | 
|  | 482 |  | 
| Mathias Agopian | cd60f99 | 2012-08-16 16:28:27 -0700 | [diff] [blame] | 483 | Region DisplayDevice::getDirtyRegion(bool repaintEverything) const { | 
|  | 484 | Region dirty; | 
| Mathias Agopian | cd60f99 | 2012-08-16 16:28:27 -0700 | [diff] [blame] | 485 | if (repaintEverything) { | 
|  | 486 | dirty.set(getBounds()); | 
|  | 487 | } else { | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 488 | const ui::Transform& planeTransform(mGlobalTransform); | 
| Mathias Agopian | cd60f99 | 2012-08-16 16:28:27 -0700 | [diff] [blame] | 489 | dirty = planeTransform.transform(this->dirtyRegion); | 
|  | 490 | dirty.andSelf(getBounds()); | 
|  | 491 | } | 
|  | 492 | return dirty; | 
|  | 493 | } | 
|  | 494 |  | 
| Mathias Agopian | 3b1d2b6 | 2012-07-11 13:48:17 -0700 | [diff] [blame] | 495 | // ---------------------------------------------------------------------------- | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 496 | void DisplayDevice::setPowerMode(int mode) { | 
|  | 497 | mPowerMode = mode; | 
| Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 498 | } | 
|  | 499 |  | 
| Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 500 | int DisplayDevice::getPowerMode()  const { | 
|  | 501 | return mPowerMode; | 
| Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 502 | } | 
|  | 503 |  | 
| Dominik Laskowski | eecd659 | 2018-05-29 10:25:41 -0700 | [diff] [blame] | 504 | bool DisplayDevice::isPoweredOn() const { | 
|  | 505 | return mPowerMode != HWC_POWER_MODE_OFF; | 
| Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 506 | } | 
|  | 507 |  | 
|  | 508 | // ---------------------------------------------------------------------------- | 
| Michael Lentine | 6c9e34a | 2014-07-14 13:48:55 -0700 | [diff] [blame] | 509 | void DisplayDevice::setActiveConfig(int mode) { | 
|  | 510 | mActiveConfig = mode; | 
|  | 511 | } | 
|  | 512 |  | 
|  | 513 | int DisplayDevice::getActiveConfig()  const { | 
|  | 514 | return mActiveConfig; | 
|  | 515 | } | 
|  | 516 |  | 
|  | 517 | // ---------------------------------------------------------------------------- | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 518 | void DisplayDevice::setActiveColorMode(ColorMode mode) { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 519 | mActiveColorMode = mode; | 
|  | 520 | } | 
|  | 521 |  | 
| Peiyong Lin | a52f029 | 2018-03-14 17:26:31 -0700 | [diff] [blame] | 522 | ColorMode DisplayDevice::getActiveColorMode() const { | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 523 | return mActiveColorMode; | 
|  | 524 | } | 
| Courtney Goeltzenleuchter | 79d2724 | 2017-07-13 17:54:01 -0600 | [diff] [blame] | 525 |  | 
| Peiyong Lin | dd9b2ae | 2018-03-01 16:22:45 -0800 | [diff] [blame] | 526 | RenderIntent DisplayDevice::getActiveRenderIntent() const { | 
|  | 527 | return mActiveRenderIntent; | 
|  | 528 | } | 
|  | 529 |  | 
|  | 530 | void DisplayDevice::setActiveRenderIntent(RenderIntent renderIntent) { | 
|  | 531 | mActiveRenderIntent = renderIntent; | 
|  | 532 | } | 
|  | 533 |  | 
| Yiwei Zhang | 7c64f17 | 2018-03-07 14:52:28 -0800 | [diff] [blame] | 534 | void DisplayDevice::setColorTransform(const mat4& transform) { | 
|  | 535 | const bool isIdentity = (transform == mat4()); | 
|  | 536 | mColorTransform = | 
|  | 537 | isIdentity ? HAL_COLOR_TRANSFORM_IDENTITY : HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX; | 
|  | 538 | } | 
|  | 539 |  | 
|  | 540 | android_color_transform_t DisplayDevice::getColorTransform() const { | 
|  | 541 | return mColorTransform; | 
|  | 542 | } | 
|  | 543 |  | 
| Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 544 | void DisplayDevice::setCompositionDataSpace(ui::Dataspace dataspace) { | 
| Peiyong Lin | dd9b2ae | 2018-03-01 16:22:45 -0800 | [diff] [blame] | 545 | mCompositionDataSpace = dataspace; | 
| Courtney Goeltzenleuchter | 79d2724 | 2017-07-13 17:54:01 -0600 | [diff] [blame] | 546 | ANativeWindow* const window = mNativeWindow.get(); | 
| Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 547 | native_window_set_buffers_data_space(window, static_cast<android_dataspace>(dataspace)); | 
| Courtney Goeltzenleuchter | 79d2724 | 2017-07-13 17:54:01 -0600 | [diff] [blame] | 548 | } | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 549 |  | 
| Peiyong Lin | dd9b2ae | 2018-03-01 16:22:45 -0800 | [diff] [blame] | 550 | ui::Dataspace DisplayDevice::getCompositionDataSpace() const { | 
|  | 551 | return mCompositionDataSpace; | 
|  | 552 | } | 
|  | 553 |  | 
| Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 554 | // ---------------------------------------------------------------------------- | 
| Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 555 |  | 
| Mathias Agopian | 28947d7 | 2012-08-08 18:51:15 -0700 | [diff] [blame] | 556 | void DisplayDevice::setLayerStack(uint32_t stack) { | 
|  | 557 | mLayerStack = stack; | 
|  | 558 | dirtyRegion.set(bounds()); | 
|  | 559 | } | 
|  | 560 |  | 
|  | 561 | // ---------------------------------------------------------------------------- | 
|  | 562 |  | 
| Mathias Agopian | c1c05de | 2013-09-17 23:45:22 -0700 | [diff] [blame] | 563 | uint32_t DisplayDevice::getOrientationTransform() const { | 
|  | 564 | uint32_t transform = 0; | 
|  | 565 | switch (mOrientation) { | 
|  | 566 | case DisplayState::eOrientationDefault: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 567 | transform = ui::Transform::ROT_0; | 
| Mathias Agopian | c1c05de | 2013-09-17 23:45:22 -0700 | [diff] [blame] | 568 | break; | 
|  | 569 | case DisplayState::eOrientation90: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 570 | transform = ui::Transform::ROT_90; | 
| Mathias Agopian | c1c05de | 2013-09-17 23:45:22 -0700 | [diff] [blame] | 571 | break; | 
|  | 572 | case DisplayState::eOrientation180: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 573 | transform = ui::Transform::ROT_180; | 
| Mathias Agopian | c1c05de | 2013-09-17 23:45:22 -0700 | [diff] [blame] | 574 | break; | 
|  | 575 | case DisplayState::eOrientation270: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 576 | transform = ui::Transform::ROT_270; | 
| Mathias Agopian | c1c05de | 2013-09-17 23:45:22 -0700 | [diff] [blame] | 577 | break; | 
|  | 578 | } | 
|  | 579 | return transform; | 
|  | 580 | } | 
|  | 581 |  | 
| Mathias Agopian | 0f2f5ff | 2012-07-31 23:09:07 -0700 | [diff] [blame] | 582 | status_t DisplayDevice::orientationToTransfrom( | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 583 | int orientation, int w, int h, ui::Transform* tr) | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 584 | { | 
|  | 585 | uint32_t flags = 0; | 
|  | 586 | switch (orientation) { | 
| Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 587 | case DisplayState::eOrientationDefault: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 588 | flags = ui::Transform::ROT_0; | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 589 | break; | 
| Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 590 | case DisplayState::eOrientation90: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 591 | flags = ui::Transform::ROT_90; | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 592 | break; | 
| Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 593 | case DisplayState::eOrientation180: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 594 | flags = ui::Transform::ROT_180; | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 595 | break; | 
| Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 596 | case DisplayState::eOrientation270: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 597 | flags = ui::Transform::ROT_270; | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 598 | break; | 
|  | 599 | default: | 
|  | 600 | return BAD_VALUE; | 
|  | 601 | } | 
|  | 602 | tr->set(flags, w, h); | 
|  | 603 | return NO_ERROR; | 
|  | 604 | } | 
|  | 605 |  | 
| Michael Lentine | 47e4540 | 2014-07-18 15:34:25 -0700 | [diff] [blame] | 606 | void DisplayDevice::setDisplaySize(const int newWidth, const int newHeight) { | 
|  | 607 | dirtyRegion.set(getBounds()); | 
|  | 608 |  | 
|  | 609 | mDisplaySurface->resizeBuffers(newWidth, newHeight); | 
|  | 610 |  | 
| Alec Mouri | ba013fa | 2018-10-16 12:43:11 -0700 | [diff] [blame] | 611 | mDisplayWidth = newWidth; | 
|  | 612 | mDisplayHeight = newHeight; | 
| Michael Lentine | 47e4540 | 2014-07-18 15:34:25 -0700 | [diff] [blame] | 613 | } | 
|  | 614 |  | 
| Mathias Agopian | 00e8c7a | 2012-09-04 19:30:46 -0700 | [diff] [blame] | 615 | void DisplayDevice::setProjection(int orientation, | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 616 | const Rect& newViewport, const Rect& newFrame) { | 
|  | 617 | Rect viewport(newViewport); | 
|  | 618 | Rect frame(newFrame); | 
|  | 619 |  | 
|  | 620 | const int w = mDisplayWidth; | 
|  | 621 | const int h = mDisplayHeight; | 
|  | 622 |  | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 623 | ui::Transform R; | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 624 | DisplayDevice::orientationToTransfrom(orientation, w, h, &R); | 
|  | 625 |  | 
|  | 626 | if (!frame.isValid()) { | 
|  | 627 | // the destination frame can be invalid if it has never been set, | 
|  | 628 | // in that case we assume the whole display frame. | 
|  | 629 | frame = Rect(w, h); | 
|  | 630 | } | 
|  | 631 |  | 
|  | 632 | if (viewport.isEmpty()) { | 
|  | 633 | // viewport can be invalid if it has never been set, in that case | 
|  | 634 | // we assume the whole display size. | 
|  | 635 | // it's also invalid to have an empty viewport, so we handle that | 
|  | 636 | // case in the same way. | 
|  | 637 | viewport = Rect(w, h); | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 638 | if (R.getOrientation() & ui::Transform::ROT_90) { | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 639 | // viewport is always specified in the logical orientation | 
|  | 640 | // of the display (ie: post-rotation). | 
| Peiyong Lin | 3db4234 | 2018-08-16 09:15:59 -0700 | [diff] [blame] | 641 | std::swap(viewport.right, viewport.bottom); | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 642 | } | 
|  | 643 | } | 
|  | 644 |  | 
|  | 645 | dirtyRegion.set(getBounds()); | 
|  | 646 |  | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 647 | ui::Transform TL, TP, S; | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 648 | float src_width  = viewport.width(); | 
|  | 649 | float src_height = viewport.height(); | 
|  | 650 | float dst_width  = frame.width(); | 
|  | 651 | float dst_height = frame.height(); | 
|  | 652 | if (src_width != dst_width || src_height != dst_height) { | 
|  | 653 | float sx = dst_width  / src_width; | 
|  | 654 | float sy = dst_height / src_height; | 
|  | 655 | S.set(sx, 0, 0, sy); | 
|  | 656 | } | 
|  | 657 |  | 
|  | 658 | float src_x = viewport.left; | 
|  | 659 | float src_y = viewport.top; | 
|  | 660 | float dst_x = frame.left; | 
|  | 661 | float dst_y = frame.top; | 
|  | 662 | TL.set(-src_x, -src_y); | 
|  | 663 | TP.set(dst_x, dst_y); | 
|  | 664 |  | 
| Iris Chang | 7501ed6 | 2018-04-30 14:45:42 +0800 | [diff] [blame] | 665 | // need to take care of primary display rotation for mGlobalTransform | 
|  | 666 | // for case if the panel is not installed aligned with device orientation | 
| Dominik Laskowski | 075d317 | 2018-05-24 15:50:06 -0700 | [diff] [blame] | 667 | if (isPrimary()) { | 
| Iris Chang | 7501ed6 | 2018-04-30 14:45:42 +0800 | [diff] [blame] | 668 | DisplayDevice::orientationToTransfrom( | 
| Chia-I Wu | a02871c | 2018-08-27 14:38:23 -0700 | [diff] [blame] | 669 | (orientation + mDisplayInstallOrientation) % (DisplayState::eOrientation270 + 1), | 
| Iris Chang | 7501ed6 | 2018-04-30 14:45:42 +0800 | [diff] [blame] | 670 | w, h, &R); | 
|  | 671 | } | 
|  | 672 |  | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 673 | // The viewport and frame are both in the logical orientation. | 
|  | 674 | // Apply the logical translation, scale to physical size, apply the | 
|  | 675 | // physical translation and finally rotate to the physical orientation. | 
|  | 676 | mGlobalTransform = R * TP * S * TL; | 
|  | 677 |  | 
|  | 678 | const uint8_t type = mGlobalTransform.getType(); | 
|  | 679 | mNeedsFiltering = (!mGlobalTransform.preserveRects() || | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 680 | (type >= ui::Transform::SCALE)); | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 681 |  | 
|  | 682 | mScissor = mGlobalTransform.transform(viewport); | 
|  | 683 | if (mScissor.isEmpty()) { | 
| Mathias Agopian | 6c7f25a | 2013-05-09 20:37:10 -0700 | [diff] [blame] | 684 | mScissor = getBounds(); | 
| Mathias Agopian | f5f714a | 2013-02-26 16:54:05 -0800 | [diff] [blame] | 685 | } | 
|  | 686 |  | 
| Mathias Agopian | da8d0a5 | 2012-09-04 15:05:38 -0700 | [diff] [blame] | 687 | mOrientation = orientation; | 
| Dominik Laskowski | 281644e | 2018-04-19 15:47:35 -0700 | [diff] [blame] | 688 | if (isPrimary()) { | 
| Pablo Ceballos | 021623b | 2016-04-15 17:31:51 -0700 | [diff] [blame] | 689 | uint32_t transform = 0; | 
|  | 690 | switch (mOrientation) { | 
|  | 691 | case DisplayState::eOrientationDefault: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 692 | transform = ui::Transform::ROT_0; | 
| Pablo Ceballos | 021623b | 2016-04-15 17:31:51 -0700 | [diff] [blame] | 693 | break; | 
|  | 694 | case DisplayState::eOrientation90: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 695 | transform = ui::Transform::ROT_90; | 
| Pablo Ceballos | 021623b | 2016-04-15 17:31:51 -0700 | [diff] [blame] | 696 | break; | 
|  | 697 | case DisplayState::eOrientation180: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 698 | transform = ui::Transform::ROT_180; | 
| Pablo Ceballos | 021623b | 2016-04-15 17:31:51 -0700 | [diff] [blame] | 699 | break; | 
|  | 700 | case DisplayState::eOrientation270: | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 701 | transform = ui::Transform::ROT_270; | 
| Pablo Ceballos | 021623b | 2016-04-15 17:31:51 -0700 | [diff] [blame] | 702 | break; | 
|  | 703 | } | 
|  | 704 | sPrimaryDisplayOrientation = transform; | 
|  | 705 | } | 
| Mathias Agopian | 00e8c7a | 2012-09-04 19:30:46 -0700 | [diff] [blame] | 706 | mViewport = viewport; | 
|  | 707 | mFrame = frame; | 
| Mathias Agopian | 1b03149 | 2012-06-20 17:51:20 -0700 | [diff] [blame] | 708 | } | 
| Mathias Agopian | 1d12d8a | 2012-09-18 01:38:00 -0700 | [diff] [blame] | 709 |  | 
| Pablo Ceballos | 021623b | 2016-04-15 17:31:51 -0700 | [diff] [blame] | 710 | uint32_t DisplayDevice::getPrimaryDisplayOrientationTransform() { | 
|  | 711 | return sPrimaryDisplayOrientation; | 
|  | 712 | } | 
|  | 713 |  | 
| Dominik Laskowski | 9b17b2c2 | 2018-11-01 14:49:03 -0700 | [diff] [blame] | 714 | std::string DisplayDevice::getDebugName() const { | 
| Dominik Laskowski | 3415776 | 2018-10-31 13:07:19 -0700 | [diff] [blame] | 715 | const auto id = mId ? to_string(*mId) + ", " : std::string(); | 
| Dominik Laskowski | 9b17b2c2 | 2018-11-01 14:49:03 -0700 | [diff] [blame] | 716 | return base::StringPrintf("DisplayDevice{%s%s%s\"%s\"}", id.c_str(), | 
|  | 717 | isPrimary() ? "primary, " : "", isVirtual() ? "virtual, " : "", | 
|  | 718 | mDisplayName.c_str()); | 
|  | 719 | } | 
|  | 720 |  | 
| Yiwei Zhang | 5434a78 | 2018-12-05 18:06:32 -0800 | [diff] [blame] | 721 | void DisplayDevice::dump(std::string& result) const { | 
| Peiyong Lin | efefaac | 2018-08-17 12:27:51 -0700 | [diff] [blame] | 722 | const ui::Transform& tr(mGlobalTransform); | 
| Courtney Goeltzenleuchter | 152279d | 2017-08-14 18:18:30 -0600 | [diff] [blame] | 723 | ANativeWindow* const window = mNativeWindow.get(); | 
| Yiwei Zhang | 5434a78 | 2018-12-05 18:06:32 -0800 | [diff] [blame] | 724 | StringAppendF(&result, "+ %s\n", getDebugName().c_str()); | 
|  | 725 | StringAppendF(&result, | 
|  | 726 | "  layerStack=%u, (%4dx%4d), ANativeWindow=%p " | 
|  | 727 | "format=%d, orient=%2d (type=%08x), flips=%u, isSecure=%d, " | 
|  | 728 | "powerMode=%d, activeConfig=%d, numLayers=%zu\n", | 
|  | 729 | mLayerStack, mDisplayWidth, mDisplayHeight, window, | 
|  | 730 | ANativeWindow_getFormat(window), mOrientation, tr.getType(), getPageFlipCount(), | 
|  | 731 | mIsSecure, mPowerMode, mActiveConfig, mVisibleLayersSortedByZ.size()); | 
|  | 732 | StringAppendF(&result, | 
|  | 733 | "   v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], s:[%d,%d,%d,%d]," | 
|  | 734 | "transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n", | 
|  | 735 | mViewport.left, mViewport.top, mViewport.right, mViewport.bottom, mFrame.left, | 
|  | 736 | mFrame.top, mFrame.right, mFrame.bottom, mScissor.left, mScissor.top, | 
|  | 737 | mScissor.right, mScissor.bottom, tr[0][0], tr[1][0], tr[2][0], tr[0][1], tr[1][1], | 
|  | 738 | tr[2][1], tr[0][2], tr[1][2], tr[2][2]); | 
| Courtney Goeltzenleuchter | 152279d | 2017-08-14 18:18:30 -0600 | [diff] [blame] | 739 | auto const surface = static_cast<Surface*>(window); | 
| Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 740 | ui::Dataspace dataspace = surface->getBuffersDataSpace(); | 
| Yiwei Zhang | 5434a78 | 2018-12-05 18:06:32 -0800 | [diff] [blame] | 741 | StringAppendF(&result, "   wideColorGamut=%d, hdr10=%d, colorMode=%s, dataspace: %s (%d)\n", | 
|  | 742 | mHasWideColorGamut, mHasHdr10, decodeColorMode(mActiveColorMode).c_str(), | 
|  | 743 | dataspaceDetails(static_cast<android_dataspace>(dataspace)).c_str(), dataspace); | 
| Mathias Agopian | 1d12d8a | 2012-09-18 01:38:00 -0700 | [diff] [blame] | 744 |  | 
| Jesse Hall | 99c7dbb | 2013-03-14 14:29:29 -0700 | [diff] [blame] | 745 | String8 surfaceDump; | 
| Dan Stoza | f10c46e | 2014-11-11 10:32:31 -0800 | [diff] [blame] | 746 | mDisplaySurface->dumpAsString(surfaceDump); | 
| Yiwei Zhang | 5434a78 | 2018-12-05 18:06:32 -0800 | [diff] [blame] | 747 | result.append(surfaceDump.string(), surfaceDump.size()); | 
| Mathias Agopian | 1d12d8a | 2012-09-18 01:38:00 -0700 | [diff] [blame] | 748 | } | 
| Irvel | ffc9efc | 2016-07-27 15:16:37 -0700 | [diff] [blame] | 749 |  | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 750 | // Map dataspace/intent to the best matched dataspace/colorMode/renderIntent | 
|  | 751 | // supported by HWC. | 
|  | 752 | void DisplayDevice::addColorMode( | 
|  | 753 | const std::unordered_map<ColorMode, std::vector<RenderIntent>>& hwcColorModes, | 
|  | 754 | const ColorMode mode, const RenderIntent intent) { | 
|  | 755 | // find the best color mode | 
|  | 756 | const ColorMode hwcColorMode = getHwcColorMode(hwcColorModes, mode); | 
|  | 757 |  | 
|  | 758 | // find the best render intent | 
|  | 759 | auto iter = hwcColorModes.find(hwcColorMode); | 
|  | 760 | const auto& hwcIntents = | 
|  | 761 | iter != hwcColorModes.end() ? iter->second : std::vector<RenderIntent>(); | 
|  | 762 | const RenderIntent hwcIntent = getHwcRenderIntent(hwcIntents, intent); | 
|  | 763 |  | 
|  | 764 | const Dataspace dataspace = colorModeToDataspace(mode); | 
|  | 765 | const Dataspace hwcDataspace = colorModeToDataspace(hwcColorMode); | 
|  | 766 |  | 
| Dominik Laskowski | 9b17b2c2 | 2018-11-01 14:49:03 -0700 | [diff] [blame] | 767 | ALOGV("%s: map (%s, %s) to (%s, %s, %s)", getDebugName().c_str(), | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 768 | dataspaceDetails(static_cast<android_dataspace_t>(dataspace)).c_str(), | 
|  | 769 | decodeRenderIntent(intent).c_str(), | 
|  | 770 | dataspaceDetails(static_cast<android_dataspace_t>(hwcDataspace)).c_str(), | 
|  | 771 | decodeColorMode(hwcColorMode).c_str(), decodeRenderIntent(hwcIntent).c_str()); | 
|  | 772 |  | 
|  | 773 | mColorModes[getColorModeKey(dataspace, intent)] = {hwcDataspace, hwcColorMode, hwcIntent}; | 
|  | 774 | } | 
|  | 775 |  | 
|  | 776 | void DisplayDevice::populateColorModes( | 
|  | 777 | const std::unordered_map<ColorMode, std::vector<RenderIntent>>& hwcColorModes) { | 
|  | 778 | if (!hasWideColorGamut()) { | 
|  | 779 | return; | 
|  | 780 | } | 
|  | 781 |  | 
| Chia-I Wu | 0d71126 | 2018-05-21 15:19:35 -0700 | [diff] [blame] | 782 | // collect all known SDR render intents | 
|  | 783 | std::unordered_set<RenderIntent> sdrRenderIntents(sSdrRenderIntents.begin(), | 
|  | 784 | sSdrRenderIntents.end()); | 
|  | 785 | auto iter = hwcColorModes.find(ColorMode::SRGB); | 
|  | 786 | if (iter != hwcColorModes.end()) { | 
|  | 787 | for (auto intent : iter->second) { | 
|  | 788 | sdrRenderIntents.insert(intent); | 
|  | 789 | } | 
|  | 790 | } | 
|  | 791 |  | 
| Chia-I Wu | c4b08bd | 2018-05-29 12:57:23 -0700 | [diff] [blame] | 792 | // add all known SDR combinations | 
| Chia-I Wu | 0d71126 | 2018-05-21 15:19:35 -0700 | [diff] [blame] | 793 | for (auto intent : sdrRenderIntents) { | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 794 | for (auto mode : sSdrColorModes) { | 
|  | 795 | addColorMode(hwcColorModes, mode, intent); | 
| Peiyong Lin | 136fbbc | 2018-04-17 15:09:44 -0700 | [diff] [blame] | 796 | } | 
|  | 797 | } | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 798 |  | 
| Chia-I Wu | c4b08bd | 2018-05-29 12:57:23 -0700 | [diff] [blame] | 799 | // collect all known HDR render intents | 
|  | 800 | std::unordered_set<RenderIntent> hdrRenderIntents(sHdrRenderIntents.begin(), | 
|  | 801 | sHdrRenderIntents.end()); | 
|  | 802 | iter = hwcColorModes.find(ColorMode::BT2100_PQ); | 
|  | 803 | if (iter != hwcColorModes.end()) { | 
|  | 804 | for (auto intent : iter->second) { | 
|  | 805 | hdrRenderIntents.insert(intent); | 
|  | 806 | } | 
|  | 807 | } | 
|  | 808 |  | 
|  | 809 | // add all known HDR combinations | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 810 | for (auto intent : sHdrRenderIntents) { | 
|  | 811 | for (auto mode : sHdrColorModes) { | 
|  | 812 | addColorMode(hwcColorModes, mode, intent); | 
|  | 813 | } | 
|  | 814 | } | 
|  | 815 | } | 
|  | 816 |  | 
|  | 817 | bool DisplayDevice::hasRenderIntent(RenderIntent intent) const { | 
|  | 818 | // assume a render intent is supported when SRGB supports it; we should | 
|  | 819 | // get rid of that assumption. | 
|  | 820 | auto iter = mColorModes.find(getColorModeKey(Dataspace::SRGB, intent)); | 
|  | 821 | return iter != mColorModes.end() && iter->second.renderIntent == intent; | 
|  | 822 | } | 
|  | 823 |  | 
| Peiyong Lin | dfde511 | 2018-06-05 10:58:41 -0700 | [diff] [blame] | 824 | bool DisplayDevice::hasLegacyHdrSupport(Dataspace dataspace) const { | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 825 | if ((dataspace == Dataspace::BT2020_PQ && hasHDR10Support()) || | 
|  | 826 | (dataspace == Dataspace::BT2020_HLG && hasHLGSupport())) { | 
|  | 827 | auto iter = | 
|  | 828 | mColorModes.find(getColorModeKey(dataspace, RenderIntent::TONE_MAP_COLORIMETRIC)); | 
| Peiyong Lin | dfde511 | 2018-06-05 10:58:41 -0700 | [diff] [blame] | 829 | return iter == mColorModes.end() || iter->second.dataspace != dataspace; | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 830 | } | 
|  | 831 |  | 
|  | 832 | return false; | 
|  | 833 | } | 
|  | 834 |  | 
|  | 835 | void DisplayDevice::getBestColorMode(Dataspace dataspace, RenderIntent intent, | 
|  | 836 | Dataspace* outDataspace, ColorMode* outMode, | 
|  | 837 | RenderIntent* outIntent) const { | 
|  | 838 | auto iter = mColorModes.find(getColorModeKey(dataspace, intent)); | 
|  | 839 | if (iter != mColorModes.end()) { | 
|  | 840 | *outDataspace = iter->second.dataspace; | 
|  | 841 | *outMode = iter->second.colorMode; | 
|  | 842 | *outIntent = iter->second.renderIntent; | 
|  | 843 | } else { | 
| Chia-I Wu | 6333af5 | 2018-10-16 13:46:36 -0700 | [diff] [blame] | 844 | // this is unexpected on a WCG display | 
|  | 845 | if (hasWideColorGamut()) { | 
|  | 846 | ALOGE("map unknown (%s)/(%s) to default color mode", | 
|  | 847 | dataspaceDetails(static_cast<android_dataspace_t>(dataspace)).c_str(), | 
|  | 848 | decodeRenderIntent(intent).c_str()); | 
|  | 849 | } | 
| Chia-I Wu | be02ec0 | 2018-05-18 10:59:36 -0700 | [diff] [blame] | 850 |  | 
|  | 851 | *outDataspace = Dataspace::UNKNOWN; | 
|  | 852 | *outMode = ColorMode::NATIVE; | 
|  | 853 | *outIntent = RenderIntent::COLORIMETRIC; | 
|  | 854 | } | 
| Peiyong Lin | 136fbbc | 2018-04-17 15:09:44 -0700 | [diff] [blame] | 855 | } | 
|  | 856 |  | 
| Dominik Laskowski | 663bd28 | 2018-04-19 15:26:54 -0700 | [diff] [blame] | 857 | std::atomic<int32_t> DisplayDeviceState::sNextSequenceId(1); | 
| Peiyong Lin | fd997e0 | 2018-03-28 15:29:00 -0700 | [diff] [blame] | 858 |  | 
|  | 859 | }  // namespace android |