Expose EGL_EXT_image_gl_colorspace if EGL_KHR... is present.
Adreno 530 driver exposes EGL_KHR_image_gl_colorspace, which is
the draft name of EGL_EXT_image_gl_colorspace that was changed during
Khronos review. Add a mitigation to expose the correct extension
string until the driver can be fixed.
Bug: 78368937
Test: Built and flashed Pixel XL, verified that the extension
EGL_EXT_image_gl_colorspace is present in the list of EGL exts;
Ran CtsNativeHardwareTestCases and inspected the log to verify
that test cases for sRGB EGLImages are not skipped.
Change-Id: I64cef7be828516e2dbc160f98c83879fd8662450
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index a56890a..2aec249 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -240,6 +240,12 @@
if (len) {
// NOTE: we could avoid the copy if we had strnstr.
const std::string ext(start, len);
+ // Temporary hack: Adreno 530 driver exposes this extension under the draft
+ // KHR name, but during Khronos review it was decided to demote it to EXT.
+ if (ext == "EGL_EXT_image_gl_colorspace" &&
+ findExtension(disp.queryString.extensions, "EGL_KHR_image_gl_colorspace")) {
+ mExtensionString.append("EGL_EXT_image_gl_colorspace ");
+ }
if (findExtension(disp.queryString.extensions, ext.c_str(), len)) {
mExtensionString.append(ext + " ");
}