From dec60d33b2570cf2bdce72a00a1539ee93133f91 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 16 Nov 2007 17:36:35 +0000 Subject: Proper fence reference counting. --- src/mesa/pipe/i915simple/i915_batch.h | 2 +- src/mesa/pipe/i915simple/i915_context.c | 2 ++ src/mesa/pipe/i915simple/i915_winsys.h | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/mesa/pipe') diff --git a/src/mesa/pipe/i915simple/i915_batch.h b/src/mesa/pipe/i915simple/i915_batch.h index 99b03c37db1..603d193f626 100644 --- a/src/mesa/pipe/i915simple/i915_batch.h +++ b/src/mesa/pipe/i915simple/i915_batch.h @@ -46,7 +46,7 @@ #define FLUSH_BATCH() do { \ if (0) i915_dump_batchbuffer( i915 ); \ - i915->last_fence = i915->winsys->batch_flush( i915->winsys ); \ + i915->winsys->batch_flush( i915->winsys, &i915->last_fence ); \ i915->batch_start = NULL; \ i915->hardware_dirty = ~0; \ } while (0) diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index e43274dc667..f5d770ce0df 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -175,6 +175,8 @@ static void i915_destroy( struct pipe_context *pipe ) draw_destroy( i915->draw ); + i915->winsys->fence_reference( i915->winsys, &i915->last_fence, NULL ); + free( i915 ); } diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/mesa/pipe/i915simple/i915_winsys.h index 03457c1d61c..386ed745d37 100644 --- a/src/mesa/pipe/i915simple/i915_winsys.h +++ b/src/mesa/pipe/i915simple/i915_winsys.h @@ -98,7 +98,14 @@ struct i915_winsys { unsigned access_flags, unsigned delta ); - struct pipe_fence *(*batch_flush)( struct i915_winsys *sws ); + /** + * Flush the batch buffer. + * + * Fence argument must point to NULL or to a previous fence, and the caller + * must call fence_reference when done with the fence. + */ + void (*batch_flush)( struct i915_winsys *sws, + struct pipe_fence **fence ); /* Fence -- cgit v1.2.3