[Mesa-dev] [PATCH 12/14] gallium/radeon: add a heuristic for better (S)DMA performance

Marek Olšák maraeo at gmail.com
Fri May 6 19:06:34 UTC 2016


On Thu, May 5, 2016 at 1:43 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>  src/gallium/drivers/radeon/r600_pipe_common.c | 16 ++++++++++++++++
>  src/gallium/drivers/radeon/radeon_winsys.h    |  2 ++
>  src/gallium/winsys/amdgpu/drm/amdgpu_cs.c     |  8 ++++++++
>  src/gallium/winsys/radeon/drm/radeon_drm_cs.c |  8 ++++++++
>  4 files changed, 34 insertions(+)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index eac7812..c0579da 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -176,6 +176,22 @@ void r600_dma_emit_wait_idle(struct r600_common_context *rctx)
>         /* done at the end of DMA calls, so increment this. */
>         rctx->num_dma_calls++;
>
> +       /* IBs using too little memory are limited by the IB submission overhead.
> +        * IBs using too much memory are limited by the kernel/TTM overhead.
> +        * Too long IBs create CPU-GPU pipeline bubbles and add latency.
> +        *
> +        * This heuristic makes sure that DMA requests are executed
> +        * very soon or immediately after the call is made and lowers memory
> +        * usage. It improves texture upload performance by keeping the DMA
> +        * engine busy while uploads are being submitted.
> +        *
> +        * 512 KB of copied data (1 MB / 2) is enough to submit an IB.
> +        */
> +       if (rctx->ws->cs_query_memory_usage(rctx->dma.cs) > 1024 * 1024) {
> +               rctx->dma.flush(rctx, RADEON_FLUSH_ASYNC, NULL);

FYI, I'm changing this from 1MB to 64MB, which yields slightly better
performance.

Marek


More information about the mesa-dev mailing list