diff options
author | Sally Qi <sallyqi@google.com> | 2023-07-17 12:52:05 +0800 |
---|---|---|
committer | Sally Qi <sallyqi@google.com> | 2023-07-19 21:58:05 +0800 |
commit | aa238976f9378543e8512e0e6e87e38e65c2103c (patch) | |
tree | 14cbe7786a92fed28a6ac8f20f20a4a3adb61798 /opengl | |
parent | 25537f8503565a35062ffe01a83914abb96a2db2 (diff) | |
download | native-aa238976f9378543e8512e0e6e87e38e65c2103c.tar.gz |
Fix bt2020 linear ext mapping issue in EGL and Vulkan.
- EGL_EXT_BT2020_LINEAR should be mapped to extend bt2020 linear if
output format is FP16.
Bug: 261485283
Test: builds
Change-Id: Ifd68cc10afc0b5b38b15af2a938d02bb3bcd3764
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libs/EGL/egl_platform_entries.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp index 88001b2b95..440eb17873 100644 --- a/opengl/libs/EGL/egl_platform_entries.cpp +++ b/opengl/libs/EGL/egl_platform_entries.cpp @@ -49,6 +49,7 @@ #include "egl_trace.h" using namespace android; +using PixelFormat = aidl::android::hardware::graphics::common::PixelFormat; // ---------------------------------------------------------------------------- @@ -406,7 +407,7 @@ EGLBoolean eglGetConfigAttribImpl(EGLDisplay dpy, EGLConfig config, EGLint attri // ---------------------------------------------------------------------------- // Translates EGL color spaces to Android data spaces. -static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace) { +static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace, PixelFormat pixelFormat) { if (colorspace == EGL_GL_COLORSPACE_LINEAR_KHR) { return HAL_DATASPACE_UNKNOWN; } else if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) { @@ -424,7 +425,13 @@ static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace) { } else if (colorspace == EGL_GL_COLORSPACE_BT2020_HLG_EXT) { return static_cast<android_dataspace>(HAL_DATASPACE_BT2020_HLG); } else if (colorspace == EGL_GL_COLORSPACE_BT2020_LINEAR_EXT) { - return HAL_DATASPACE_BT2020_LINEAR; + if (pixelFormat == PixelFormat::RGBA_FP16) { + return static_cast<android_dataspace>(HAL_DATASPACE_STANDARD_BT2020 | + HAL_DATASPACE_TRANSFER_LINEAR | + HAL_DATASPACE_RANGE_EXTENDED); + } else { + return HAL_DATASPACE_BT2020_LINEAR; + } } else if (colorspace == EGL_GL_COLORSPACE_BT2020_PQ_EXT) { return HAL_DATASPACE_BT2020_PQ; } @@ -573,8 +580,6 @@ void convertAttribs(const EGLAttrib* attribList, std::vector<EGLint>& newList) { newList.push_back(EGL_NONE); } -using PixelFormat = aidl::android::hardware::graphics::common::PixelFormat; - // Gets the native pixel format corrsponding to the passed EGLConfig. void getNativePixelFormat(EGLDisplay dpy, egl_connection_t* cnx, EGLConfig config, PixelFormat* format) { @@ -714,7 +719,7 @@ EGLSurface eglCreateWindowSurfaceTmpl(egl_display_t* dp, egl_connection_t* cnx, return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); } - android_dataspace dataSpace = dataSpaceFromEGLColorSpace(colorSpace); + android_dataspace dataSpace = dataSpaceFromEGLColorSpace(colorSpace, format); // Set dataSpace even if it could be HAL_DATASPACE_UNKNOWN. // HAL_DATASPACE_UNKNOWN is the default value, but it may have changed // at this point. |