[Mesa-dev] [PATCH mesa] egl: add eglSwapBuffersWithDamageKHR

Eric Engestrom eric.engestrom at imgtec.com
Mon Oct 10 14:37:39 UTC 2016


On Mon, Oct 10, 2016 at 01:07:57PM +0100, Emil Velikov wrote:
> Hi Eric,
> 
> On 4 October 2016 at 10:30, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> > EGL_KHR_swap_buffers_with_damage is actually already supported, as it is
> > technically nothing but a rename of EGL_EXT_swap_buffers_with_damage.
> >
> > To that effect, both extension are advertised depending on the same
> > condition, and the new entrypoint simply redirects to the previous one.
> >
> Thanks for this. Out of curiosity - do you have/know of a user for the
> EXT extension which doesn't check for the KHR one?

It's actually the other way around: they use the new KHR entry point
without checking for the old EXT one, but yeah, we have do a customer
who does just that, which is why we need this patch, and I thought it
wouldn't hurt to have it upstream :)

> 
> > Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> > ---
> >  src/egl/main/eglapi.c | 14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> > index 1c62a80..c3d471b 100644
> > --- a/src/egl/main/eglapi.c
> > +++ b/src/egl/main/eglapi.c
> > @@ -399,7 +399,10 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
> >     _EGL_CHECK_EXTENSION(EXT_buffer_age);
> >     _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
> >     _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
> > -   _EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage);
> > +   if (dpy->Extensions.EXT_swap_buffers_with_damage) {
> > +      _eglAppendExtension(&exts, "EGL_EXT_swap_buffers_with_damage");
> > +      _eglAppendExtension(&exts, "EGL_KHR_swap_buffers_with_damage");
> > +   }
> >
> Looking at _eglAppendExtension implementation/usage makes me cringe:
>  - assert prior to corrupting memory
>  + _eglAppendExtension
>    - return value is unused
>    - strlen(ext) is known at compile time
>    - s[len] = '\0' is required only once not 30+ times.
> 
> </ideas for future cleanup>

I'll look into this when I have some time, which unfortunately is in
short supply at the moment.

> 
> >     _EGL_CHECK_EXTENSION(KHR_cl_event2);
> >     _EGL_CHECK_EXTENSION(KHR_create_context);
> > @@ -1060,6 +1063,14 @@ eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface,
> >     RETURN_EGL_EVAL(disp, ret);
> >  }
> >
> > +static EGLBoolean EGLAPIENTRY
> > +eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface surface,
> > +                            EGLint *rects, EGLint n_rects)
> > +{
> > +   return eglSwapBuffersWithDamageEXT(dpy, surface,
> > +                                      rects, n_rects);
> > +}
> > +
> Can you respin this on top of the EGL_KHR_debug extension support ?

I just rebased and re-generated the patch, and aside from line numbers
nothing changed, and it compiles fine.
Did you have something specific in mind? Is there something I need to
add/change wrt KHR_debug?

I do have one change to `_eglCreateExtensionsString()` though, so there
will be a v2, don't pull my patch in just yet :)

Cheers,
  Eric


More information about the mesa-dev mailing list