Re: [waffle] [PATCH] egl: Support robust access contexts with EGL 1.5.

2016-05-02 Thread Chad Versace
On Sat 16 Apr 2016, Emil Velikov wrote:

> On 15 April 2016 at 22:04, Bas Nieuwenhuizen  wrote:
> > EGL 1.5 also supports the EGL_CONTEXT_OPENGL_ROBUST_ACCESS
> > attribute without any extensions for both ES and non-ES.
> >
> > Signed-off-by: Bas Nieuwenhuizen 
> > ---
> >  src/waffle/egl/wegl_config.c  | 9 ++---
> >  src/waffle/egl/wegl_context.c | 9 +++--
> >  src/waffle/egl/wegl_display.c | 3 +--
> >  src/waffle/egl/wegl_display.h | 2 ++
> >  4 files changed, 16 insertions(+), 7 deletions(-)


> > diff --git a/src/waffle/egl/wegl_context.c b/src/waffle/egl/wegl_context.c
> > index 67cbc04..4b208fa 100644
> > --- a/src/waffle/egl/wegl_context.c
> > +++ b/src/waffle/egl/wegl_context.c
> > @@ -96,8 +96,13 @@ create_real_context(struct wegl_config *config,
> >  }
> >
> >  if (attrs->context_robust) {
> > -assert(dpy->KHR_create_context);
> > -context_flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
> > +if (dpy->major_version > 1 || dpy->minor_version >= 5) {
> > +attrib_list[i++] = 
> > EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT;
> We want EGL_CONTEXT_OPENGL_ROBUST_ACCESS (note missing _EXT) here.
> For whatever reason the two differ 0x31B2 vs 0x30BF (according to the
> includes in mesa).


> 
> With the s/_EXT//g issue above
> Reviewed-by: Emil Velikov 

I fixed this and pushed the patch.
___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH] egl: Support robust access contexts with EGL 1.5.

2016-04-15 Thread Emil Velikov
Hi Bas,

On 15 April 2016 at 22:04, Bas Nieuwenhuizen  wrote:
> EGL 1.5 also supports the EGL_CONTEXT_OPENGL_ROBUST_ACCESS
> attribute without any extensions for both ES and non-ES.
>
> Signed-off-by: Bas Nieuwenhuizen 
> ---
>  src/waffle/egl/wegl_config.c  | 9 ++---
>  src/waffle/egl/wegl_context.c | 9 +++--
>  src/waffle/egl/wegl_display.c | 3 +--
>  src/waffle/egl/wegl_display.h | 2 ++
>  4 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/src/waffle/egl/wegl_config.c b/src/waffle/egl/wegl_config.c
> index 1c3f416..08e06fb 100644
> --- a/src/waffle/egl/wegl_config.c
> +++ b/src/waffle/egl/wegl_config.c
> @@ -56,17 +56,20 @@ check_context_attrs(struct wegl_display *dpy,
>  }
>
>  if (attrs->context_robust && !dpy->EXT_create_context_robustness &&
> +dpy->major_version == 1 && dpy->minor_version < 5 &&
>  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");
> + "EGL_EXT_create_context_robustness or EGL 1.5 is "
> + "required in order to request a robust access context "
> + "for OpenGL ES");
>  return false;
>  }
>
>  if (attrs->context_robust && !dpy->KHR_create_context &&
> +dpy->major_version == 1 && dpy->minor_version < 5 &&
>  attrs->context_api == WAFFLE_CONTEXT_OPENGL) {
>  wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
> - "EGL_KHR_create_context is required in order to "
> + "EGL_KHR_create_context or EGL 1.5 is required in order 
> to "
>   "request a robust access context for OpenGL");
>  return false;
>  }
> diff --git a/src/waffle/egl/wegl_context.c b/src/waffle/egl/wegl_context.c
> index 67cbc04..4b208fa 100644
> --- a/src/waffle/egl/wegl_context.c
> +++ b/src/waffle/egl/wegl_context.c
> @@ -96,8 +96,13 @@ create_real_context(struct wegl_config *config,
>  }
>
>  if (attrs->context_robust) {
> -assert(dpy->KHR_create_context);
> -context_flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
> +if (dpy->major_version > 1 || dpy->minor_version >= 5) {
> +attrib_list[i++] = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT;
We want EGL_CONTEXT_OPENGL_ROBUST_ACCESS (note missing _EXT) here.
For whatever reason the two differ 0x31B2 vs 0x30BF (according to the
includes in mesa).

> +attrib_list[i++] = EGL_TRUE;
> +} else {
> +assert(dpy->KHR_create_context);
> +context_flags |= 
> EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
> +}
>  }
>
>  if (wcore_config_attrs_version_ge(attrs, 32))  {
> diff --git a/src/waffle/egl/wegl_display.c b/src/waffle/egl/wegl_display.c
> index 16af142..a5e3429 100644
> --- a/src/waffle/egl/wegl_display.c
> +++ b/src/waffle/egl/wegl_display.c
> @@ -64,7 +64,6 @@ wegl_display_init(struct wegl_display *dpy,
>  {
>  struct wegl_platform *plat = wegl_platform(wc_plat);
>  bool ok;
> -EGLint major, minor;
>
>  ok = wcore_display_init(&dpy->wcore, wc_plat);
>  if (!ok)
> @@ -76,7 +75,7 @@ wegl_display_init(struct wegl_display *dpy,
>  goto fail;
>  }
>
> -ok = plat->eglInitialize(dpy->egl, &major, &minor);
> +ok = plat->eglInitialize(dpy->egl, &dpy->major_version, 
> &dpy->minor_version);
>  if (!ok) {
>  wegl_emit_error(plat, "eglInitialize");
>  goto fail;
> diff --git a/src/waffle/egl/wegl_display.h b/src/waffle/egl/wegl_display.h
> index b82a2ec..0d03ec8 100644
> --- a/src/waffle/egl/wegl_display.h
> +++ b/src/waffle/egl/wegl_display.h
> @@ -39,6 +39,8 @@ struct wegl_display {
>  EGLDisplay egl;
>  bool EXT_create_context_robustness;
>  bool KHR_create_context;
> +EGLint major_version;
> +EGLint minor_version;

While working on a similar version specific EGL bits, I've added a
single boolean as it seemed easer/shorter to check (yes I'm that
lazy).
Just throwing the idea out there, unless others insist you don't have
to do any of that.

With the s/_EXT//g issue above
Reviewed-by: Emil Velikov 

-Emil
___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle