From 0dab3189e1d100a9a2487f7aff45589b423c386c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 21 Mar 2010 18:23:22 +1000 Subject: 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 --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/gallium') 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; } -- cgit v1.2.3