r300/compiler: Implement the texture semaphore
[mesa.git] / src / gallium / drivers / r300 / r300_transfer.c
index 928c86be0c59cef545dd60db2e44602dd75da061..57d60a0e0feaa7328d3fb2f1f270803f71e9bf3d 100644 (file)
@@ -73,7 +73,7 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
                               &r300transfer->linear_texture->b.b.b, 0, &src_box);
 
     /* XXX remove this. */
-    ctx->flush(ctx, 0, NULL);
+    r300_flush(ctx, 0, NULL);
 }
 
 struct pipe_transfer*
@@ -97,7 +97,7 @@ r300_texture_get_transfer(struct pipe_context *ctx,
         referenced_hw = TRUE;
     } else {
         referenced_hw =
-            r300->rws->buffer_is_busy(tex->buf);
+            r300->rws->buffer_is_busy(tex->buf, RADEON_USAGE_READWRITE);
     }
 
     blittable = desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ||
@@ -130,8 +130,14 @@ r300_texture_get_transfer(struct pipe_context *ctx,
             base.array_size = 1;
             base.last_level = 0;
             base.nr_samples = 0;
-            base.usage = PIPE_USAGE_DYNAMIC;
+            base.usage = PIPE_USAGE_STAGING;
             base.bind = 0;
+            if (usage & PIPE_TRANSFER_READ) {
+                base.bind |= PIPE_BIND_SAMPLER_VIEW;
+            }
+            if (usage & PIPE_TRANSFER_WRITE) {
+                base.bind |= PIPE_BIND_RENDER_TARGET;
+            }
             base.flags = R300_RESOURCE_FLAG_TRANSFER;
 
             /* For texture reading, the temporary (detiled) texture is used as
@@ -226,7 +232,7 @@ void* r300_texture_transfer_map(struct pipe_context *ctx,
                                struct pipe_transfer *transfer)
 {
     struct r300_context *r300 = r300_context(ctx);
-    struct r300_winsys_screen *rws = (struct r300_winsys_screen *)ctx->winsys;
+    struct radeon_winsys *rws = (struct radeon_winsys *)ctx->winsys;
     struct r300_transfer *r300transfer = r300_transfer(transfer);
     struct r300_resource *tex = r300_resource(transfer->resource);
     char *map;
@@ -256,7 +262,7 @@ void* r300_texture_transfer_map(struct pipe_context *ctx,
 void r300_texture_transfer_unmap(struct pipe_context *ctx,
                                 struct pipe_transfer *transfer)
 {
-    struct r300_winsys_screen *rws = (struct r300_winsys_screen *)ctx->winsys;
+    struct radeon_winsys *rws = (struct radeon_winsys *)ctx->winsys;
     struct r300_transfer *r300transfer = r300_transfer(transfer);
     struct r300_resource *tex = r300_resource(transfer->resource);