[Mesa-dev] [PATCH] swr: dereference cbuf/zbuf/views on context destroy
Ilia Mirkin
imirkin at alum.mit.edu
Mon Apr 18 20:40:13 UTC 2016
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
It has been pointed out to me on several occasions that the state
tracker should be unbinding all these, and I seem to recall finding
that code. But for some reason I've had to do the same thing to avoid
leaks.
On Mon, Apr 18, 2016 at 4:29 PM, Tim Rowley <timothy.o.rowley at intel.com> wrote:
> Fixes resource memory leaks.
> ---
> src/gallium/drivers/swr/swr_context.cpp | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
> index 46c79a1..5d311dd 100644
> --- a/src/gallium/drivers/swr/swr_context.cpp
> +++ b/src/gallium/drivers/swr/swr_context.cpp
> @@ -300,6 +300,21 @@ swr_destroy(struct pipe_context *pipe)
>
> /* Idle core before deleting context */
> SwrWaitForIdle(ctx->swrContext);
> +
> + for (unsigned i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
> + pipe_surface_reference(&ctx->framebuffer.cbufs[i], NULL);
> + }
> +
> + pipe_surface_reference(&ctx->framebuffer.zsbuf, NULL);
> +
> + for (unsigned i = 0; i < Elements(ctx->sampler_views[0]); i++) {
> + pipe_sampler_view_reference(&ctx->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL);
> + }
> +
> + for (unsigned i = 0; i < Elements(ctx->sampler_views[0]); i++) {
> + pipe_sampler_view_reference(&ctx->sampler_views[PIPE_SHADER_VERTEX][i], NULL);
> + }
> +
> if (ctx->swrContext)
> SwrDestroyContext(ctx->swrContext);
>
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list