summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-02-03 16:14:02 +0000
committerJosé Fonseca <jfonseca@vmware.com>2011-02-03 16:14:02 +0000
commit610c24b19d21f3d147fde4d96a3afaa107670f1e (patch)
tree8bd8e494080e495256b6cad0f0240d4c8c8819e6
parent0f3eeb45c73e77b791a047d7bd1ba0c18accb116 (diff)
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.
-rw-r--r--src/gallium/drivers/svga/svga_draw.c7
-rw-r--r--src/gallium/drivers/svga/svga_resource_buffer_upload.c7
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 051ac1c654..2c873a0f7a 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 3de5216a94..765d2f3408 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);
}