summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_transfer.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-03-08 08:20:31 +0100
committerMarek Olšák <maraeo@gmail.com>2011-03-08 08:23:29 +0100
commit5650a719f0c69c00954e47bd7a7b3e9433cb551d (patch)
tree3aff20999b60e66b84d9949c50dffeb963104989 /src/gallium/drivers/r300/r300_transfer.c
parent6051f26b78917d430e7f4eb9b92b20de17aea4cc (diff)
r300g: decide whether a flush should be asynchronous when calling it
Thread offloading is not sometimes desirable, e.g. when mapping a buffer.
Diffstat (limited to 'src/gallium/drivers/r300/r300_transfer.c')
-rw-r--r--src/gallium/drivers/r300/r300_transfer.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c
index 0b73162abd..928c86be0c 100644
--- a/src/gallium/drivers/r300/r300_transfer.c
+++ b/src/gallium/drivers/r300/r300_transfer.c
@@ -72,6 +72,7 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
transfer->box.x, transfer->box.y, transfer->box.z,
&r300transfer->linear_texture->b.b.b, 0, &src_box);
+ /* XXX remove this. */
ctx->flush(ctx, 0, NULL);
}
@@ -152,7 +153,7 @@ r300_texture_get_transfer(struct pipe_context *ctx,
if (!trans->linear_texture) {
/* Oh crap, the thing can't create the texture.
* Let's flush and try again. */
- ctx->flush(ctx, 0, NULL);
+ r300_flush(ctx, 0, NULL);
trans->linear_texture = r300_resource(
ctx->screen->resource_create(ctx->screen,
@@ -176,13 +177,7 @@ r300_texture_get_transfer(struct pipe_context *ctx,
assert(!trans->linear_texture->tex.microtile &&
!trans->linear_texture->tex.macrotile[0]);
- /* Set the stride.
- *
- * Even though we are using an internal texture for this,
- * the transfer level, box and usage parameters still reflect
- * the arguments received to get_transfer. We just do the
- * right thing internally.
- */
+ /* Set the stride. */
trans->transfer.stride =
trans->linear_texture->tex.stride_in_bytes[0];
@@ -192,7 +187,7 @@ r300_texture_get_transfer(struct pipe_context *ctx,
r300_copy_from_tiled_texture(ctx, trans);
/* Always referenced in the blit. */
- ctx->flush(ctx, 0, NULL);
+ r300_flush(ctx, 0, NULL);
}
return &trans->transfer;
}
@@ -202,8 +197,9 @@ r300_texture_get_transfer(struct pipe_context *ctx,
trans->transfer.stride = tex->tex.stride_in_bytes[level];
trans->offset = r300_texture_get_offset(tex, level, box->z);
- if (referenced_cs)
- ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
+ if (referenced_cs &&
+ !(usage & PIPE_TRANSFER_UNSYNCHRONIZED))
+ r300_flush(ctx, 0, NULL);
return &trans->transfer;
}
return NULL;