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

Ian Romanick idr at freedesktop.org
Mon Apr 13 14:29:16 PDT 2015


On 04/10/2015 04:57 PM, Chad Versace wrote:
> 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 tried to explain the situation in the cooment. :( In order to use
GLX_EXT_create_context_es2_profile, you have to use functions that were
added with GLX_ARB_create_context_profile.  The ARB extension depends on
both client and server support, but the EXT only depends on client
support.  So, if the client says it supports both the ARB and EXT but
the server does not support the ARB, we would say that
GLX_EXT_create_context_es2_profile, and that would be a lie.

That bit of code just disables GLX_EXT_create_context_es2_profile when
GLX_ARB_create_context_profile is not fully supported.

Your assertion that a similar change is necessary for the new extension
string is correct.  Good catch. :)

> 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,



More information about the mesa-dev mailing list