[Mesa-dev] [PATCH] egl: Fix leak of X11 pixmaps backing pbuffers in DRI3.

Eric Engestrom eric.engestrom at intel.com
Thu Aug 9 14:53:00 UTC 2018


On Tuesday, 2018-08-07 12:32:04 -0700, Eric Anholt wrote:
> This is basically copied from the DRI2 destroy path.  Without this,
> Raspberry Pi would quickly run out of CMA during the EGL tests in the CTS
> due to all the pixmaps laying around.
> 
> Fixes: f35198badeb9 ("egl/x11: Implement dri3 support with loader's dri3 helper")

Good catch, you're right!
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>

> ---
>  src/egl/drivers/dri2/platform_x11_dri3.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c
> index c3c9c2dd45d6..e1967422f0a8 100644
> --- a/src/egl/drivers/dri2/platform_x11_dri3.c
> +++ b/src/egl/drivers/dri2/platform_x11_dri3.c
> @@ -107,12 +107,17 @@ static const struct loader_dri3_vtable egl_dri3_vtable = {
>  static EGLBoolean
>  dri3_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
>  {
> +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
>     struct dri3_egl_surface *dri3_surf = dri3_egl_surface(surf);
> +   xcb_drawable_t drawable = dri3_surf->loader_drawable.drawable;
>  
>     (void) drv;
>  
>     loader_dri3_drawable_fini(&dri3_surf->loader_drawable);
>  
> +   if (surf->Type == EGL_PBUFFER_BIT)
> +      xcb_free_pixmap (dri2_dpy->conn, drawable);
> +
>     dri2_fini_surface(surf);
>     free(surf);
>  
> -- 
> 2.18.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list