[Mesa-stable] [Mesa-dev] [PATCH] egl: Fix OpenGL ES version checks in _eglParseContextAttribList()

Ian Romanick idr at freedesktop.org
Fri Aug 1 16:12:32 PDT 2014


On 06/18/2014 05:49 PM, Anuj Phogat wrote:
> Fixes gles3 Khronos CTS test:
> egl_create_context.egl_create_context
> 
> Cc: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/egl/main/eglcontext.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
> index 70277ab..b8b30cb 100644
> --- a/src/egl/main/eglcontext.c
> +++ b/src/egl/main/eglcontext.c
> @@ -322,10 +322,15 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
>           break;
>  
>        case 3:
> -      default:
> -         /* Don't put additional version checks here.  We don't know that
> -          * there won't be versions > 3.0.
> +         /* Update this condition if new OpenGL ES 3.x (x > 1) version is
> +          * announced.
>            */
> +         if (ctx->ClientMinorVersion > 1)
> +            err = EGL_BAD_MATCH;

I dug around in our EGL code and in the test case a bit more.  I think
if you delete the preceeding if-statement and add the following to the
commit message:

    We would generate EGL_BAD_CONFIG because _eglGetContextAPIBit
    returns zero for the combination of EGL_OPENGL_ES_API and a major
    version > 3.  By just returning zero, the caller can't tell the
    difference between a bad version (which should generate
    EGL_BAD_MATCH) and a bad API (which should generate
    EGL_BAD_CONFIG).  This patch causes us to filter out major
    versions > 3 at a point where we can generate the correct error.

The patch will be

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

We could also fix this a couple other ways, but I think they're all more
intrusive and not worth the effort.

> +         break;
> +
> +      default:
> +         err = EGL_BAD_MATCH;
>           break;
>        }
>     }



More information about the mesa-stable mailing list