summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/pipebuffer
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-03-21 18:23:22 +1000
committerDave Airlie <airlied@redhat.com>2010-03-21 19:38:41 +1000
commit0dab3189e1d100a9a2487f7aff45589b423c386c (patch)
tree388435e2c6343fcaacc2ef544472dc1b29e562ed /src/gallium/auxiliary/pipebuffer
parent12deb9e6ca76d222badf71c8643e84640673e86d (diff)
gallium: cached bufmgr add map busy check
Suggested by Jose on the list, probably not perfect but will let me get past this for now, testing with a fenced bufmgr on top of this, was slower, Also this doesn't let you do the busy early exit optimisation either from what I can see. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer')
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 86f9266c95..0f2ae05dae 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -227,6 +227,8 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
pb_size size,
const struct pb_desc *desc)
{
+ void *map;
+
if(buf->base.base.size < size)
return FALSE;
@@ -239,6 +241,13 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
if(!pb_check_usage(desc->usage, buf->base.base.usage))
return FALSE;
+
+ map = pb_map(buf->buffer, PIPE_BUFFER_USAGE_DONTBLOCK);
+ if (!map) {
+ return FALSE;
+ }
+
+ pb_unmap(buf->buffer);
return TRUE;
}