summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-06 14:51:15 +0100
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-07 18:58:29 +0100
commit1ee500ac73fa657f02321c46cf5d9a4bfdea54de (patch)
treef111f502802a02b3fefc31c793de79c69137e361
parenteb422a724342b0870ae0c796d229f38cf6b0706f (diff)
pipebuffer: Add an extra assertion to ensure buffers do not jump between lists.
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index f599bee07e7..ce41418a0f9 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -142,12 +142,13 @@ _fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
static INLINE void
-_fenced_buffer_remove(struct fenced_buffer *fenced_buf)
+_fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
+ struct fenced_buffer *fenced_buf)
{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
struct pipe_winsys *winsys = fenced_list->winsys;
assert(fenced_buf->fence);
+ assert(fenced_buf->list == fenced_list);
winsys->fence_reference(winsys, &fenced_buf->fence, NULL);
fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE;
@@ -184,7 +185,8 @@ _fenced_buffer_finish(struct fenced_buffer *fenced_buf)
return PIPE_ERROR;
}
/* Remove from the fenced list */
- _fenced_buffer_remove(fenced_buf); /* TODO: remove consequents */
+ /* TODO: remove consequents */
+ _fenced_buffer_remove(fenced_list, fenced_buf);
}
fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE;
@@ -223,7 +225,7 @@ _fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
assert(winsys->fence_signalled(winsys, fenced_buf->fence, 0) == 0);
}
- _fenced_buffer_remove(fenced_buf);
+ _fenced_buffer_remove(fenced_list, fenced_buf);
curr = next;
next = curr->next;
@@ -248,7 +250,7 @@ fenced_buffer_destroy(struct pb_buffer *buf)
do {
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
assert(winsys->fence_signalled(winsys, fenced_buf->fence, 0) == 0);
- _fenced_buffer_remove(fenced_buf);
+ _fenced_buffer_remove(fenced_list, fenced_buf);
curr = prev;
prev = curr->prev;
} while (curr != &fenced_list->delayed);
@@ -395,7 +397,7 @@ buffer_fence(struct pb_buffer *buf,
_glthread_LOCK_MUTEX(fenced_list->mutex);
if (fenced_buf->fence)
- _fenced_buffer_remove(fenced_buf);
+ _fenced_buffer_remove(fenced_list, fenced_buf);
if (fence) {
winsys->fence_reference(winsys, &fenced_buf->fence, fence);
fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE;