<div class="gmail_quote">On Mon, Feb 14, 2011 at 8:12 AM, Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
This is cleaner and implementing the hook is optional.<br>
---<br>
src/gallium/auxiliary/pipebuffer/pb_bufmgr.h | 4 ++++<br>
src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 11 +++--------<br>
2 files changed, 7 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h<br>
index 2ef0216..960068c 100644<br>
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h<br>
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h<br>
@@ -82,6 +82,10 @@ struct pb_manager<br>
*/<br>
void<br>
(*flush)( struct pb_manager *mgr );<br>
+<br>
+ boolean<br>
+ (*is_buffer_busy)( struct pb_manager *mgr,<br>
+ struct pb_buffer *buf );<br>
};<br>
<br>
<br>
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c<br>
index a6eb403..f0dee07 100644<br>
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c<br>
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c<br>
@@ -227,8 +227,6 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,<br>
pb_size size,<br>
const struct pb_desc *desc)<br>
{<br>
- void *map;<br>
-<br>
if(buf->base.base.size < size)<br>
return 0;<br>
<br>
@@ -242,13 +240,10 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,<br>
if(!pb_check_usage(desc->usage, buf->base.base.usage))<br>
return 0;<br>
<br>
- map = pb_map(buf->buffer, PB_USAGE_DONTBLOCK, NULL);<br>
- if (!map) {<br>
- return -1;<br>
- }<br>
+ if (buf->mgr->base.is_buffer_busy)<br>
+ if (buf->mgr->base.is_buffer_busy(&buf->mgr->base, buf->buffer))<br>
+ return -1;<br></blockquote><div><br>Oops, this is wrong. I will locally replace any occurences of "buf->mgr->base(.)" with "buf->mgr->provider(->)", which is how it was meant to be, but the idea remains the same. Please review.<br>
<br>Marek<br></div></div>