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

Jose Fonseca jfonseca at vmware.com
Wed Nov 12 09:09:34 PST 2014


Thanks for the review.

> Yet the spec seems to lack any version update, or a note in the revision
history afaict :(

I don't know if Khronos did further changes but I believe there is some mention on the bottom https://www.opengl.org/registry/specs/EXT/glx_create_context_es2_profile.txt where it says "Version 3, 2012/03/28 - Add support for any OpenGL-ES version ...".

>  I think dri2 and dri3 need a treatment similar to glxsw ? Perhaps even Cc mesa-stable ?

Yes I think you're right.  I only build-tested the DRI changes. But I really don't have the time or the right development environment setup to test this properly on DRI.

If somebody who works more closely with DRI could take PATCH 2/3 and 3/3 polish it up, I'd really appreciate it.  I won't claim authorship.

Jose

________________________________________
From: Emil Velikov <emil.l.velikov at gmail.com>
Sent: 12 November 2014 16:55
To: Jose Fonseca; mesa-dev at lists.freedesktop.org
Cc: emil.l.velikov at gmail.com
Subject: Re: [Mesa-dev] [PATCH 3/3] glx: Allow to create any OpenGL ES version.

On 12/11/14 12:37, jfonseca at vmware.com 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."
>
Yet the spec seems to lack any version update, or a note in the revision
history afaict :(

> 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."
>
Yeah I've spotted that one while working on waffle this summer but
completely forgot to send out a patch. I think dri2 and dri3 need a
treatment similar to glxsw ? Perhaps even Cc mesa-stable ?

Fwiw with the addition to dri2.c and dri3.c this patch is
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>


Thanks
Emil

> Totally untested.  (Just happened to noticed this while implementing
> GLX_EXT_create_context_es2_profile for st/xlib.)
> ---
>  src/glx/dri_common.c | 32 ++++++++++++++++----------------
>  src/glx/drisw_glx.c  |  2 ++
>  2 files changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
> index 63c8de3..541abbb 100644
> --- a/src/glx/dri_common.c
> +++ b/src/glx/dri_common.c
> @@ -544,9 +544,22 @@ 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:
> +         switch (*major_ver) {
> +         case 3:
> +            *api = __DRI_API_GLES3;
> +            break;
> +         case 2:
> +            *api = __DRI_API_GLES2;
> +            break;
> +         case 1:
> +            *api = __DRI_API_GLES;
> +            break;
> +         default:
> +            *error = __DRI_CTX_ERROR_BAD_API;
> +            return false;
> +         }
> +         break;
>        default:
>        *error = __DRI_CTX_ERROR_BAD_API;
>        return false;
> @@ -577,19 +590,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 749ceb0..b0be5d0 100644
> --- a/src/glx/drisw_glx.c
> +++ b/src/glx/drisw_glx.c
> @@ -617,6 +617,8 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions)
>        /* DRISW version >= 2 implies support for OpenGL ES 2.0.
>         */
>        __glXEnableDirectExtension(&psc->base,
> +                              "GLX_EXT_create_context_es_profile");
> +      __glXEnableDirectExtension(&psc->base,
>                                "GLX_EXT_create_context_es2_profile");
>     }
>
>


More information about the mesa-dev mailing list