[waffle] [PATCH] add robust access context support

Emil Velikov emil.l.velikov at gmail.com
Mon Apr 4 22:25:27 UTC 2016


Hi Bas,

Big thanks for adding this. It's been on my radar for a while but
considering no mesa drivers supported it I never got to it.

Top-level question, can we please split this into a separate patches -
waffle.h + core, egl, glx, wgl.

On 4 April 2016 at 12:31, Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl> wrote:
> Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> ---
>  include/waffle/waffle.h              |  2 ++
>  src/waffle/core/wcore_config_attrs.c |  3 +++
>  src/waffle/core/wcore_config_attrs.h |  1 +
>  src/waffle/core/wcore_util.c         |  1 +
>  src/waffle/egl/wegl_config.c         | 16 ++++++++++++++++
>  src/waffle/egl/wegl_context.c        |  6 ++++++
>  src/waffle/egl/wegl_display.c        |  3 ++-
>  src/waffle/egl/wegl_display.h        |  1 +
>  src/waffle/glx/glx_config.c          |  7 +++++++
>  src/waffle/glx/glx_context.c         |  4 ++++
>  src/waffle/glx/glx_display.c         |  1 +
>  src/waffle/glx/glx_display.h         |  1 +
>  src/waffle/wgl/wgl_config.c          |  7 +++++++
>  src/waffle/wgl/wgl_context.c         |  4 ++++
>  src/waffle/wgl/wgl_display.h         |  1 +
>  15 files changed, 57 insertions(+), 1 deletion(-)
>
> diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h
> index df0218e..cd13119 100644
> --- a/include/waffle/waffle.h
> +++ b/include/waffle/waffle.h
> @@ -142,6 +142,8 @@ enum waffle_enum {
>      WAFFLE_CONTEXT_DEBUG                                        = 0x0216,
>  #endif
>
> +    WAFFLE_CONTEXT_ROBUST_ACCESS                                = 0x0217,
Please the documentation as well:

man/waffle_config.3.xml
man/waffle_context.3.xml
man/waffle_enums.3.xml


> --- a/src/waffle/egl/wegl_config.c
> +++ b/src/waffle/egl/wegl_config.c
> @@ -55,6 +55,22 @@ check_context_attrs(struct wegl_display *dpy,
>          return false;
>      }
>
> +    if (attrs->context_robust && !dpy->EXT_create_context_robustness &&
> +        attrs->context_api != WAFFLE_CONTEXT_OPENGL) {
> +        wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
> +                     "EGL_EXT_create_context_robustness is required in order to "
> +                     "request a robust access context for OpenGL ES");
> +        return false;
> +    }
> +
> +    if (attrs->context_robust && !dpy->KHR_create_context &&
> +        attrs->context_api == WAFFLE_CONTEXT_OPENGL) {
> +        wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
> +                     "EGL_KHR_create_context is required in order to "
> +                     "request a robust access context for OpenGL");
> +        return false;
> +    }
> +
>      switch (attrs->context_api) {
>          case WAFFLE_CONTEXT_OPENGL:
>              if (!wcore_config_attrs_version_eq(attrs, 10) && !dpy->KHR_create_context) {
> diff --git a/src/waffle/egl/wegl_context.c b/src/waffle/egl/wegl_context.c
> index f4ee6cd..00cd251 100644
> --- a/src/waffle/egl/wegl_context.c
> +++ b/src/waffle/egl/wegl_context.c
> @@ -112,6 +112,8 @@ create_real_context(struct wegl_config *config,
>                          return EGL_NO_CONTEXT;
>                  }
>              }
> +            if (attrs->context_robust)
> +                context_flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
Can you please move this next to the context_forward_compatible one.
Perhaps with a similar assert.


> --- a/src/waffle/egl/wegl_display.c
> +++ b/src/waffle/egl/wegl_display.c
> @@ -49,7 +49,8 @@ get_extensions(struct wegl_display *dpy)
>      // pending emission.
>      assert(wcore_error_get_code() == 0);
>
> -    dpy->KHR_create_context = waffle_is_extension_in_string(extensions, "EGL_KHR_create_context");
> +    dpy->EXT_create_context_robustness = waffle_is_extension_in_string(extensions, "EGL_EXT_create_context_robustness");
> +    dpy->KHR_create_context            = waffle_is_extension_in_string(extensions, "EGL_KHR_create_context");
>
Please keep drop the whilespace alignment.


> --- a/src/waffle/glx/glx_display.c
> +++ b/src/waffle/glx/glx_display.c
> @@ -63,6 +63,7 @@ glx_display_set_extensions(struct glx_display *self)
>
>      self->ARB_create_context                     = waffle_is_extension_in_string(s, "GLX_ARB_create_context");
>      self->ARB_create_context_profile             = waffle_is_extension_in_string(s, "GLX_ARB_create_context_profile");
> +    self->ARB_create_context_robustness          = waffle_is_extension_in_string(s, "GLX_ARB_create_context_robustness");
We are missing analogous hunk for WGL, aren't we ?


Have you looked at CGL/NaCl support ? Afaics both of them lack similar
API, correct ? If so one should add
wcore_error(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM...) to
{nacl,cgl}_config.[cm].

Tapani, do you know if NaCl has functionality analogous to
GLX_ARB_create_context_robustness ?

Regards,
Emil


More information about the waffle mailing list