Address VRI review comments
Test: make
Bug: 266628247
Change-Id: I8652d1e33ad01be48a2efa4c323f60f6f65e73bd
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index c0f3086..5b51b64 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -289,7 +289,8 @@
float CanvasContext::setColorMode(ColorMode mode) {
if (mode != mColorMode) {
- if (mode == ColorMode::Hdr && !mRenderPipeline->supportsExtendedRangeHdr()) {
+ const bool isHdr = mode == ColorMode::Hdr || mode == ColorMode::Hdr10;
+ if (isHdr && !mRenderPipeline->supportsExtendedRangeHdr()) {
mode = ColorMode::WideColorGamut;
}
mColorMode = mode;
@@ -299,13 +300,15 @@
switch (mColorMode) {
case ColorMode::Hdr:
return 3.f; // TODO: Refine this number
+ case ColorMode::Hdr10:
+ return 10.f;
default:
return 1.f;
}
}
float CanvasContext::targetSdrHdrRatio() const {
- if (mColorMode == ColorMode::Hdr) {
+ if (mColorMode == ColorMode::Hdr || mColorMode == ColorMode::Hdr10) {
return mTargetSdrHdrRatio;
} else {
return 1.f;
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 5b7cf75..4fb114b 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -455,6 +455,7 @@
// composer3 support, just treat HDR as equivalent to wide color gamut if
// the GLES path is still being hit
case ColorMode::Hdr:
+ case ColorMode::Hdr10:
case ColorMode::WideColorGamut: {
skcms_Matrix3x3 colorGamut;
LOG_ALWAYS_FATAL_IF(!colorSpace->toXYZD50(&colorGamut),
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index f8e2dee..cdfbf02 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -134,7 +134,7 @@
float RenderProxy::setColorMode(ColorMode mode) {
// We only need to figure out what the renderer supports for HDR, otherwise this can stay
// an async call since we already know the return value
- if (mode == ColorMode::Hdr) {
+ if (mode == ColorMode::Hdr || mode == ColorMode::Hdr10) {
return mRenderThread.queue().runSync(
[=]() -> float { return mContext->setColorMode(mode); });
} else {
diff --git a/libs/hwui/renderthread/VulkanSurface.cpp b/libs/hwui/renderthread/VulkanSurface.cpp
index 2efa5d6..21b6c44 100644
--- a/libs/hwui/renderthread/VulkanSurface.cpp
+++ b/libs/hwui/renderthread/VulkanSurface.cpp
@@ -201,7 +201,7 @@
outWindowInfo->colorspace = colorSpace;
outWindowInfo->colorMode = colorMode;
- if (colorMode == ColorMode::Hdr) {
+ if (colorMode == ColorMode::Hdr || colorMode == ColorMode::Hdr10) {
outWindowInfo->dataspace =
static_cast<android_dataspace>(STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_EXTENDED);
} else {
@@ -509,7 +509,7 @@
mNativeBuffers[i].skSurface.reset();
}
- if (mWindowInfo.colorMode == ColorMode::Hdr) {
+ if (mWindowInfo.colorMode == ColorMode::Hdr || mWindowInfo.colorMode == ColorMode::Hdr10) {
mWindowInfo.dataspace =
static_cast<android_dataspace>(STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_EXTENDED);
} else {
@@ -521,7 +521,7 @@
"Unsupported colorspace");
if (mNativeWindow) {
- int err = native_window_set_buffers_data_space(mNativeWindow.get(), mWindowInfo.dataspace);
+ int err = ANativeWindow_setBuffersDataSpace(mNativeWindow.get(), mWindowInfo.dataspace);
if (err != 0) {
ALOGE("VulkanSurface::setColorSpace() native_window_set_buffers_data_space(%d) "
"failed: %s (%d)",