[Mesa-dev] [PATCH 4/4] radeonsi: add workarounds for CP DMA to stay on the fast path

Michel Dänzer michel at daenzer.net
Wed Nov 4 00:31:11 PST 2015


On 04.11.2015 08:46, Marek Olšák wrote:
> 
> @@ -209,11 +211,48 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
>  		r600_resource(dst)->TC_L2_dirty = true;
>  }
>  
> +/**
> + * Realign the CP DMA engine. This must be done after a copy with an unaligned
> + * size.
> + *
> + * \param size  Remaining size to the CP DMA alignment.
> + */
> +static void si_cp_dma_realign_engine(struct si_context *sctx, unsigned size)
> +{
> +	uint64_t va;
> +	unsigned dma_flags = 0;
> +	unsigned scratch_size = CP_DMA_ALIGNMENT * 2;
> +
> +	assert(size < CP_DMA_ALIGNMENT);
> +
> +	/* Use the scratch buffer as the dummy buffer. The 3D engine should be
> +	 * idle at this point.
> +	 */
> +	if (!sctx->scratch_buffer ||
> +	    sctx->scratch_buffer->b.b.width0 < scratch_size) {
> +		r600_resource_reference(&sctx->scratch_buffer, NULL);
> +		sctx->scratch_buffer =
> +			si_resource_create_custom(&sctx->screen->b.b,
> +						  PIPE_USAGE_DEFAULT,
> +						  scratch_size);
> +	}
> +
> +	si_cp_dma_prepare(sctx, &sctx->scratch_buffer->b.b,
> +			  &sctx->scratch_buffer->b.b, size, size, &dma_flags);
> +
> +	va = sctx->scratch_buffer->gpu_address;
> +	si_emit_cp_dma_copy_buffer(sctx, va, va + CP_DMA_ALIGNMENT, size,
> +				   dma_flags);
> +}

Should this update sctx->emit_scratch_reloc ?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list