mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
Proper fence reference counting.
This commit is contained in:
parent
34a00276c7
commit
dec60d33b2
4 changed files with 26 additions and 17 deletions
|
|
@ -111,12 +111,19 @@ static void intel_i915_batch_reloc( struct i915_winsys *sws,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_fence *
|
static void
|
||||||
intel_i915_batch_flush( struct i915_winsys *sws )
|
intel_i915_batch_flush( struct i915_winsys *sws,
|
||||||
|
struct pipe_fence **fence )
|
||||||
{
|
{
|
||||||
struct intel_context *intel = intel_i915_winsys(sws)->intel;
|
struct intel_context *intel = intel_i915_winsys(sws)->intel;
|
||||||
|
struct pipe_fence *tmp_fence;
|
||||||
|
|
||||||
return pipe_fo(intel_batchbuffer_flush( intel->batch ));
|
tmp_fence = pipe_fo(intel_batchbuffer_flush( intel->batch ));
|
||||||
|
|
||||||
|
/* this also increases the fence reference count, which is not done inside
|
||||||
|
* intel_batchbuffer_flush call above
|
||||||
|
*/
|
||||||
|
sws->fence_reference(sws, fence, tmp_fence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -143,14 +150,10 @@ intel_i915_fence_is_signalled( struct i915_winsys *sws,
|
||||||
struct pipe_fence *fence )
|
struct pipe_fence *fence )
|
||||||
{
|
{
|
||||||
struct _DriFenceObject *dri_fence = dri_fo(fence);
|
struct _DriFenceObject *dri_fence = dri_fo(fence);
|
||||||
int ret = 1;
|
if (fence)
|
||||||
if (fence) {
|
return driFenceSignaled(dri_fence,
|
||||||
driFenceReference(dri_fence);
|
|
||||||
ret = driFenceSignaled(dri_fence,
|
|
||||||
DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW);
|
DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW);
|
||||||
driFenceUnReference(dri_fence);
|
return 1;
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,13 +162,10 @@ intel_i915_fence_wait( struct i915_winsys *sws,
|
||||||
struct pipe_fence *fence )
|
struct pipe_fence *fence )
|
||||||
{
|
{
|
||||||
struct _DriFenceObject *dri_fence = dri_fo(fence);
|
struct _DriFenceObject *dri_fence = dri_fo(fence);
|
||||||
if (fence) {
|
if (fence)
|
||||||
driFenceReference(dri_fence);
|
|
||||||
driFenceFinish(dri_fence,
|
driFenceFinish(dri_fence,
|
||||||
DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
|
DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
|
||||||
GL_FALSE);
|
GL_FALSE);
|
||||||
driFenceUnReference(dri_fence);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
#define FLUSH_BATCH() do { \
|
#define FLUSH_BATCH() do { \
|
||||||
if (0) i915_dump_batchbuffer( i915 ); \
|
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->batch_start = NULL; \
|
||||||
i915->hardware_dirty = ~0; \
|
i915->hardware_dirty = ~0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,8 @@ static void i915_destroy( struct pipe_context *pipe )
|
||||||
|
|
||||||
draw_destroy( i915->draw );
|
draw_destroy( i915->draw );
|
||||||
|
|
||||||
|
i915->winsys->fence_reference( i915->winsys, &i915->last_fence, NULL );
|
||||||
|
|
||||||
free( i915 );
|
free( i915 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,14 @@ struct i915_winsys {
|
||||||
unsigned access_flags,
|
unsigned access_flags,
|
||||||
unsigned delta );
|
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
|
/* Fence
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue