[Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.

Chad Versace chad.versace at intel.com
Fri Apr 10 16:57:44 PDT 2015


On Fri 10 Apr 2015, Jose Fonseca wrote:
>From: José Fonseca <jfonseca at vmware.com>
>
>The latest version of GLX_EXT_create_context_es2_profile states:
>
>  "If the version requested is a valid and supported OpenGL-ES version,
>  and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the
>  GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context
>  returned will implement the OpenGL ES version requested."
>
>We must also export EXT_create_context_es_profile too, as
>EXT_create_context_es2_profile specification is crystal clear:
>
>  "NOTE: implementations of this extension must export BOTH extension
>  strings, for backwards compatibility with applications written
>  against version 1 of this extension."
>
>Totally untested.  (Just happened to noticed this while implementing
>GLX_EXT_create_context_es2_profile for st/xlib.)
>
>Reviewed-by: Brian Paul <brianp at vmware.com>
>Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
>
>v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested
>by Emil Velikov.
>---
> src/glx/dri2_glx.c   |  5 ++++-
> src/glx/dri3_glx.c   |  5 ++++-
> src/glx/dri_common.c | 32 ++++++++++++++++----------------
> src/glx/drisw_glx.c  |  2 ++
> 4 files changed, 26 insertions(+), 18 deletions(-)


Jose, you also need to add the extensions to the extension table in
glxextensions.c. Otherwise, __glXEnableDirectExtension() fails to find
and enable the extensions.

Also, Ian has a strange hack for es2_profile
__glXCalculateUsableExtensions that I don't understand, but probably
needs replicating for es_profile.

I applied the diff below on top of your patch, and glxinfo began
correctly advertising your extensions. Even with that diff, it's still
broken though. I tested it with waffle 1.5.0 as below:

    [chadv at daring mesa]$ wflinfo -p glx -a gles1
    Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: glXCreateContextAttribsARB failed
    [chadv at daring mesa]$ wflinfo -p glx -a gles2
    Waffle platform: glx
    Waffle api: gles2
    OpenGL vendor string: Intel Open Source Technology Center
    OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2)
    OpenGL version string: OpenGL ES 3.0 Mesa 10.6.0-devel (git-cd130b3)
    [chadv at daring mesa]$ wflinfo -p glx -a gles3
    Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: glXCreateContextAttribsARB failed


diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index ce5d66d..8f2f194 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -84,6 +84,7 @@ static const struct extension_info known_glx_extensions[] = {
    { GLX(EXT_visual_rating),           VER(0,0), Y, Y, N, N },
    { GLX(EXT_fbconfig_packed_float),   VER(0,0), Y, Y, N, N },
    { GLX(EXT_framebuffer_sRGB),        VER(0,0), Y, Y, N, N },
+   { GLX(EXT_create_context_es_profile), VER(0,0), Y, N, N, Y },
    { GLX(EXT_create_context_es2_profile), VER(0,0), Y, N, N, Y },
    { GLX(MESA_copy_sub_buffer),        VER(0,0), Y, N, N, N },
    { GLX(MESA_multithread_makecurrent),VER(0,0), Y, N, Y, N },
@@ -628,12 +629,13 @@ __glXCalculateUsableExtensions(struct glx_screen * psc,
    }
 
    /* This hack is necessary because GLX_ARB_create_context_profile depends on
-    * server support, but GLX_EXT_create_context_es2_profile is direct-only.
-    * Without this hack, it would be possible to advertise
-    * GLX_EXT_create_context_es2_profile without
+    * server support, but GLX_EXT_create_context_es2_profile and es_profile is
+    * direct-only.  Without this hack, it would be possible to advertise
+    * GLX_EXT_create_context_es2_profile and es_profile without
     * GLX_ARB_create_context_profile.  That would be a problem.
     */
    if (!IS_SET(server_support, ARB_create_context_profile_bit)) {
+      CLR_BIT(usable, EXT_create_context_es_profile_bit);
       CLR_BIT(usable, EXT_create_context_es2_profile_bit);
    }
 
diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
index 37e4ccc..3618127 100644
--- a/src/glx/glxextensions.h
+++ b/src/glx/glxextensions.h
@@ -45,6 +45,7 @@ enum
    EXT_import_context_bit,
    EXT_framebuffer_sRGB_bit,
    EXT_fbconfig_packed_float_bit,
+   EXT_create_context_es_profile_bit,
    EXT_create_context_es2_profile_bit,
    MESA_copy_sub_buffer_bit,
    MESA_depth_float_bit,
-- 
2.2.0



More information about the mesa-dev mailing list