[Mesa-dev] [PATCH v2] glx: update to updated version of EXT_create_context_es2_profile

Jose Fonseca jfonseca at vmware.com
Thu Jan 21 09:10:23 PST 2016


FWIW see

   https://bugs.freedesktop.org/show_bug.cgi?id=92869
   http://cgit.freedesktop.org/~jrfonseca/mesa/commit/?h=es2_profile

On 21/01/16 16:58, Ilia Mirkin wrote:
> The EXT spec has been updated to:
>   - logically combine the es2_profile and es_profile exts
>   - allow any legal version to be requested
>
> dEQP tests request a specific ES version when using GLX, so this allows
> dEQP upstream to run against GLX with the appropriate X server patch
> (which had similar disabling logic).
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Reviewed-by: Matt Turner <mattst88 at gmail.com> (v1)
>
> v1 -> v2:
>   - distinguish between DRI_API_GLES{,2,3}
>   - add GLX_EXT_create_context_es_profile client-side support
> ---
>   src/glx/dri2_glx.c      | 11 ++++++++---
>   src/glx/dri3_glx.c      |  7 ++++++-
>   src/glx/dri_common.c    | 28 ++++++++++++----------------
>   src/glx/drisw_glx.c     |  4 +++-
>   src/glx/glxextensions.c |  1 +
>   src/glx/glxextensions.h |  1 +
>   6 files changed, 31 insertions(+), 21 deletions(-)
>
> diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
> index 651915a..97bf49c 100644
> --- a/src/glx/dri2_glx.c
> +++ b/src/glx/dri2_glx.c
> @@ -1102,9 +1102,14 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,
>         __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context");
>         __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile");
>
> -      if ((mask & (1 << __DRI_API_GLES2)) != 0)
> -	 __glXEnableDirectExtension(&psc->base,
> -				    "GLX_EXT_create_context_es2_profile");
> +      if ((mask & (1 << (__DRI_API_GLES |
> +                         __DRI_API_GLES2 |
> +                         __DRI_API_GLES3))) != 0) {

I recalled Ian Romanick's review saying that supporting GLES3 without 
GLES2 was not a good idea:

  http://lists.freedesktop.org/archives/mesa-dev/2015-April/082010.html

> +         __glXEnableDirectExtension(&psc->base,
> +                                    "GLX_EXT_create_context_es_profile");
> +         __glXEnableDirectExtension(&psc->base,
> +                                    "GLX_EXT_create_context_es2_profile");
> +      }
>      }
>
>      for (i = 0; extensions[i]; i++) {
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index 8bdbb9c..9952e7e 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -665,9 +665,14 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
>      __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context");
>      __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile");
>
> -   if ((mask & (1 << __DRI_API_GLES2)) != 0)
> +   if ((mask & (1 << (__DRI_API_GLES |
> +                      __DRI_API_GLES2 |
> +                      __DRI_API_GLES3))) != 0) {

Same here.

Everything else looks the same as my patch AFAICT.

Jose


> +      __glXEnableDirectExtension(&psc->base,
> +                                 "GLX_EXT_create_context_es_profile");
>         __glXEnableDirectExtension(&psc->base,
>                                    "GLX_EXT_create_context_es2_profile");
> +   }
>
>      for (i = 0; extensions[i]; i++) {
>         /* when on a different gpu than the server, the server pixmaps
> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
> index 8a56385..6728d38 100644
> --- a/src/glx/dri_common.c
> +++ b/src/glx/dri_common.c
> @@ -547,9 +547,18 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
>         case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
>   	 *api = __DRI_API_OPENGL;
>   	 break;
> -      case GLX_CONTEXT_ES2_PROFILE_BIT_EXT:
> -	 *api = __DRI_API_GLES2;
> -	 break;
> +      case GLX_CONTEXT_ES_PROFILE_BIT_EXT:
> +         if (*major_ver >= 3)
> +            *api = __DRI_API_GLES3;
> +         else if (*major_ver == 2 && *minor_ver == 0)
> +            *api = __DRI_API_GLES2;
> +         else if (*major_ver == 1 && *minor_ver < 2)
> +            *api = __DRI_API_GLES;
> +         else {
> +            *error = __DRI_CTX_ERROR_BAD_API;
> +            return false;
> +         }
> +         break;
>         default:
>   	 *error = __DRI_CTX_ERROR_BAD_API;
>   	 return false;
> @@ -580,19 +589,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
>         return false;
>      }
>
> -   /* The GLX_EXT_create_context_es2_profile spec says:
> -    *
> -    *     "... If the version requested is 2.0, and the
> -    *     GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the
> -    *     GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context
> -    *     returned will implement OpenGL ES 2.0. This is the only way in which
> -    *     an implementation may request an OpenGL ES 2.0 context."
> -    */
> -   if (*api == __DRI_API_GLES2 && (*major_ver != 2 || *minor_ver != 0)) {
> -      *error = __DRI_CTX_ERROR_BAD_API;
> -      return false;
> -   }
> -
>      *error = __DRI_CTX_ERROR_SUCCESS;
>      return true;
>   }
> diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
> index 76cc321..241ac7f 100644
> --- a/src/glx/drisw_glx.c
> +++ b/src/glx/drisw_glx.c
> @@ -623,9 +623,11 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions)
>         __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context");
>         __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile");
>
> -      /* DRISW version >= 2 implies support for OpenGL ES 2.0.
> +      /* DRISW version >= 2 implies support for OpenGL ES.
>          */
>         __glXEnableDirectExtension(&psc->base,
> +				 "GLX_EXT_create_context_es_profile");
> +      __glXEnableDirectExtension(&psc->base,
>   				 "GLX_EXT_create_context_es2_profile");
>      }
>
> diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
> index 3b29aef..22b078c 100644
> --- a/src/glx/glxextensions.c
> +++ b/src/glx/glxextensions.c
> @@ -146,6 +146,7 @@ static const struct extension_info known_glx_extensions[] = {
>      { 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_es2_profile), VER(0,0), Y, N, N, N },
> +   { GLX(EXT_create_context_es_profile), VER(0,0), Y, N, N, N },
>      { GLX(MESA_copy_sub_buffer),        VER(0,0), Y, N, N, N },
>      { GLX(MESA_multithread_makecurrent),VER(0,0), Y, N, Y, N },
>      { GLX(MESA_query_renderer),         VER(0,0), Y, N, N, Y },
> diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
> index 3a9bc82..906b3fc 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