From 610c24b19d21f3d147fde4d96a3afaa107670f1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 3 Feb 2011 16:14:02 +0000 Subject: [PATCH] svga: Fix resource leak; undo temporary workaround. Leak was introduced when fixing strict aliasing violation in this code: the reference counting was preserved, but the destructor call on zero reference count was not. --- src/gallium/drivers/svga/svga_draw.c | 7 ------- src/gallium/drivers/svga/svga_resource_buffer_upload.c | 7 ++++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index 051ac1c6546..2c873a0f7ac 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -224,13 +224,6 @@ svga_hwtnl_flush( struct svga_hwtnl *hwtnl ) hwtnl->cmd.prim_count = 0; } - /* - * FIXME: Somehow we are accumulating too many buffer uploads without - * flushing, so temporarily disable buffer upload coalescing to prevent OOM - * crashes (at expense of less performance). - */ - svga_context_flush_buffers(svga); - return PIPE_OK; } diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c b/src/gallium/drivers/svga/svga_resource_buffer_upload.c index 3de5216a949..765d2f34082 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c +++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c @@ -248,6 +248,7 @@ svga_buffer_upload_flush(struct svga_context *svga, { SVGA3dCopyBox *boxes; unsigned i; + struct pipe_resource *dummy; assert(sbuf->handle); assert(sbuf->hwbuf); @@ -289,9 +290,9 @@ svga_buffer_upload_flush(struct svga_context *svga, sbuf->dma.svga = NULL; sbuf->dma.boxes = NULL; - /* Decrement reference count */ - pipe_reference(&(sbuf->b.b.reference), NULL); - sbuf = NULL; + /* Decrement reference count (and potentially destroy) */ + dummy = &sbuf->b.b; + pipe_resource_reference(&dummy, NULL); } -- 2.30.2