[Mesa-dev] [PATCH] dri: Fix robust context creation via EGL attribute

Marek Olšák maraeo at gmail.com
Mon Apr 11 22:56:13 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Tue, Apr 12, 2016 at 1:34 AM, Chad Versace <chad.versace at intel.com> wrote:
> driCreateContextAttribs() emits an error if bit
> __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS is set for an ES context.  But,
> EGL_EXT_create_context_robustness and EGL 1.5 both allow creation of
> robust ES contexts. One requests a robust ES context by setting the
> EGL_CONTEXT_OPENGL_ROBUST_ACCESS *attribute*, which Mesa's EGL layer
> translates into the __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS *bit*.
> ---
>  src/mesa/drivers/dri/common/dri_util.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
> index a654508..79cb050 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -376,11 +376,32 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
>       *     EGL_CONTEXT_FLAGS_KHR, then a <debug context> will be created.
>       *     [...] This bit is supported for OpenGL and OpenGL ES contexts.
>       *
> -     * None of the other flags have any meaning in an ES context, so this seems safe.
> +     * No other EGL_CONTEXT_OPENGL_*_BIT is legal for an ES context.
> +     *
> +     * However, Mesa's EGL layer translates the context attribute
> +     * EGL_CONTEXT_OPENGL_ROBUST_ACCESS into the context flag
> +     * __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS.  That attribute is legal for ES
> +     * (with EGL 1.5 or EGL_EXT_create_context_robustness) and GL (only with
> +     * EGL 1.5).
> +     *
> +     * From the EGL_EXT_create_context_robustness spec:
> +     *
> +     *     This extension is written against the OpenGL ES 2.0 Specification
> +     *     but can apply to OpenGL ES 1.1 and up.
> +     *
> +     * From the EGL 1.5 (2014.08.27) spec, p55:
> +     *
> +     *     If the EGL_CONTEXT_OPENGL_ROBUST_ACCESS attribute is set to
> +     *     EGL_TRUE, a context supporting robust buffer access will be created.
> +     *     OpenGL contexts must support the GL_ARB_robustness extension, or
> +     *     equivalent core API functional- ity. OpenGL ES contexts must support
> +     *     the GL_EXT_robustness extension, or equivalent core API
> +     *     functionality.
>       */
>      if (mesa_api != API_OPENGL_COMPAT
>          && mesa_api != API_OPENGL_CORE
> -        && (flags & ~__DRI_CTX_FLAG_DEBUG)) {
> +        && (flags & ~(__DRI_CTX_FLAG_DEBUG |
> +                     __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS))) {
>         *error = __DRI_CTX_ERROR_BAD_FLAG;
>         return NULL;
>      }
> --
> 2.8.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list