From bf1dfcc3e8120400c9a78d03dd914a786728b5f7 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Mon, 17 Dec 2018 09:56:00 +0100 Subject: etnaviv: Consolidate buffer references from framebuffers We were leaking surfaces because the references taken in etna_set_framebuffer_state weren't being released on context destroy. Instead of just directly releasing those references in etna_context_destroy, use the util_copy_framebuffer_state helper. Take the chance to remove the duplicated buffer references in compiled_framebuffer_state to avoid confusion. The leak can be reproduced with a client that continuously creates and destroys contexts. Signed-off-by: Tomeu Vizoso Reported-by: Sjoerd Simons Reviewed-by: Christian Gmeiner --- src/gallium/drivers/etnaviv/etnaviv_context.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/gallium/drivers/etnaviv/etnaviv_context.c') diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c index aa742566289..44b50925a4f 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -63,6 +63,8 @@ etna_context_destroy(struct pipe_context *pctx) if (ctx->dummy_rt) etna_bo_del(ctx->dummy_rt); + util_copy_framebuffer_state(&ctx->framebuffer_s, NULL); + if (ctx->primconvert) util_primconvert_destroy(ctx->primconvert); @@ -294,10 +296,10 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) if (DBG_ENABLED(ETNA_DBG_FLUSH_ALL)) pctx->flush(pctx, NULL, 0); - if (ctx->framebuffer.cbuf) - etna_resource(ctx->framebuffer.cbuf->texture)->seqno++; - if (ctx->framebuffer.zsbuf) - etna_resource(ctx->framebuffer.zsbuf->texture)->seqno++; + if (ctx->framebuffer_s.cbufs[0]) + etna_resource(ctx->framebuffer_s.cbufs[0]->texture)->seqno++; + if (ctx->framebuffer_s.zsbuf) + etna_resource(ctx->framebuffer_s.zsbuf->texture)->seqno++; if (info->index_size && indexbuf != info->index.resource) pipe_resource_reference(&indexbuf, NULL); } -- cgit v1.2.3