[Mesa-dev] [PATCH 1/4] r600g/compute: Don't leak cbufs in compute state

Marek Olšák maraeo at gmail.com
Fri Nov 14 02:37:29 PST 2014


surface_destroy should never be called directly, because surfaces have
a reference counter. For unreferencing resources, use
pipe_surface_reference(&pointer, NULL). It will call surface_destroy
if needed.

Marek

On Fri, Nov 14, 2014 at 12:43 AM, Aaron Watry <awatry at gmail.com> wrote:
> Walk the array of cbufs backwards and free all of them.
>
> v3: Rebase on top of changes since Aug 2014
>
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> ---
>  src/gallium/drivers/r600/evergreen_compute.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
> index 90fdd79..4334743 100644
> --- a/src/gallium/drivers/r600/evergreen_compute.c
> +++ b/src/gallium/drivers/r600/evergreen_compute.c
> @@ -252,6 +252,15 @@ void evergreen_delete_compute_state(struct pipe_context *ctx, void* state)
>         if (!shader)
>                 return;
>
> +       if (shader->ctx){
> +               struct pipe_framebuffer_state *fb_state = &shader->ctx->framebuffer.state;
> +               for (int i = fb_state->nr_cbufs - 1; fb_state->nr_cbufs > 0 ; i--){
> +                       shader->ctx->b.b.surface_destroy(ctx, fb_state->cbufs[i]);
> +                       fb_state->cbufs[i] = NULL;
> +                       fb_state->nr_cbufs--;
> +               }
> +       }
> +
>         FREE(shader);
>  }
>
> --
> 2.1.0
>
> _______________________________________________
> 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