Mesa (master): gallium/radeon: Do not use u_upload_mgr for buffer downloads
Marek Olšák
mareko at kemper.freedesktop.org
Tue Aug 19 10:57:08 UTC 2014
Module: Mesa
Branch: master
Commit: 5ae9bdafd4bd50c0a72abb7cca5f8407efcb4cba
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ae9bdafd4bd50c0a72abb7cca5f8407efcb4cba
Author: Niels Ole Salscheider <niels_ole at salscheider-online.de>
Date: Thu Aug 14 20:22:26 2014 +0200
gallium/radeon: Do not use u_upload_mgr for buffer downloads
Instead create a staging texture with pipe_buffer_create and
PIPE_USAGE_STAGING.
u_upload_mgr sets the usage of its staging buffer to PIPE_USAGE_STREAM.
But since 150ac07b855b5c5f879bf6ce9ca421ccd1a6c938 CPU -> GPU streaming buffers
are created in VRAM. Therefore the staging texture (in VRAM) does not offer any
performance improvements for buffer downloads.
Signed-off-by: Niels Ole Salscheider <niels_ole at salscheider-online.de>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeon/r600_buffer_common.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index 22bc97e..ee05776 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -303,26 +303,22 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
!(usage & PIPE_TRANSFER_WRITE) &&
rbuffer->domains == RADEON_DOMAIN_VRAM &&
r600_can_dma_copy_buffer(rctx, 0, box->x, box->width)) {
- unsigned offset;
- struct r600_resource *staging = NULL;
-
- u_upload_alloc(rctx->uploader, 0,
- box->width + (box->x % R600_MAP_BUFFER_ALIGNMENT),
- &offset, (struct pipe_resource**)&staging, (void**)&data);
+ struct r600_resource *staging;
+ staging = (struct r600_resource*) pipe_buffer_create(
+ ctx->screen, PIPE_BIND_TRANSFER_READ, PIPE_USAGE_STAGING,
+ box->width + (box->x % R600_MAP_BUFFER_ALIGNMENT));
if (staging) {
- data += box->x % R600_MAP_BUFFER_ALIGNMENT;
-
/* Copy the VRAM buffer to the staging buffer. */
rctx->dma_copy(ctx, &staging->b.b, 0,
- offset + box->x % R600_MAP_BUFFER_ALIGNMENT,
+ box->x % R600_MAP_BUFFER_ALIGNMENT,
0, 0, resource, level, box);
- /* Just do the synchronization. The buffer is mapped already. */
- r600_buffer_map_sync_with_rings(rctx, staging, PIPE_TRANSFER_READ);
+ data = r600_buffer_map_sync_with_rings(rctx, staging, PIPE_TRANSFER_READ);
+ data += box->x % R600_MAP_BUFFER_ALIGNMENT;
return r600_buffer_get_transfer(ctx, resource, level, usage, box,
- ptransfer, data, staging, offset);
+ ptransfer, data, staging, 0);
}
}
More information about the mesa-commit
mailing list