[Mesa-dev] [PATCH mesa] egl: add eglSwapBuffersWithDamageKHR
Emil Velikov
emil.l.velikov at gmail.com
Mon Oct 10 12:07:57 UTC 2016
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?
> 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>
> _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 ?
Thanks
Emil
More information about the mesa-dev
mailing list