summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-02-08 17:36:48 +0100
committerMarek Olšák <maraeo@gmail.com>2011-02-08 17:47:00 +0100
commit71df812146ae316d9d371be3436e90da79435be9 (patch)
tree4444c369b6e88a8a946313e013c08eee0db06c4f
parentf0b202ec73855bd9e1b29909c8ac90393043cb8b (diff)
r600g: add a faster implementation of transfer_inline_write
u_default_transfer_inline_write uses util_copy_rect, which is kinda slow.
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 2a427839fd..183e34720a 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -131,6 +131,30 @@ static void r600_transfer_destroy(struct pipe_context *ctx,
util_slab_free(&rctx->pool_transfers, transfer);
}
+static void r600_buffer_transfer_inline_write(struct pipe_context *pipe,
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ const void *data,
+ unsigned stride,
+ unsigned layer_stride)
+{
+ struct radeon *ws = (struct radeon*)pipe->winsys;
+ struct r600_resource_buffer *rbuffer = r600_buffer(resource);
+ uint8_t *map = NULL;
+
+ assert(rbuffer->b.user_ptr == NULL);
+
+ map = r600_bo_map(ws, rbuffer->r.bo,
+ PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | usage,
+ pipe);
+
+ memcpy(map + box->x, data, box->width);
+
+ if (rbuffer->r.bo)
+ r600_bo_unmap(ws, rbuffer->r.bo);
+}
static const struct u_resource_vtbl r600_buffer_vtbl =
{
@@ -142,7 +166,7 @@ static const struct u_resource_vtbl r600_buffer_vtbl =
r600_buffer_transfer_map, /* transfer_map */
r600_buffer_transfer_flush_region, /* transfer_flush_region */
r600_buffer_transfer_unmap, /* transfer_unmap */
- u_default_transfer_inline_write /* transfer_inline_write */
+ r600_buffer_transfer_inline_write /* transfer_inline_write */
};
struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,