r300g: mapping buffers for read should be unsynchronized
authorMarek Olšák <maraeo@gmail.com>
Sat, 24 Dec 2011 10:43:10 +0000 (11:43 +0100)
committerMarek Olšák <maraeo@gmail.com>
Sat, 24 Dec 2011 20:28:43 +0000 (21:28 +0100)
The GPU never uses them for write.

src/gallium/drivers/r300/r300_screen_buffer.c

index a8392d2dc52d9d76d8b6b6f82cb81eb5d0c6169e..2e9e7d7f408e274fd25b5c5756a32bcf56f59f67 100644 (file)
@@ -107,13 +107,21 @@ r300_buffer_transfer_map( struct pipe_context *pipe,
     struct radeon_winsys *rws = r300screen->rws;
     struct r300_resource *rbuf = r300_resource(transfer->resource);
     uint8_t *map;
+    enum pipe_transfer_usage usage;
 
     if (rbuf->b.user_ptr)
         return (uint8_t *) rbuf->b.user_ptr + transfer->box.x;
     if (rbuf->constant_buffer)
         return (uint8_t *) rbuf->constant_buffer + transfer->box.x;
 
-    map = rws->buffer_map(rbuf->buf, r300->cs, transfer->usage);
+    /* Buffers are never used for write, therefore mapping for read can be
+     * unsynchronized. */
+    usage = transfer->usage;
+    if (!(usage & PIPE_TRANSFER_WRITE)) {
+       usage |= PIPE_TRANSFER_UNSYNCHRONIZED;
+    }
+
+    map = rws->buffer_map(rbuf->buf, r300->cs, usage);
 
     if (map == NULL)
         return NULL;