Mesa (master): radeon: use staging for mapping linear textures

Christian König deathsimple at kemper.freedesktop.org
Sun Oct 13 18:10:45 UTC 2013


Module: Mesa
Branch: master
Commit: f250fd59c4e39e55816eb0bacce30c14240b58c4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f250fd59c4e39e55816eb0bacce30c14240b58c4

Author: Grigori Goronzy <greg at chown.ath.cx>
Date:   Sun Oct 13 18:08:44 2013 +0200

radeon: use staging for mapping linear textures

Textures that likely reside in VRAM, are mapped for reading and
don't require direct mapping should be staged into GTT, to avoid bad
performance. This fixes readback performance of VDPAU surfaces.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/radeon/r600_texture.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index ebb70906..9ba1e36 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -852,6 +852,12 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx,
 	if (rtex->surface.level[level].mode >= RADEON_SURF_MODE_1D)
 		use_staging_texture = TRUE;
 
+	/* Untiled buffers in VRAM, which is slow for CPU reads */
+	if ((usage & PIPE_TRANSFER_READ) && !(usage & PIPE_TRANSFER_MAP_DIRECTLY) &&
+	    (rtex->resource.domains == RADEON_DOMAIN_VRAM)) {
+		use_staging_texture = TRUE;
+	}
+
 	/* Use a staging texture for uploads if the underlying BO is busy. */
 	if (!(usage & PIPE_TRANSFER_READ) &&
 	    (r600_rings_is_buffer_referenced(rctx, rtex->resource.cs_buf, RADEON_USAGE_READWRITE) ||




More information about the mesa-commit mailing list