diff options
author | José Fonseca <[email protected]> | 2009-03-04 15:23:35 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-03-04 15:23:35 +0000 |
commit | 5b04939b16eb6e13858b070315dee1d0fc09d94f (patch) | |
tree | 0f8739ea6fa7219eaebbb9ff090f86713ef820e0 /src/gallium/auxiliary/pipebuffer/pb_buffer.h | |
parent | cfd5298f240612ef69ae321aebbc425710a8d731 (diff) | |
parent | f9ce417aaf14c00e72e92307b910de5dbed1bb6d (diff) |
Merge commit 'origin/master' into gallium-map-range
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer/pb_buffer.h')
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_buffer.h | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index e6b0b30ff44..f3a48d7ab0f 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -48,7 +48,6 @@ #include "util/u_debug.h" #include "pipe/p_error.h" #include "pipe/p_state.h" -#include "pipe/p_inlines.h" #ifdef __cplusplus @@ -159,7 +158,7 @@ pb_map(struct pb_buffer *buf, assert(buf); if(!buf) return NULL; - assert(buf->base.refcount > 0); + assert(buf->base.reference.count > 0); return buf->vtbl->map(buf, flags); } @@ -170,7 +169,7 @@ pb_unmap(struct pb_buffer *buf) assert(buf); if(!buf) return; - assert(buf->base.refcount > 0); + assert(buf->base.reference.count > 0); buf->vtbl->unmap(buf); } @@ -186,7 +185,7 @@ pb_get_base_buffer( struct pb_buffer *buf, offset = 0; return; } - assert(buf->base.refcount > 0); + assert(buf->base.reference.count > 0); assert(buf->vtbl->get_base_buffer); buf->vtbl->get_base_buffer(buf, base_buf, offset); assert(*base_buf); @@ -222,29 +221,18 @@ pb_destroy(struct pb_buffer *buf) assert(buf); if(!buf) return; - assert(buf->base.refcount == 0); + assert(buf->base.reference.count == 0); buf->vtbl->destroy(buf); } - -/* XXX: thread safety issues! - */ static INLINE void pb_reference(struct pb_buffer **dst, struct pb_buffer *src) { - if (src) { - assert(src->base.refcount); - src->base.refcount++; - } - - if (*dst) { - assert((*dst)->base.refcount); - if(--(*dst)->base.refcount == 0) - pb_destroy( *dst ); - } + struct pb_buffer *old = *dst; - *dst = src; + if (pipe_reference((struct pipe_reference**)dst, &src->base.reference)) + pb_destroy( old ); } |