[Mesa-dev] [PATCH 2/2] egl: add check that eglCreateContext gets a valid config

Eric Engestrom eric.engestrom at imgtec.com
Thu Oct 20 14:41:13 UTC 2016


On Thursday, 2016-10-20 15:34:52 +0100, Eric Engestrom wrote:
> On Thursday, 2016-10-20 14:55:25 +0300, Tapani Pälli wrote:
> > Fixes following dEQP test:
> > 
> >    dEQP-EGL.functional.negative_api.create_context
> > 
> > Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> > ---
> >  src/egl/main/eglapi.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> > index d8bd76d..e96999c 100644
> > --- a/src/egl/main/eglapi.c
> > +++ b/src/egl/main/eglapi.c
> > @@ -733,6 +733,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
> >     _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_NO_CONTEXT);
> >  
> >     _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
> > +   _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
> 
> I'm pretty sure that prevents the use of EGL_KHR_no_config_context :)
> 
> >  
> >     if (!config && !disp->Extensions.KHR_no_config_context)
> >        RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
> 
> Move the line to this `if` (ie. instead of the RETURN_EGL_ERROR here),
> and you can have my:
> Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

Sorry, forgot to mention the `!config` bit needs to be removed...
To be clear, I believe this is the correct fix:

----8<----
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index d8bd76d..eaaa8a2 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -734,8 +734,8 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
 
    _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
 
-   if (!config && !disp->Extensions.KHR_no_config_context)
-      RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
+   if (!disp->Extensions.KHR_no_config_context)
+      _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
 
    if (!share && share_list != EGL_NO_CONTEXT)
       RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
---->8----


> 
> > -- 
> > 2.7.4


More information about the mesa-dev mailing list