Mesa (staging/18.1): egl: Fix leak of X11 pixmaps backing pbuffers in DRI3.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 10 15:40:38 UTC 2018


Module: Mesa
Branch: staging/18.1
Commit: de4a4f2b17fd5778e4e28e3128e5c230bd6dd95f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=de4a4f2b17fd5778e4e28e3128e5c230bd6dd95f

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Aug  7 11:37:28 2018 -0700

egl: Fix leak of X11 pixmaps backing pbuffers in DRI3.

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")
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
(cherry picked from commit b618d7ea59a4d7da9823e02ac5608a67fd99b332)

---

 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 a41e40156d..54305c295a 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -124,12 +124,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);
 




More information about the mesa-commit mailing list