From 9c67bfd86cb30e21f016414f416b40b6c70a899a Mon Sep 17 00:00:00 2001 From: Sandeep Shinde Date: Tue, 10 Feb 2015 16:04:15 +0530 Subject: [PATCH] egl: Enable EGL_KHR_GL_COLORSPACE Add EGL_KHR_GL_COLORSPACE extension to EGL header. Enable EGL_KHR_GL_COLORSPACE extension handling in meta EGL layer. Change-Id: If6d3fe26c411ddc83d8b23bf16e93862cf68c1b6 --- opengl/include/EGL/eglext.h | 7 +++++++ opengl/libs/EGL/eglApi.cpp | 24 +----------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h index ccba4326b5..114079b99e 100644 --- a/opengl/include/EGL/eglext.h +++ b/opengl/include/EGL/eglext.h @@ -115,6 +115,13 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL #define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */ #endif +#ifndef EGL_KHR_gl_colorspace +#define EGL_KHR_gl_colorspace 1 +#define EGL_GL_COLORSPACE_KHR 0x309D +#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 +#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A +#endif + #ifndef EGL_KHR_gl_renderbuffer_image #define EGL_KHR_gl_renderbuffer_image 1 #define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index cdec565e4e..cfae0951a6 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -49,10 +49,6 @@ using namespace android; -// This extension has not been ratified yet, so can't be shipped. -// Implementation is incomplete and untested. -#define ENABLE_EGL_KHR_GL_COLORSPACE 0 - // ---------------------------------------------------------------------------- namespace android { @@ -87,9 +83,7 @@ extern char const * const gExtensionString = "EGL_KHR_image_base " // mandatory "EGL_KHR_image_pixmap " "EGL_KHR_lock_surface " -#if (ENABLE_EGL_KHR_GL_COLORSPACE != 0) "EGL_KHR_gl_colorspace " -#endif "EGL_KHR_gl_texture_2D_image " "EGL_KHR_gl_texture_3D_image " "EGL_KHR_gl_texture_cubemap_image " @@ -417,12 +411,6 @@ EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, // surfaces // ---------------------------------------------------------------------------- -// The EGL_KHR_gl_colorspace spec hasn't been ratified yet, so these haven't -// been added to the Khronos egl.h. -#define EGL_GL_COLORSPACE_KHR EGL_VG_COLORSPACE -#define EGL_GL_COLORSPACE_SRGB_KHR EGL_VG_COLORSPACE_sRGB -#define EGL_GL_COLORSPACE_LINEAR_KHR EGL_VG_COLORSPACE_LINEAR - // Turn linear formats into corresponding sRGB formats when colorspace is // EGL_GL_COLORSPACE_SRGB_KHR, or turn sRGB formats into corresponding linear // formats when colorspace is EGL_GL_COLORSPACE_LINEAR_KHR. In any cases where @@ -489,17 +477,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, if (attrib_list && dp->haveExtension("EGL_KHR_gl_colorspace")) { for (const EGLint* attr = attrib_list; *attr != EGL_NONE; attr += 2) { if (*attr == EGL_GL_COLORSPACE_KHR) { - if (ENABLE_EGL_KHR_GL_COLORSPACE) { - dataSpace = modifyBufferDataspace(dataSpace, *(attr+1)); - } else { - // Normally we'd pass through unhandled attributes to - // the driver. But in case the driver implements this - // extension but we're disabling it, we want to prevent - // it getting through -- support will be broken without - // our help. - ALOGE("sRGB window surfaces not supported"); - return setError(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE); - } + dataSpace = modifyBufferDataspace(dataSpace, *(attr+1)); } } } -- 2.11.0