diff options
-rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/renderthread/VulkanSurface.cpp | 9 |
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)); |