blob: d5b24ae56c0486c67bb4e65f8ca20898dd32d0bf [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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 Stoza9e56aa02015-11-02 13:00:03 -080017// #define LOG_NDEBUG 0
18#undef LOG_TAG
19#define LOG_TAG "DisplayDevice"
20
Peiyong Lincbc184f2018-08-22 13:24:10 -070021#include "DisplayDevice.h"
22
Chia-I Wube02ec02018-05-18 10:59:36 -070023#include <array>
24#include <unordered_set>
25
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080026#include <stdlib.h>
27#include <stdio.h>
28#include <string.h>
29#include <math.h>
30
Dominik Laskowski9b17b2c22018-11-01 14:49:03 -070031#include <android-base/stringprintf.h>
Peiyong Lincbc184f2018-08-22 13:24:10 -070032#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
33#include <configstore/Utils.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080034#include <cutils/properties.h>
Peiyong Lincbc184f2018-08-22 13:24:10 -070035#include <gui/Surface.h>
36#include <hardware/gralloc.h>
37#include <renderengine/RenderEngine.h>
Alec Mouri0a9c7b82018-11-16 13:05:25 -080038#include <sync/sync.h>
39#include <system/window.h>
Courtney Goeltzenleuchter152279d2017-08-14 18:18:30 -060040#include <ui/DebugUtils.h>
Mathias Agopianc666cae2012-07-25 18:56:13 -070041#include <ui/DisplayInfo.h>
Mathias Agopian076b1cc2009-04-10 14:24:30 -070042#include <ui/PixelFormat.h>
Peiyong Lincbc184f2018-08-22 13:24:10 -070043#include <utils/Log.h>
Valerie Hau9758ae02018-10-09 16:05:09 -070044#include <utils/RefBase.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080045
Jesse Hall99c7dbb2013-03-14 14:29:29 -070046#include "DisplayHardware/DisplaySurface.h"
Mathias Agopian1b031492012-06-20 17:51:20 -070047#include "DisplayHardware/HWComposer.h"
Dan Stoza9e56aa02015-11-02 13:00:03 -080048#include "DisplayHardware/HWC2.h"
Mathias Agopianc7d14e22011-08-01 16:32:21 -070049#include "SurfaceFlinger.h"
Mathias Agopian13127d82013-03-05 17:47:11 -080050#include "Layer.h"
Mathias Agopian1f7bec62010-06-25 18:02:21 -070051
Peiyong Linfd997e02018-03-28 15:29:00 -070052namespace android {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080053
Jaesoo Lee720a7242017-01-31 15:26:18 +090054// retrieve triple buffer setting from configstore
55using namespace android::hardware::configstore;
56using namespace android::hardware::configstore::V1_0;
Peiyong Linfd997e02018-03-28 15:29:00 -070057using android::ui::ColorMode;
Chia-I Wube02ec02018-05-18 10:59:36 -070058using android::ui::Dataspace;
Peiyong Lin62665892018-04-16 11:07:44 -070059using android::ui::Hdr;
Peiyong Lindd9b2ae2018-03-01 16:22:45 -080060using android::ui::RenderIntent;
Jaesoo Lee720a7242017-01-31 15:26:18 +090061
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080062/*
63 * Initialize the display to the specified values.
64 *
65 */
66
Pablo Ceballos021623b2016-04-15 17:31:51 -070067uint32_t DisplayDevice::sPrimaryDisplayOrientation = 0;
68
Chia-I Wube02ec02018-05-18 10:59:36 -070069namespace {
70
71// ordered list of known SDR color modes
Valerie Hau9758ae02018-10-09 16:05:09 -070072const std::array<ColorMode, 3> sSdrColorModes = {
73 ColorMode::DISPLAY_BT2020,
Chia-I Wube02ec02018-05-18 10:59:36 -070074 ColorMode::DISPLAY_P3,
75 ColorMode::SRGB,
76};
77
78// ordered list of known HDR color modes
79const std::array<ColorMode, 2> sHdrColorModes = {
80 ColorMode::BT2100_PQ,
81 ColorMode::BT2100_HLG,
82};
83
84// ordered list of known SDR render intents
85const std::array<RenderIntent, 2> sSdrRenderIntents = {
86 RenderIntent::ENHANCE,
87 RenderIntent::COLORIMETRIC,
88};
89
90// ordered list of known HDR render intents
91const std::array<RenderIntent, 2> sHdrRenderIntents = {
92 RenderIntent::TONE_MAP_ENHANCE,
93 RenderIntent::TONE_MAP_COLORIMETRIC,
94};
95
96// map known color mode to dataspace
97Dataspace colorModeToDataspace(ColorMode mode) {
98 switch (mode) {
99 case ColorMode::SRGB:
100 return Dataspace::SRGB;
101 case ColorMode::DISPLAY_P3:
102 return Dataspace::DISPLAY_P3;
Valerie Hau9758ae02018-10-09 16:05:09 -0700103 case ColorMode::DISPLAY_BT2020:
104 return Dataspace::DISPLAY_BT2020;
Chia-I Wube02ec02018-05-18 10:59:36 -0700105 case ColorMode::BT2100_HLG:
106 return Dataspace::BT2020_HLG;
107 case ColorMode::BT2100_PQ:
108 return Dataspace::BT2020_PQ;
109 default:
110 return Dataspace::UNKNOWN;
111 }
112}
113
114// Return a list of candidate color modes.
115std::vector<ColorMode> getColorModeCandidates(ColorMode mode) {
116 std::vector<ColorMode> candidates;
117
118 // add mode itself
119 candidates.push_back(mode);
120
121 // check if mode is HDR
122 bool isHdr = false;
123 for (auto hdrMode : sHdrColorModes) {
124 if (hdrMode == mode) {
125 isHdr = true;
126 break;
127 }
128 }
129
130 // add other HDR candidates when mode is HDR
131 if (isHdr) {
132 for (auto hdrMode : sHdrColorModes) {
133 if (hdrMode != mode) {
134 candidates.push_back(hdrMode);
135 }
136 }
137 }
138
139 // add other SDR candidates
140 for (auto sdrMode : sSdrColorModes) {
141 if (sdrMode != mode) {
142 candidates.push_back(sdrMode);
143 }
144 }
145
146 return candidates;
147}
148
149// Return a list of candidate render intents.
150std::vector<RenderIntent> getRenderIntentCandidates(RenderIntent intent) {
151 std::vector<RenderIntent> candidates;
152
153 // add intent itself
154 candidates.push_back(intent);
155
156 // check if intent is HDR
157 bool isHdr = false;
158 for (auto hdrIntent : sHdrRenderIntents) {
159 if (hdrIntent == intent) {
160 isHdr = true;
161 break;
162 }
163 }
164
Chia-I Wube02ec02018-05-18 10:59:36 -0700165 if (isHdr) {
Chia-I Wuc4b08bd2018-05-29 12:57:23 -0700166 // add other HDR candidates when intent is HDR
Chia-I Wube02ec02018-05-18 10:59:36 -0700167 for (auto hdrIntent : sHdrRenderIntents) {
168 if (hdrIntent != intent) {
169 candidates.push_back(hdrIntent);
170 }
171 }
Chia-I Wuc4b08bd2018-05-29 12:57:23 -0700172 } else {
173 // add other SDR candidates when intent is SDR
174 for (auto sdrIntent : sSdrRenderIntents) {
175 if (sdrIntent != intent) {
176 candidates.push_back(sdrIntent);
177 }
178 }
Chia-I Wube02ec02018-05-18 10:59:36 -0700179 }
180
181 return candidates;
182}
183
184// Return the best color mode supported by HWC.
185ColorMode getHwcColorMode(
186 const std::unordered_map<ColorMode, std::vector<RenderIntent>>& hwcColorModes,
187 ColorMode mode) {
188 std::vector<ColorMode> candidates = getColorModeCandidates(mode);
189 for (auto candidate : candidates) {
190 auto iter = hwcColorModes.find(candidate);
191 if (iter != hwcColorModes.end()) {
192 return candidate;
193 }
194 }
195
196 return ColorMode::NATIVE;
197}
198
199// Return the best render intent supported by HWC.
200RenderIntent getHwcRenderIntent(const std::vector<RenderIntent>& hwcIntents, RenderIntent intent) {
201 std::vector<RenderIntent> candidates = getRenderIntentCandidates(intent);
202 for (auto candidate : candidates) {
203 for (auto hwcIntent : hwcIntents) {
204 if (candidate == hwcIntent) {
205 return candidate;
206 }
207 }
208 }
209
210 return RenderIntent::COLORIMETRIC;
211}
212
213} // anonymous namespace
214
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700215DisplayDeviceCreationArgs::DisplayDeviceCreationArgs(const sp<SurfaceFlinger>& flinger,
216 const wp<IBinder>& displayToken,
Dominik Laskowski075d3172018-05-24 15:50:06 -0700217 const std::optional<DisplayId>& displayId)
218 : flinger(flinger), displayToken(displayToken), displayId(displayId) {}
Chia-I Wube02ec02018-05-18 10:59:36 -0700219
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700220DisplayDevice::DisplayDevice(DisplayDeviceCreationArgs&& args)
221 : lastCompositionHadVisibleLayers(false),
222 mFlinger(args.flinger),
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700223 mDisplayToken(args.displayToken),
Dominik Laskowski075d3172018-05-24 15:50:06 -0700224 mId(args.displayId),
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700225 mNativeWindow(args.nativeWindow),
Alec Mouri0a9c7b82018-11-16 13:05:25 -0800226 mGraphicBuffer(nullptr),
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700227 mDisplaySurface(args.displaySurface),
Alec Mouri05874642018-11-14 22:34:02 +0000228 mSurface{std::move(args.renderSurface)},
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700229 mDisplayInstallOrientation(args.displayInstallOrientation),
230 mPageFlipCount(0),
Dominik Laskowski075d3172018-05-24 15:50:06 -0700231 mIsVirtual(args.isVirtual),
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700232 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 Laskowski075d3172018-05-24 15:50:06 -0700244 mSupportedPerFrameMetadata(args.supportedPerFrameMetadata),
245 mIsPrimary(args.isPrimary) {
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700246 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");
Alec Mouri05874642018-11-14 22:34:02 +0000250 ALOGE_IF(!mSurface, "No render surface was set for display");
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700251
252 std::vector<Hdr> types = args.hdrCapabilities.getSupportedHdrTypes();
Peiyong Linfb069302018-04-25 14:34:31 -0700253 for (Hdr hdrType : types) {
Peiyong Lin62665892018-04-16 11:07:44 -0700254 switch (hdrType) {
255 case Hdr::HDR10:
256 mHasHdr10 = true;
257 break;
258 case Hdr::HLG:
259 mHasHLG = true;
260 break;
261 case Hdr::DOLBY_VISION:
262 mHasDolbyVision = true;
263 break;
264 default:
265 ALOGE("UNKNOWN HDR capability: %d", static_cast<int32_t>(hdrType));
266 }
267 }
Jesse Hallffe1f192013-03-22 15:13:48 -0700268
Lloyd Pique2eef1d22018-09-18 21:30:04 -0700269 float minLuminance = args.hdrCapabilities.getDesiredMinLuminance();
270 float maxLuminance = args.hdrCapabilities.getDesiredMaxLuminance();
271 float maxAverageLuminance = args.hdrCapabilities.getDesiredMaxAverageLuminance();
Peiyong Linfb069302018-04-25 14:34:31 -0700272
273 minLuminance = minLuminance <= 0.0 ? sDefaultMinLumiance : minLuminance;
274 maxLuminance = maxLuminance <= 0.0 ? sDefaultMaxLumiance : maxLuminance;
275 maxAverageLuminance = maxAverageLuminance <= 0.0 ? sDefaultMaxLumiance : maxAverageLuminance;
276 if (this->hasWideColorGamut()) {
277 // insert HDR10/HLG as we will force client composition for HDR10/HLG
278 // layers
279 if (!hasHDR10Support()) {
280 types.push_back(Hdr::HDR10);
281 }
282
283 if (!hasHLGSupport()) {
284 types.push_back(Hdr::HLG);
285 }
286 }
287 mHdrCapabilities = HdrCapabilities(types, maxLuminance, maxAverageLuminance, minLuminance);
288
Alec Mouriba013fa2018-10-16 12:43:11 -0700289 ANativeWindow* const window = mNativeWindow.get();
Alec Mouri0a9c7b82018-11-16 13:05:25 -0800290
291 int status = native_window_api_connect(mNativeWindow.get(), NATIVE_WINDOW_API_EGL);
292 ALOGE_IF(status != NO_ERROR, "Unable to connect BQ producer: %d", status);
293
Alec Mouriba013fa2018-10-16 12:43:11 -0700294 mDisplayWidth = ANativeWindow_getWidth(window);
295 mDisplayHeight = ANativeWindow_getHeight(window);
296
Jesse Hallffe1f192013-03-22 15:13:48 -0700297 // initialize the display orientation transform.
298 setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800299}
300
Lloyd Pique09594832018-01-22 17:48:03 -0800301DisplayDevice::~DisplayDevice() = default;
Mathias Agopian92a979a2012-08-02 18:32:23 -0700302
Jesse Hall02d86562013-03-25 14:43:23 -0700303void DisplayDevice::disconnect(HWComposer& hwc) {
Dominik Laskowski075d3172018-05-24 15:50:06 -0700304 if (mId) {
305 hwc.disconnectDisplay(*mId);
306 mId.reset();
Jesse Hall02d86562013-03-25 14:43:23 -0700307 }
308}
309
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700310int DisplayDevice::getWidth() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700311 return mDisplayWidth;
312}
313
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700314int DisplayDevice::getHeight() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700315 return mDisplayHeight;
316}
317
Dominik Laskowskibf170d92018-04-19 15:08:05 -0700318void DisplayDevice::setDisplayName(const std::string& displayName) {
319 if (!displayName.empty()) {
Mathias Agopian9e2463e2012-09-21 18:26:16 -0700320 // never override the name with an empty name
321 mDisplayName = displayName;
322 }
323}
324
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700325uint32_t DisplayDevice::getPageFlipCount() const {
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700326 return mPageFlipCount;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800327}
328
Chia-I Wub02087d2017-11-09 10:19:54 -0800329void DisplayDevice::flip() const
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800330{
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700331 mPageFlipCount++;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800332}
333
Dan Stoza71433162014-02-04 16:22:36 -0800334status_t DisplayDevice::beginFrame(bool mustRecompose) const {
335 return mDisplaySurface->beginFrame(mustRecompose);
Jesse Hall028dc8f2013-08-20 16:35:32 -0700336}
337
David Sodmanfb95bcc2017-12-22 15:45:30 -0800338status_t DisplayDevice::prepareFrame(HWComposer& hwc,
339 std::vector<CompositionInfo>& compositionData) {
Dominik Laskowski075d3172018-05-24 15:50:06 -0700340 if (mId) {
341 status_t error = hwc.prepare(*mId, compositionData);
342 if (error != NO_ERROR) {
343 return error;
344 }
Dan Stoza9e56aa02015-11-02 13:00:03 -0800345 }
346
347 DisplaySurface::CompositionType compositionType;
Dominik Laskowski7e045462018-05-30 13:02:02 -0700348 bool hasClient = hwc.hasClientComposition(mId);
349 bool hasDevice = hwc.hasDeviceComposition(mId);
Dan Stoza9e56aa02015-11-02 13:00:03 -0800350 if (hasClient && hasDevice) {
351 compositionType = DisplaySurface::COMPOSITION_MIXED;
352 } else if (hasClient) {
353 compositionType = DisplaySurface::COMPOSITION_GLES;
354 } else if (hasDevice) {
355 compositionType = DisplaySurface::COMPOSITION_HWC;
356 } else {
357 // Nothing to do -- when turning the screen off we get a frame like
358 // this. Call it a HWC frame since we won't be doing any GLES work but
359 // will do a prepare/set cycle.
360 compositionType = DisplaySurface::COMPOSITION_HWC;
361 }
362 return mDisplaySurface->prepareFrame(compositionType);
363}
Jesse Hall38efe862013-04-06 23:12:29 -0700364
Alec Mouri0a9c7b82018-11-16 13:05:25 -0800365sp<GraphicBuffer> DisplayDevice::dequeueBuffer() {
366 int fd;
367 ANativeWindowBuffer* buffer;
368
369 status_t res = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buffer, &fd);
370
371 if (res != NO_ERROR) {
372 ALOGE("ANativeWindow::dequeueBuffer failed for display [%s] with error: %d",
373 getDisplayName().c_str(), res);
374 // Return fast here as we can't do much more - any rendering we do
375 // now will just be wrong.
376 return mGraphicBuffer;
377 }
378
379 ALOGW_IF(mGraphicBuffer != nullptr, "Clobbering a non-null pointer to a buffer [%p].",
380 mGraphicBuffer->getNativeBuffer()->handle);
381 mGraphicBuffer = GraphicBuffer::from(buffer);
382
383 // Block until the buffer is ready
384 // TODO(alecmouri): it's perhaps more appropriate to block renderengine so
385 // that the gl driver can block instead.
386 if (fd >= 0) {
387 sync_wait(fd, -1);
388 close(fd);
389 }
390
391 return mGraphicBuffer;
392}
393
394void DisplayDevice::queueBuffer(HWComposer& hwc) {
Dominik Laskowski7e045462018-05-30 13:02:02 -0700395 if (hwc.hasClientComposition(mId) || hwc.hasFlipClientTargetRequest(mId)) {
Alec Mouri0a9c7b82018-11-16 13:05:25 -0800396 // hasFlipClientTargetRequest could return true even if we haven't
397 // dequeued a buffer before. Try dequeueing one if we don't have a
398 // buffer ready.
399 if (mGraphicBuffer == nullptr) {
400 ALOGI("Attempting to queue a client composited buffer without one "
401 "previously dequeued for display [%s]. Attempting to dequeue "
402 "a scratch buffer now",
403 mDisplayName.c_str());
404 // We shouldn't deadlock here, since mGraphicBuffer == nullptr only
405 // after a successful call to queueBuffer, or if dequeueBuffer has
406 // never been called.
407 dequeueBuffer();
408 }
409
410 if (mGraphicBuffer == nullptr) {
411 ALOGE("No buffer is ready for display [%s]", mDisplayName.c_str());
412 } else {
413 int fd = mBufferReady.release();
414
415 status_t res = mNativeWindow->queueBuffer(mNativeWindow.get(),
416 mGraphicBuffer->getNativeBuffer(), fd);
417 if (res != NO_ERROR) {
418 ALOGE("Error when queueing buffer for display [%s]: %d", mDisplayName.c_str(), res);
419 // We risk blocking on dequeueBuffer if the primary display failed
420 // to queue up its buffer, so crash here.
421 if (isPrimary()) {
422 LOG_ALWAYS_FATAL("ANativeWindow::queueBuffer failed with error: %d", res);
423 } else {
424 mNativeWindow->cancelBuffer(mNativeWindow.get(),
425 mGraphicBuffer->getNativeBuffer(), fd);
426 }
427 }
428 mGraphicBuffer = nullptr;
429 }
Mathias Agopianda27af92012-09-13 18:17:13 -0700430 }
Mathias Agopian52e21482012-09-24 18:07:21 -0700431
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700432 status_t result = mDisplaySurface->advanceFrame();
433 if (result != NO_ERROR) {
Dominik Laskowskibf170d92018-04-19 15:08:05 -0700434 ALOGE("[%s] failed pushing new frame to HWC: %d", mDisplayName.c_str(), result);
Mathias Agopian32341382012-09-25 19:16:28 -0700435 }
Mathias Agopianda27af92012-09-13 18:17:13 -0700436}
437
Alec Mouri0a9c7b82018-11-16 13:05:25 -0800438void DisplayDevice::onPresentDisplayCompleted() {
Dan Stoza9e56aa02015-11-02 13:00:03 -0800439 mDisplaySurface->onFrameCommitted();
440}
Mathias Agopianda27af92012-09-13 18:17:13 -0700441
Alec Mouri05874642018-11-14 22:34:02 +0000442bool DisplayDevice::makeCurrent() const {
443 bool success = mFlinger->getRenderEngine().setCurrentSurface(*mSurface);
444 setViewportAndProjection();
445 return success;
446}
447
Mathias Agopian875d8e12013-06-07 15:35:48 -0700448void DisplayDevice::setViewportAndProjection() const {
449 size_t w = mDisplayWidth;
450 size_t h = mDisplayHeight;
Dan Stozac1879002014-05-22 15:59:05 -0700451 Rect sourceCrop(0, 0, w, h);
Chia-I Wu1be50b52018-08-29 10:44:48 -0700452 mFlinger->getRenderEngine().setViewportAndProjection(w, h, sourceCrop, ui::Transform::ROT_0);
Mathias Agopianbae92d02012-09-28 01:00:47 -0700453}
454
Alec Mouri0a9c7b82018-11-16 13:05:25 -0800455void DisplayDevice::finishBuffer() {
456 mBufferReady = mFlinger->getRenderEngine().flush();
457 if (mBufferReady.get() < 0) {
458 mFlinger->getRenderEngine().finish();
459 }
460}
461
Dan Stoza9e56aa02015-11-02 13:00:03 -0800462const sp<Fence>& DisplayDevice::getClientTargetAcquireFence() const {
463 return mDisplaySurface->getClientTargetAcquireFence();
464}
Dan Stoza9e56aa02015-11-02 13:00:03 -0800465
Mathias Agopian1b031492012-06-20 17:51:20 -0700466// ----------------------------------------------------------------------------
467
Mathias Agopian13127d82013-03-05 17:47:11 -0800468void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers) {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700469 mVisibleLayersSortedByZ = layers;
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700470}
471
Mathias Agopian13127d82013-03-05 17:47:11 -0800472const Vector< sp<Layer> >& DisplayDevice::getVisibleLayersSortedByZ() const {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700473 return mVisibleLayersSortedByZ;
474}
475
Chia-I Wu83806892017-11-16 10:50:20 -0800476void DisplayDevice::setLayersNeedingFences(const Vector< sp<Layer> >& layers) {
477 mLayersNeedingFences = layers;
478}
479
480const Vector< sp<Layer> >& DisplayDevice::getLayersNeedingFences() const {
481 return mLayersNeedingFences;
482}
483
Mathias Agopiancd60f992012-08-16 16:28:27 -0700484Region DisplayDevice::getDirtyRegion(bool repaintEverything) const {
485 Region dirty;
Mathias Agopiancd60f992012-08-16 16:28:27 -0700486 if (repaintEverything) {
487 dirty.set(getBounds());
488 } else {
Peiyong Linefefaac2018-08-17 12:27:51 -0700489 const ui::Transform& planeTransform(mGlobalTransform);
Mathias Agopiancd60f992012-08-16 16:28:27 -0700490 dirty = planeTransform.transform(this->dirtyRegion);
491 dirty.andSelf(getBounds());
492 }
493 return dirty;
494}
495
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700496// ----------------------------------------------------------------------------
Prashant Malani2c9b11f2014-05-25 01:36:31 -0700497void DisplayDevice::setPowerMode(int mode) {
498 mPowerMode = mode;
Mathias Agopiand3ee2312012-08-02 14:01:42 -0700499}
500
Prashant Malani2c9b11f2014-05-25 01:36:31 -0700501int DisplayDevice::getPowerMode() const {
502 return mPowerMode;
Mathias Agopiand3ee2312012-08-02 14:01:42 -0700503}
504
Dominik Laskowskieecd6592018-05-29 10:25:41 -0700505bool DisplayDevice::isPoweredOn() const {
506 return mPowerMode != HWC_POWER_MODE_OFF;
Mathias Agopiand3ee2312012-08-02 14:01:42 -0700507}
508
509// ----------------------------------------------------------------------------
Michael Lentine6c9e34a2014-07-14 13:48:55 -0700510void DisplayDevice::setActiveConfig(int mode) {
511 mActiveConfig = mode;
512}
513
514int DisplayDevice::getActiveConfig() const {
515 return mActiveConfig;
516}
517
518// ----------------------------------------------------------------------------
Peiyong Lina52f0292018-03-14 17:26:31 -0700519void DisplayDevice::setActiveColorMode(ColorMode mode) {
Michael Wright28f24d02016-07-12 13:30:53 -0700520 mActiveColorMode = mode;
521}
522
Peiyong Lina52f0292018-03-14 17:26:31 -0700523ColorMode DisplayDevice::getActiveColorMode() const {
Michael Wright28f24d02016-07-12 13:30:53 -0700524 return mActiveColorMode;
525}
Courtney Goeltzenleuchter79d27242017-07-13 17:54:01 -0600526
Peiyong Lindd9b2ae2018-03-01 16:22:45 -0800527RenderIntent DisplayDevice::getActiveRenderIntent() const {
528 return mActiveRenderIntent;
529}
530
531void DisplayDevice::setActiveRenderIntent(RenderIntent renderIntent) {
532 mActiveRenderIntent = renderIntent;
533}
534
Yiwei Zhang7c64f172018-03-07 14:52:28 -0800535void DisplayDevice::setColorTransform(const mat4& transform) {
536 const bool isIdentity = (transform == mat4());
537 mColorTransform =
538 isIdentity ? HAL_COLOR_TRANSFORM_IDENTITY : HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX;
539}
540
541android_color_transform_t DisplayDevice::getColorTransform() const {
542 return mColorTransform;
543}
544
Peiyong Lin34beb7a2018-03-28 11:57:12 -0700545void DisplayDevice::setCompositionDataSpace(ui::Dataspace dataspace) {
Peiyong Lindd9b2ae2018-03-01 16:22:45 -0800546 mCompositionDataSpace = dataspace;
Courtney Goeltzenleuchter79d27242017-07-13 17:54:01 -0600547 ANativeWindow* const window = mNativeWindow.get();
Peiyong Lin34beb7a2018-03-28 11:57:12 -0700548 native_window_set_buffers_data_space(window, static_cast<android_dataspace>(dataspace));
Courtney Goeltzenleuchter79d27242017-07-13 17:54:01 -0600549}
Michael Wright28f24d02016-07-12 13:30:53 -0700550
Peiyong Lindd9b2ae2018-03-01 16:22:45 -0800551ui::Dataspace DisplayDevice::getCompositionDataSpace() const {
552 return mCompositionDataSpace;
553}
554
Michael Wright28f24d02016-07-12 13:30:53 -0700555// ----------------------------------------------------------------------------
Mathias Agopiand3ee2312012-08-02 14:01:42 -0700556
Mathias Agopian28947d72012-08-08 18:51:15 -0700557void DisplayDevice::setLayerStack(uint32_t stack) {
558 mLayerStack = stack;
559 dirtyRegion.set(bounds());
560}
561
562// ----------------------------------------------------------------------------
563
Mathias Agopianc1c05de2013-09-17 23:45:22 -0700564uint32_t DisplayDevice::getOrientationTransform() const {
565 uint32_t transform = 0;
566 switch (mOrientation) {
567 case DisplayState::eOrientationDefault:
Peiyong Linefefaac2018-08-17 12:27:51 -0700568 transform = ui::Transform::ROT_0;
Mathias Agopianc1c05de2013-09-17 23:45:22 -0700569 break;
570 case DisplayState::eOrientation90:
Peiyong Linefefaac2018-08-17 12:27:51 -0700571 transform = ui::Transform::ROT_90;
Mathias Agopianc1c05de2013-09-17 23:45:22 -0700572 break;
573 case DisplayState::eOrientation180:
Peiyong Linefefaac2018-08-17 12:27:51 -0700574 transform = ui::Transform::ROT_180;
Mathias Agopianc1c05de2013-09-17 23:45:22 -0700575 break;
576 case DisplayState::eOrientation270:
Peiyong Linefefaac2018-08-17 12:27:51 -0700577 transform = ui::Transform::ROT_270;
Mathias Agopianc1c05de2013-09-17 23:45:22 -0700578 break;
579 }
580 return transform;
581}
582
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700583status_t DisplayDevice::orientationToTransfrom(
Peiyong Linefefaac2018-08-17 12:27:51 -0700584 int orientation, int w, int h, ui::Transform* tr)
Mathias Agopian1b031492012-06-20 17:51:20 -0700585{
586 uint32_t flags = 0;
587 switch (orientation) {
Mathias Agopian3165cc22012-08-08 19:42:09 -0700588 case DisplayState::eOrientationDefault:
Peiyong Linefefaac2018-08-17 12:27:51 -0700589 flags = ui::Transform::ROT_0;
Mathias Agopian1b031492012-06-20 17:51:20 -0700590 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700591 case DisplayState::eOrientation90:
Peiyong Linefefaac2018-08-17 12:27:51 -0700592 flags = ui::Transform::ROT_90;
Mathias Agopian1b031492012-06-20 17:51:20 -0700593 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700594 case DisplayState::eOrientation180:
Peiyong Linefefaac2018-08-17 12:27:51 -0700595 flags = ui::Transform::ROT_180;
Mathias Agopian1b031492012-06-20 17:51:20 -0700596 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700597 case DisplayState::eOrientation270:
Peiyong Linefefaac2018-08-17 12:27:51 -0700598 flags = ui::Transform::ROT_270;
Mathias Agopian1b031492012-06-20 17:51:20 -0700599 break;
600 default:
601 return BAD_VALUE;
602 }
603 tr->set(flags, w, h);
604 return NO_ERROR;
605}
606
Michael Lentine47e45402014-07-18 15:34:25 -0700607void DisplayDevice::setDisplaySize(const int newWidth, const int newHeight) {
608 dirtyRegion.set(getBounds());
609
Alec Mouri05874642018-11-14 22:34:02 +0000610 mSurface->setNativeWindow(nullptr);
611
Michael Lentine47e45402014-07-18 15:34:25 -0700612 mDisplaySurface->resizeBuffers(newWidth, newHeight);
613
Alec Mouri05874642018-11-14 22:34:02 +0000614 ANativeWindow* const window = mNativeWindow.get();
615 mSurface->setNativeWindow(window);
Alec Mouriba013fa2018-10-16 12:43:11 -0700616 mDisplayWidth = newWidth;
617 mDisplayHeight = newHeight;
Michael Lentine47e45402014-07-18 15:34:25 -0700618}
619
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700620void DisplayDevice::setProjection(int orientation,
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800621 const Rect& newViewport, const Rect& newFrame) {
622 Rect viewport(newViewport);
623 Rect frame(newFrame);
624
625 const int w = mDisplayWidth;
626 const int h = mDisplayHeight;
627
Peiyong Linefefaac2018-08-17 12:27:51 -0700628 ui::Transform R;
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800629 DisplayDevice::orientationToTransfrom(orientation, w, h, &R);
630
631 if (!frame.isValid()) {
632 // the destination frame can be invalid if it has never been set,
633 // in that case we assume the whole display frame.
634 frame = Rect(w, h);
635 }
636
637 if (viewport.isEmpty()) {
638 // viewport can be invalid if it has never been set, in that case
639 // we assume the whole display size.
640 // it's also invalid to have an empty viewport, so we handle that
641 // case in the same way.
642 viewport = Rect(w, h);
Peiyong Linefefaac2018-08-17 12:27:51 -0700643 if (R.getOrientation() & ui::Transform::ROT_90) {
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800644 // viewport is always specified in the logical orientation
645 // of the display (ie: post-rotation).
Peiyong Lin3db42342018-08-16 09:15:59 -0700646 std::swap(viewport.right, viewport.bottom);
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800647 }
648 }
649
650 dirtyRegion.set(getBounds());
651
Peiyong Linefefaac2018-08-17 12:27:51 -0700652 ui::Transform TL, TP, S;
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800653 float src_width = viewport.width();
654 float src_height = viewport.height();
655 float dst_width = frame.width();
656 float dst_height = frame.height();
657 if (src_width != dst_width || src_height != dst_height) {
658 float sx = dst_width / src_width;
659 float sy = dst_height / src_height;
660 S.set(sx, 0, 0, sy);
661 }
662
663 float src_x = viewport.left;
664 float src_y = viewport.top;
665 float dst_x = frame.left;
666 float dst_y = frame.top;
667 TL.set(-src_x, -src_y);
668 TP.set(dst_x, dst_y);
669
Iris Chang7501ed62018-04-30 14:45:42 +0800670 // need to take care of primary display rotation for mGlobalTransform
671 // for case if the panel is not installed aligned with device orientation
Dominik Laskowski075d3172018-05-24 15:50:06 -0700672 if (isPrimary()) {
Iris Chang7501ed62018-04-30 14:45:42 +0800673 DisplayDevice::orientationToTransfrom(
Chia-I Wua02871c2018-08-27 14:38:23 -0700674 (orientation + mDisplayInstallOrientation) % (DisplayState::eOrientation270 + 1),
Iris Chang7501ed62018-04-30 14:45:42 +0800675 w, h, &R);
676 }
677
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800678 // The viewport and frame are both in the logical orientation.
679 // Apply the logical translation, scale to physical size, apply the
680 // physical translation and finally rotate to the physical orientation.
681 mGlobalTransform = R * TP * S * TL;
682
683 const uint8_t type = mGlobalTransform.getType();
684 mNeedsFiltering = (!mGlobalTransform.preserveRects() ||
Peiyong Linefefaac2018-08-17 12:27:51 -0700685 (type >= ui::Transform::SCALE));
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800686
687 mScissor = mGlobalTransform.transform(viewport);
688 if (mScissor.isEmpty()) {
Mathias Agopian6c7f25a2013-05-09 20:37:10 -0700689 mScissor = getBounds();
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800690 }
691
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700692 mOrientation = orientation;
Dominik Laskowski281644e2018-04-19 15:47:35 -0700693 if (isPrimary()) {
Pablo Ceballos021623b2016-04-15 17:31:51 -0700694 uint32_t transform = 0;
695 switch (mOrientation) {
696 case DisplayState::eOrientationDefault:
Peiyong Linefefaac2018-08-17 12:27:51 -0700697 transform = ui::Transform::ROT_0;
Pablo Ceballos021623b2016-04-15 17:31:51 -0700698 break;
699 case DisplayState::eOrientation90:
Peiyong Linefefaac2018-08-17 12:27:51 -0700700 transform = ui::Transform::ROT_90;
Pablo Ceballos021623b2016-04-15 17:31:51 -0700701 break;
702 case DisplayState::eOrientation180:
Peiyong Linefefaac2018-08-17 12:27:51 -0700703 transform = ui::Transform::ROT_180;
Pablo Ceballos021623b2016-04-15 17:31:51 -0700704 break;
705 case DisplayState::eOrientation270:
Peiyong Linefefaac2018-08-17 12:27:51 -0700706 transform = ui::Transform::ROT_270;
Pablo Ceballos021623b2016-04-15 17:31:51 -0700707 break;
708 }
709 sPrimaryDisplayOrientation = transform;
710 }
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700711 mViewport = viewport;
712 mFrame = frame;
Mathias Agopian1b031492012-06-20 17:51:20 -0700713}
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700714
Pablo Ceballos021623b2016-04-15 17:31:51 -0700715uint32_t DisplayDevice::getPrimaryDisplayOrientationTransform() {
716 return sPrimaryDisplayOrientation;
717}
718
Dominik Laskowski9b17b2c22018-11-01 14:49:03 -0700719std::string DisplayDevice::getDebugName() const {
Dominik Laskowski34157762018-10-31 13:07:19 -0700720 const auto id = mId ? to_string(*mId) + ", " : std::string();
Dominik Laskowski9b17b2c22018-11-01 14:49:03 -0700721 return base::StringPrintf("DisplayDevice{%s%s%s\"%s\"}", id.c_str(),
722 isPrimary() ? "primary, " : "", isVirtual() ? "virtual, " : "",
723 mDisplayName.c_str());
724}
725
Mathias Agopian74d211a2013-04-22 16:55:35 +0200726void DisplayDevice::dump(String8& result) const {
Peiyong Linefefaac2018-08-17 12:27:51 -0700727 const ui::Transform& tr(mGlobalTransform);
Courtney Goeltzenleuchter152279d2017-08-14 18:18:30 -0600728 ANativeWindow* const window = mNativeWindow.get();
Dominik Laskowski9b17b2c22018-11-01 14:49:03 -0700729 result.appendFormat("+ %s\n", getDebugName().c_str());
730 result.appendFormat(" layerStack=%u, (%4dx%4d), ANativeWindow=%p "
Alec Mouri05874642018-11-14 22:34:02 +0000731 "(%d:%d:%d:%d), orient=%2d (type=%08x), "
732 "flips=%u, isSecure=%d, powerMode=%d, activeConfig=%d, numLayers=%zu\n",
Dominik Laskowski9b17b2c22018-11-01 14:49:03 -0700733 mLayerStack, mDisplayWidth, mDisplayHeight, window,
Alec Mouri05874642018-11-14 22:34:02 +0000734 mSurface->queryRedSize(), mSurface->queryGreenSize(),
735 mSurface->queryBlueSize(), mSurface->queryAlphaSize(), mOrientation,
736 tr.getType(), getPageFlipCount(), mIsSecure, mPowerMode, mActiveConfig,
Courtney Goeltzenleuchter0ebaac32017-04-13 12:17:03 -0600737 mVisibleLayersSortedByZ.size());
738 result.appendFormat(" v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], s:[%d,%d,%d,%d],"
739 "transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n",
740 mViewport.left, mViewport.top, mViewport.right, mViewport.bottom,
741 mFrame.left, mFrame.top, mFrame.right, mFrame.bottom, mScissor.left,
742 mScissor.top, mScissor.right, mScissor.bottom, tr[0][0], tr[1][0], tr[2][0],
743 tr[0][1], tr[1][1], tr[2][1], tr[0][2], tr[1][2], tr[2][2]);
Courtney Goeltzenleuchter152279d2017-08-14 18:18:30 -0600744 auto const surface = static_cast<Surface*>(window);
Peiyong Lin34beb7a2018-03-28 11:57:12 -0700745 ui::Dataspace dataspace = surface->getBuffersDataSpace();
Peiyong Lindd9b2ae2018-03-01 16:22:45 -0800746 result.appendFormat(" wideColorGamut=%d, hdr10=%d, colorMode=%s, dataspace: %s (%d)\n",
Alec Mouri05874642018-11-14 22:34:02 +0000747 mHasWideColorGamut, mHasHdr10,
748 decodeColorMode(mActiveColorMode).c_str(),
749 dataspaceDetails(static_cast<android_dataspace>(dataspace)).c_str(), dataspace);
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700750
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700751 String8 surfaceDump;
Dan Stozaf10c46e2014-11-11 10:32:31 -0800752 mDisplaySurface->dumpAsString(surfaceDump);
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700753 result.append(surfaceDump);
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700754}
Irvelffc9efc2016-07-27 15:16:37 -0700755
Chia-I Wube02ec02018-05-18 10:59:36 -0700756// Map dataspace/intent to the best matched dataspace/colorMode/renderIntent
757// supported by HWC.
758void DisplayDevice::addColorMode(
759 const std::unordered_map<ColorMode, std::vector<RenderIntent>>& hwcColorModes,
760 const ColorMode mode, const RenderIntent intent) {
761 // find the best color mode
762 const ColorMode hwcColorMode = getHwcColorMode(hwcColorModes, mode);
763
764 // find the best render intent
765 auto iter = hwcColorModes.find(hwcColorMode);
766 const auto& hwcIntents =
767 iter != hwcColorModes.end() ? iter->second : std::vector<RenderIntent>();
768 const RenderIntent hwcIntent = getHwcRenderIntent(hwcIntents, intent);
769
770 const Dataspace dataspace = colorModeToDataspace(mode);
771 const Dataspace hwcDataspace = colorModeToDataspace(hwcColorMode);
772
Dominik Laskowski9b17b2c22018-11-01 14:49:03 -0700773 ALOGV("%s: map (%s, %s) to (%s, %s, %s)", getDebugName().c_str(),
Chia-I Wube02ec02018-05-18 10:59:36 -0700774 dataspaceDetails(static_cast<android_dataspace_t>(dataspace)).c_str(),
775 decodeRenderIntent(intent).c_str(),
776 dataspaceDetails(static_cast<android_dataspace_t>(hwcDataspace)).c_str(),
777 decodeColorMode(hwcColorMode).c_str(), decodeRenderIntent(hwcIntent).c_str());
778
779 mColorModes[getColorModeKey(dataspace, intent)] = {hwcDataspace, hwcColorMode, hwcIntent};
780}
781
782void DisplayDevice::populateColorModes(
783 const std::unordered_map<ColorMode, std::vector<RenderIntent>>& hwcColorModes) {
784 if (!hasWideColorGamut()) {
785 return;
786 }
787
Chia-I Wu0d711262018-05-21 15:19:35 -0700788 // collect all known SDR render intents
789 std::unordered_set<RenderIntent> sdrRenderIntents(sSdrRenderIntents.begin(),
790 sSdrRenderIntents.end());
791 auto iter = hwcColorModes.find(ColorMode::SRGB);
792 if (iter != hwcColorModes.end()) {
793 for (auto intent : iter->second) {
794 sdrRenderIntents.insert(intent);
795 }
796 }
797
Chia-I Wuc4b08bd2018-05-29 12:57:23 -0700798 // add all known SDR combinations
Chia-I Wu0d711262018-05-21 15:19:35 -0700799 for (auto intent : sdrRenderIntents) {
Chia-I Wube02ec02018-05-18 10:59:36 -0700800 for (auto mode : sSdrColorModes) {
801 addColorMode(hwcColorModes, mode, intent);
Peiyong Lin136fbbc2018-04-17 15:09:44 -0700802 }
803 }
Chia-I Wube02ec02018-05-18 10:59:36 -0700804
Chia-I Wuc4b08bd2018-05-29 12:57:23 -0700805 // collect all known HDR render intents
806 std::unordered_set<RenderIntent> hdrRenderIntents(sHdrRenderIntents.begin(),
807 sHdrRenderIntents.end());
808 iter = hwcColorModes.find(ColorMode::BT2100_PQ);
809 if (iter != hwcColorModes.end()) {
810 for (auto intent : iter->second) {
811 hdrRenderIntents.insert(intent);
812 }
813 }
814
815 // add all known HDR combinations
Chia-I Wube02ec02018-05-18 10:59:36 -0700816 for (auto intent : sHdrRenderIntents) {
817 for (auto mode : sHdrColorModes) {
818 addColorMode(hwcColorModes, mode, intent);
819 }
820 }
821}
822
823bool DisplayDevice::hasRenderIntent(RenderIntent intent) const {
824 // assume a render intent is supported when SRGB supports it; we should
825 // get rid of that assumption.
826 auto iter = mColorModes.find(getColorModeKey(Dataspace::SRGB, intent));
827 return iter != mColorModes.end() && iter->second.renderIntent == intent;
828}
829
Peiyong Lindfde5112018-06-05 10:58:41 -0700830bool DisplayDevice::hasLegacyHdrSupport(Dataspace dataspace) const {
Chia-I Wube02ec02018-05-18 10:59:36 -0700831 if ((dataspace == Dataspace::BT2020_PQ && hasHDR10Support()) ||
832 (dataspace == Dataspace::BT2020_HLG && hasHLGSupport())) {
833 auto iter =
834 mColorModes.find(getColorModeKey(dataspace, RenderIntent::TONE_MAP_COLORIMETRIC));
Peiyong Lindfde5112018-06-05 10:58:41 -0700835 return iter == mColorModes.end() || iter->second.dataspace != dataspace;
Chia-I Wube02ec02018-05-18 10:59:36 -0700836 }
837
838 return false;
839}
840
841void DisplayDevice::getBestColorMode(Dataspace dataspace, RenderIntent intent,
842 Dataspace* outDataspace, ColorMode* outMode,
843 RenderIntent* outIntent) const {
844 auto iter = mColorModes.find(getColorModeKey(dataspace, intent));
845 if (iter != mColorModes.end()) {
846 *outDataspace = iter->second.dataspace;
847 *outMode = iter->second.colorMode;
848 *outIntent = iter->second.renderIntent;
849 } else {
Chia-I Wu6333af52018-10-16 13:46:36 -0700850 // this is unexpected on a WCG display
851 if (hasWideColorGamut()) {
852 ALOGE("map unknown (%s)/(%s) to default color mode",
853 dataspaceDetails(static_cast<android_dataspace_t>(dataspace)).c_str(),
854 decodeRenderIntent(intent).c_str());
855 }
Chia-I Wube02ec02018-05-18 10:59:36 -0700856
857 *outDataspace = Dataspace::UNKNOWN;
858 *outMode = ColorMode::NATIVE;
859 *outIntent = RenderIntent::COLORIMETRIC;
860 }
Peiyong Lin136fbbc2018-04-17 15:09:44 -0700861}
862
Dominik Laskowski663bd282018-04-19 15:26:54 -0700863std::atomic<int32_t> DisplayDeviceState::sNextSequenceId(1);
Peiyong Linfd997e02018-03-28 15:29:00 -0700864
865} // namespace android