diff options
author | Sally Qi <sallyqi@google.com> | 2023-07-17 12:52:05 +0800 |
---|---|---|
committer | Sally Qi <sallyqi@google.com> | 2023-08-21 22:20:39 +0000 |
commit | 03a1a752a31ecc1432e259f5d6c7c70c68ba533e (patch) | |
tree | 78197fbb93936c044db77dd886a270f469ec4006 /opengl | |
parent | 4e9661b50d580e3f35abf2b7d73c3b4d92029f65 (diff) | |
download | native-03a1a752a31ecc1432e259f5d6c7c70c68ba533e.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
Merged-In: 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 5f441ee84e..4b637dc60b 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) { @@ -422,7 +423,13 @@ static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace) { } else if (colorspace == EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT) { return HAL_DATASPACE_V0_SCRGB_LINEAR; } 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; } @@ -566,8 +573,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) { @@ -707,7 +712,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. |