summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/xlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/xlib')
-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,