summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-01-03 19:46:59 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2008-01-04 01:20:41 +0000
commitb1e67c5d840a2c07c4ccf73bf1d3200b8531efa3 (patch)
tree14c6412e6ea163b3fc45347b55ceed4e2d3e850e /src/mesa/pipe
parentf54012650eebd940a6a7006ebcc0b9160c0368cf (diff)
965: fix various refcount issues
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/xlib/xm_winsys_aub.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/pipe/xlib/xm_winsys_aub.c b/src/mesa/pipe/xlib/xm_winsys_aub.c
index b207638390..2be8f8793d 100644
--- a/src/mesa/pipe/xlib/xm_winsys_aub.c
+++ b/src/mesa/pipe/xlib/xm_winsys_aub.c
@@ -99,6 +99,8 @@ static void *aub_buffer_map(struct pipe_winsys *winsys,
{
struct aub_buffer *sbo = aub_bo(buf);
+ assert(sbo->data);
+
if (flags & PIPE_BUFFER_FLAG_WRITE)
sbo->dump_on_unmap = 1;
@@ -116,6 +118,9 @@ static void aub_buffer_unmap(struct pipe_winsys *winsys,
if (sbo->map_count == 0 &&
sbo->dump_on_unmap) {
+
+ sbo->dump_on_unmap = 0;
+
brw_aub_gtt_data( iws->aubfile,
sbo->offset,
sbo->data,
@@ -132,6 +137,7 @@ aub_buffer_reference(struct pipe_winsys *winsys,
struct pipe_buffer_handle *buf)
{
if (*ptr) {
+ assert(aub_bo(*ptr)->refcount != 0);
if (--(aub_bo(*ptr)->refcount) == 0)
free(*ptr);
*ptr = NULL;
@@ -273,7 +279,9 @@ aub_buffer_create(struct pipe_winsys *winsys,
unsigned flags,
unsigned hint)
{
- return pipe_bo(CALLOC_STRUCT(aub_buffer));
+ struct aub_buffer *sbo = CALLOC_STRUCT(aub_buffer);
+ sbo->refcount = 1;
+ return pipe_bo(sbo);
}
@@ -282,6 +290,8 @@ aub_user_buffer_create(struct pipe_winsys *winsys, void *ptr, unsigned bytes)
{
struct aub_buffer *sbo = CALLOC_STRUCT(aub_buffer);
+ sbo->refcount = 1;
+
/* Lets hope this is meant for upload, not as a result!
*/
aub_buffer_data( winsys,