Mesa (master): gallium: cached bufmgr add map busy check

Dave Airlie airlied at kemper.freedesktop.org
Sun Mar 21 09:42:21 UTC 2010


Module: Mesa
Branch: master
Commit: 0dab3189e1d100a9a2487f7aff45589b423c386c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0dab3189e1d100a9a2487f7aff45589b423c386c

Author: Dave Airlie <airlied at redhat.com>
Date:   Sun Mar 21 18:23:22 2010 +1000

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 at redhat.com>

---

 src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |    9 +++++++++
 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 86f9266..0f2ae05 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;
 }




More information about the mesa-commit mailing list