[Mesa-dev] [PATCH 6/6] gallium/radeon: use staging for texture read mappings from GTT WC

Nicolai Hähnle nhaehnle at gmail.com
Fri Feb 10 09:34:26 UTC 2017


The series is

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 09.02.2017 12:21, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>  src/gallium/drivers/radeon/r600_texture.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
> index 55c8e6f..5d84eb4 100644
> --- a/src/gallium/drivers/radeon/r600_texture.c
> +++ b/src/gallium/drivers/radeon/r600_texture.c
> @@ -1449,31 +1449,32 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx,
>  				r600_can_invalidate_texture(rctx->screen, rtex,
>  							    usage, box);
>
>  			r600_degrade_tile_mode_to_linear(rctx, rtex,
>  							 can_invalidate);
>  		}
>
>  		/* Tiled textures need to be converted into a linear texture for CPU
>  		 * access. The staging texture is always linear and is placed in GART.
>  		 *
> -		 * Reading from VRAM is slow, always use the staging texture in
> -		 * this case.
> +		 * Reading from VRAM or GTT WC is slow, always use the staging
> +		 * texture in this case.
>  		 *
>  		 * Use the staging texture for uploads if the underlying BO
>  		 * is busy.
>  		 */
>  		if (!rtex->surface.is_linear)
>  			use_staging_texture = true;
>  		else if (usage & PIPE_TRANSFER_READ)
> -			use_staging_texture = (rtex->resource.domains &
> -					       RADEON_DOMAIN_VRAM) != 0;
> +			use_staging_texture =
> +				rtex->resource.domains & RADEON_DOMAIN_VRAM ||
> +				rtex->resource.flags & RADEON_FLAG_GTT_WC;
>  		/* Write & linear only: */
>  		else if (r600_rings_is_buffer_referenced(rctx, rtex->resource.buf,
>  							 RADEON_USAGE_READWRITE) ||
>  			 !rctx->ws->buffer_wait(rtex->resource.buf, 0,
>  						RADEON_USAGE_READWRITE)) {
>  			/* It's busy. */
>  			if (r600_can_invalidate_texture(rctx->screen, rtex,
>  							usage, box))
>  				r600_texture_invalidate_storage(rctx, rtex);
>  			else
>



More information about the mesa-dev mailing list