[Mesa-dev] [PATCH] r600: clean up the GS ring buffers when the context is destroyed

Roland Scheidegger sroland at vmware.com
Mon Nov 19 15:26:33 UTC 2018


Reviewed-by: Roland Scheidegger <sroland at vmware.com>

________________________________________
From: mesa-dev <mesa-dev-bounces at lists.freedesktop.org> on behalf of Gert Wollny <gert.wollny at collabora.com>
Sent: Friday, November 16, 2018 6:06:15 PM
To: mesa-dev at lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] r600: clean up the GS ring buffers when the context is destroyed

I forgot:

Fixes: 1371d65a7fbd695d3516861fe733685569d890d0
   r600g: initial support for geometry shaders on evergreen (v2)

Am Freitag, den 16.11.2018, 12:48 +0100 schrieb Gert Wollny:
> From: Gert Wollny <gert.wollny at collabora.com>
>
> This fixes two memory leaks reported by ASAN:
>
> Direct leak of 248 byte(s) in 1 object(s) allocated from:
>    in malloc (/usr/lib64/gcc/x86_64-pc-linux-
> gnu/7.3.0/libasan.so+0xdb880)
>    in r600_alloc_buffer_struct
> ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:578
>    in r600_buffer_create
> ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:600
>    in r600_resource_create_common
> ../../samba/mesa/src/gallium/drivers/r600/r600_pipe_common.c:1265
>    in r600_resource_create
> ../../samba/mesa/src/gallium/drivers/r600/r600_pipe.c:725
>    in pipe_buffer_create
> ../../samba/mesa/src/gallium/auxiliary/util/u_inlines.h:291
>    in update_gs_block_state
> ../../samba/mesa/src/gallium/drivers/r600/r600_state_common.c:1482
>
> Direct leak of 248 byte(s) in 1 object(s) allocated from:
>    in malloc (/usr/lib64/gcc/x86_64-pc-linux-
> gnu/7.3.0/libasan.so+0xdb880)
>    in r600_alloc_buffer_struct
> ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:578
>    in r600_buffer_create
> ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:600
>    in r600_resource_create_common
> ../../samba/mesa/src/gallium/drivers/r600/r600_pipe_common.c:1265
>    in r600_resource_create
> ../../samba/mesa/src/gallium/drivers/r600/r600_pipe.c:722
>    in pipe_buffer_create
> ../../samba/mesa/src/gallium/auxiliary/util/u_inlines.h:291
>    in update_gs_block_state
> ../../samba/mesa/src/gallium/drivers/r600/r600_state_common.c:1489
>
> Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
> ---
>  src/gallium/drivers/r600/r600_pipe.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/gallium/drivers/r600/r600_pipe.c
> b/src/gallium/drivers/r600/r600_pipe.c
> index 9e8501ff33..adf6ebc95f 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -105,6 +105,12 @@ static void r600_destroy_context(struct
> pipe_context *context)
>       }
>       util_unreference_framebuffer_state(&rctx-
> >framebuffer.state);
>
> +        if (rctx->gs_rings.gsvs_ring.buffer)
> +           pipe_resource_reference(&rctx->gs_rings.gsvs_ring.buffer,
> NULL);
> +
> +        if (rctx->gs_rings.esgs_ring.buffer)
> +           pipe_resource_reference(&rctx->gs_rings.esgs_ring.buffer,
> NULL);
> +
>       for (sh = 0; sh < PIPE_SHADER_TYPES; ++sh)
>               for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; ++i)
>                       rctx->b.b.set_constant_buffer(context, sh,
> i, NULL);
_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fmesa-dev&data=02%7C01%7Csroland%40vmware.com%7Ce3131ecf338b44f2a84808d64be5e3bc%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636779848156025413&sdata=wNexMrKAnvcjOt9io9ZFRkrAJbziRMLzS2aTsixUO14%3D&reserved=0


More information about the mesa-dev mailing list