From: Keith Whitwell Date: Thu, 3 Jan 2008 19:46:59 +0000 (+0000) Subject: 965: fix various refcount issues X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b1e67c5d840a2c07c4ccf73bf1d3200b8531efa3;p=mesa.git 965: fix various refcount issues --- diff --git a/src/mesa/pipe/xlib/xm_winsys_aub.c b/src/mesa/pipe/xlib/xm_winsys_aub.c index b2076383906..2be8f8793de 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,