[Mesa-dev] [PATCH] egl/surfaceless: Fix segfault in eglSwapBuffers

Anuj Phogat anuj.phogat at gmail.com
Tue Oct 18 17:44:43 UTC 2016


On Tue, Oct 18, 2016 at 9:43 AM, Chad Versace <chadversary at chromium.org> wrote:
> Since commit 63c5d5c6c46c8472ee7a8241a0f80f13d79cb8cd, the surfaceless
> platform has allowed creation of pbuffer surfaces. But the vtable entry
> for eglSwapBuffers has remained NULL.
>
> Discovered by running a little pbuffer test.
>
> Cc: Gurchetan Singh <gurchetansingh at chromium.org>
> ---
>  src/egl/drivers/dri2/platform_surfaceless.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
> index fcf7d69..a55c5f1 100644
> --- a/src/egl/drivers/dri2/platform_surfaceless.c
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> @@ -178,6 +178,17 @@ dri2_surfaceless_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
>  }
>
>  static EGLBoolean
> +surfaceless_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
> +{
> +   assert(!surf || surf->Type == EGL_PBUFFER_BIT);
> +
> +   /* From the EGL 1.5 spec:
> +    *    If surface is a [...] pbuffer surface, eglSwapBuffers has no effect.
> +    */
> +   return EGL_TRUE;
> +}
> +
> +static EGLBoolean
>  surfaceless_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
>  {
>     struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
> @@ -223,6 +234,7 @@ static struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl = {
>     .destroy_surface = surfaceless_destroy_surface,
>     .create_image = dri2_create_image_khr,
>     .swap_interval = dri2_fallback_swap_interval,
> +   .swap_buffers = surfaceless_swap_buffers,
>     .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
>     .swap_buffers_region = dri2_fallback_swap_buffers_region,
>     .post_sub_buffer = dri2_fallback_post_sub_buffer,
> --
> 2.10.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list