[Mesa-stable] [Mesa-dev] [PATCH] egl: Emit correct error when robust context creation fails

Tapani Pälli tapani.palli at intel.com
Tue Dec 27 06:57:46 UTC 2016


Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

On 12/23/2016 03:29 AM, Chad Versace wrote:
> Fixes dEQP-EGL.functional.create_context_ext.robust_*
> on Intel with GBM.
>
> If the user sets the EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR in
> EGL_CONTEXT_FLAGS_KHR when creating an OpenGL ES context, then
> EGL_KHR_create_context spec requires that we unconditionally emit
> EGL_BAD_ATTRIBUTE because that flag does not exist for OpenGL ES. When
> creating an OpenGL context, the spec requires that we emit EGL_BAD_MATCH
> if we can't support the request; that error is generated in the egl_dri2
> layer where the driver capability is actually checked.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99188
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/egl/main/eglcontext.c | 38 ++++++++++++++++++++++++++------------
>  1 file changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
> index 60625f6470..5313e1dabc 100644
> --- a/src/egl/main/eglcontext.c
> +++ b/src/egl/main/eglcontext.c
> @@ -184,19 +184,33 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
>              break;
>           }
>
> -         /* The EGL_KHR_create_context_spec says:
> -          *
> -          *     "If the EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR bit is set in
> -          *     EGL_CONTEXT_FLAGS_KHR, then a context supporting <robust buffer
> -          *     access> will be created. Robust buffer access is defined in the
> -          *     GL_ARB_robustness extension specification, and the resulting
> -          *     context must also support either the GL_ARB_robustness
> -          *     extension, or a version of OpenGL incorporating equivalent
> -          *     functionality. This bit is supported for OpenGL contexts.
> -          */
>           if ((val & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) &&
> -             (api != EGL_OPENGL_API ||
> -              !dpy->Extensions.EXT_create_context_robustness)) {
> +             api != EGL_OPENGL_API) {
> +            /* The EGL_KHR_create_context spec says:
> +             *
> +             *   10) Which error should be generated if robust buffer access
> +             *       or reset notifications are requested under OpenGL ES?
> +             *
> +             *       As per Issue 6, this extension does not support creating
> +             *       robust contexts for OpenGL ES. This is only supported via
> +             *       the EGL_EXT_create_context_robustness extension.
> +             *
> +             *       Attempting to use this extension to create robust OpenGL
> +             *       ES context will generate an EGL_BAD_ATTRIBUTE error. This
> +             *       specific error is generated because this extension does
> +             *       not define the EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR
> +             *       and EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR
> +             *       bits for OpenGL ES contexts. Thus, use of these bits fall
> +             *       under condition described by: "If an attribute is
> +             *       specified that is not meaningful for the client API
> +             *       type.." in the above specification.
> +             *
> +             * The spec requires that we emit the error even if the display
> +             * supports EGL_EXT_create_context_robustness. To create a robust
> +             * GLES context, the *attribute*
> +             * EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT must be used, not the
> +             * *flag* EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR.
> +             */
>              err = EGL_BAD_ATTRIBUTE;
>              break;
>           }
>


More information about the mesa-stable mailing list