[Mesa-dev] [PATCH 1/3] radeon: Move gfx/dma cs cleanup to r600_common_context_cleanup

Marek Olšák maraeo at gmail.com
Sat Jan 11 03:10:55 PST 2014


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Sat, Jan 11, 2014 at 1:45 AM, Aaron Watry <awatry at gmail.com> wrote:
> The radeonsi code was not cleaning up either of these items leading to
> leaked memory.
>
> v2: Move cleanup to r600_common_context_cleanup instead of duplicating
>     the logic for SI
>
> CC: "10.0" <mesa-stable at lists.freedesktop.org>
> ---
>  src/gallium/drivers/r600/r600_pipe.c          | 7 -------
>  src/gallium/drivers/radeon/r600_pipe_common.c | 7 +++++++
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 74e007b..e7d5862 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -185,13 +185,6 @@ static void r600_destroy_context(struct pipe_context *context)
>
>         r600_release_command_buffer(&rctx->start_cs_cmd);
>
> -       if (rctx->b.rings.gfx.cs) {
> -               rctx->b.ws->cs_destroy(rctx->b.rings.gfx.cs);
> -       }
> -       if (rctx->b.rings.dma.cs) {
> -               rctx->b.ws->cs_destroy(rctx->b.rings.dma.cs);
> -       }
> -
>         FREE(rctx->start_compute_cs_cmd.buf);
>
>         r600_common_context_cleanup(&rctx->b);
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 28921be..07bf383 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -250,6 +250,13 @@ bool r600_common_context_init(struct r600_common_context *rctx,
>
>  void r600_common_context_cleanup(struct r600_common_context *rctx)
>  {
> +       if (rctx->rings.gfx.cs) {
> +               rctx->ws->cs_destroy(rctx->rings.gfx.cs);
> +       }
> +       if (rctx->rings.dma.cs) {
> +               rctx->ws->cs_destroy(rctx->rings.dma.cs);
> +       }
> +
>         if (rctx->uploader) {
>                 u_upload_destroy(rctx->uploader);
>         }
> --
> 1.8.3.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list