pipebuffer: Wait for the GPU to finish reading too.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 2 Mar 2009 17:32:37 +0000 (17:32 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 2 Mar 2009 17:32:37 +0000 (17:32 +0000)
No real change, as we're not tracking relocations read/write access yet.

src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c

index 91b55c82387693593b5053a3d903cd110fe83169..ede2af4460fd87850c97a4478220cc76f5fbf97c 100644 (file)
@@ -296,9 +296,10 @@ fenced_buffer_map(struct pb_buffer *buf,
    assert(!(flags & ~PIPE_BUFFER_USAGE_CPU_READ_WRITE));
    flags &= PIPE_BUFFER_USAGE_CPU_READ_WRITE;
    
-   /* Check for GPU read/write access */
-   if(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) {
-      /* Wait for the GPU to finish writing */
+   /* Serialize writes */
+   if((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) ||
+      ((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ) && (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) {
+      /* Wait for the GPU to finish */
       _fenced_buffer_finish(fenced_buf);
    }