summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2023-12-08 11:27:19 -0500
committer John Reck <jreck@google.com> 2023-12-08 11:36:17 -0500
commit4bd8d8a49cc85598a2f15227a8e47ee34447b73e (patch)
tree2170ed0c5fadd779dcd6a64ea16ab2de98e080b0
parente2d61b7b6f46447249deed2326a52122f5c10e28 (diff)
Track ADataSpace naming adjustments
Test: make Bug: 315475131 Change-Id: Ieb8ec0065b1b6ce165e43b1f539ccb1238ceb747
-rw-r--r--libs/hwui/renderthread/EglManager.cpp7
-rw-r--r--libs/hwui/renderthread/VulkanSurface.cpp9
2 files changed, 9 insertions, 7 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 94f35fd9eaf2..facf30b83b07 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -37,6 +37,9 @@
// Android-specific addition that is used to show when frames began in systrace
EGLAPI void EGLAPIENTRY eglBeginFrame(EGLDisplay dpy, EGLSurface surface);
+static constexpr auto P3_XRB = static_cast<android_dataspace>(
+ ADATASPACE_STANDARD_DCI_P3 | ADATASPACE_TRANSFER_SRGB | ADATASPACE_RANGE_EXTENDED);
+
namespace android {
namespace uirenderer {
namespace renderthread {
@@ -497,9 +500,7 @@ Result<EGLSurface, EGLint> EglManager::createSurface(EGLNativeWindowType window,
// This relies on knowing that EGL will not re-set the dataspace after the call to
// eglCreateWindowSurface. Since the handling of the colorspace extension is largely
// implemented in libEGL in the platform, we can safely assume this is the case
- int32_t err = ANativeWindow_setBuffersDataSpace(
- window,
- static_cast<android_dataspace>(STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_EXTENDED));
+ int32_t err = ANativeWindow_setBuffersDataSpace(window, P3_XRB);
LOG_ALWAYS_FATAL_IF(err, "Failed to ANativeWindow_setBuffersDataSpace %d", err);
}
diff --git a/libs/hwui/renderthread/VulkanSurface.cpp b/libs/hwui/renderthread/VulkanSurface.cpp
index 20b743bab2c2..a8e85475aff0 100644
--- a/libs/hwui/renderthread/VulkanSurface.cpp
+++ b/libs/hwui/renderthread/VulkanSurface.cpp
@@ -29,6 +29,9 @@ namespace android {
namespace uirenderer {
namespace renderthread {
+static constexpr auto P3_XRB = static_cast<android_dataspace>(
+ ADATASPACE_STANDARD_DCI_P3 | ADATASPACE_TRANSFER_SRGB | ADATASPACE_RANGE_EXTENDED);
+
static int InvertTransform(int transform) {
switch (transform) {
case ANATIVEWINDOW_TRANSFORM_ROTATE_90:
@@ -214,8 +217,7 @@ bool VulkanSurface::InitializeWindowInfoStruct(ANativeWindow* window, ColorMode
outWindowInfo->colorMode = colorMode;
if (colorMode == ColorMode::Hdr || colorMode == ColorMode::Hdr10) {
- outWindowInfo->dataspace =
- static_cast<android_dataspace>(STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_EXTENDED);
+ outWindowInfo->dataspace = P3_XRB;
} else {
outWindowInfo->dataspace = ColorSpaceToADataSpace(colorSpace.get(), colorType);
}
@@ -541,8 +543,7 @@ void VulkanSurface::setColorSpace(sk_sp<SkColorSpace> colorSpace) {
}
if (mWindowInfo.colorMode == ColorMode::Hdr || mWindowInfo.colorMode == ColorMode::Hdr10) {
- mWindowInfo.dataspace =
- static_cast<android_dataspace>(STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_EXTENDED);
+ mWindowInfo.dataspace = P3_XRB;
} else {
mWindowInfo.dataspace = ColorSpaceToADataSpace(
mWindowInfo.colorspace.get(), BufferFormatToColorType(mWindowInfo.bufferFormat));