[Mesa-dev] [PATCH] egl_dri2: fix aux buffer leak in drm platform

Mandeep Baines mandeep.baines at gmail.com
Tue Apr 10 15:30:02 PDT 2012


Attached is the test case I've been using.

On Tue, Apr 10, 2012 at 3:26 PM,  <mandeep.baines at gmail.com> wrote:
> From: Mandeep Singh Baines <msb at chromium.org>
>
> Keep a reference to any newly allocated aux buffers to avoid
> re-allocating for every st_framebuffer_validate() (i.e. leaking).
>
> Signed-off-by: Mandeep Singh Baines <msb at chromium.org>
> Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> Cc: Benjamin Franzke <benjaminfranzke at googlemail.com>
> Cc: Kristian Hogsberg <krh at bitplanet.net>
> Cc: David Reveman <reveman at chromium.org>
> Cc: Stephane Marchesin <marcheu at chromium.org>
> ---
>  src/egl/drivers/dri2/platform_drm.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
> index 18ecd17..54067ff 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -220,16 +220,15 @@ get_aux_bo(struct dri2_egl_surface *dri2_surf,
>  {
>    struct dri2_egl_display *dri2_dpy =
>       dri2_egl_display(dri2_surf->base.Resource.Display);
> -   __DRIbuffer *b;
> +   __DRIbuffer *b = dri2_surf->dri_buffers[attachment];
>
> -   b = NULL;
> -   if (dri2_surf->dri_buffers[attachment])
> -      b = dri2_surf->dri_buffers[attachment];
> -   if (b == NULL)
> +   if (b == NULL) {
>       b = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
>                                         attachment, format,
>                                         dri2_surf->base.Width,
>                                         dri2_surf->base.Height);
> +      dri2_surf->dri_buffers[attachment] = b;
> +   }
>    if (b == NULL)
>       return -1;
>
> --
> 1.7.3.4
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eglkms.c
Type: text/x-csrc
Size: 8468 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120410/62d74296/attachment.c>


More information about the mesa-dev mailing list