[Mesa-dev] [PATCH 09/18] gallium/radeon: use cs_check_space throughout

Marek Olšák maraeo at gmail.com
Wed May 11 22:14:35 UTC 2016


For patches 1-9:

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

Marek

On Tue, May 10, 2016 at 1:21 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
>  src/gallium/drivers/r300/r300_blit.c          | 2 +-
>  src/gallium/drivers/r300/r300_render.c        | 2 +-
>  src/gallium/drivers/r600/r600_hw_context.c    | 6 ++----
>  src/gallium/drivers/radeon/r600_pipe_common.c | 2 +-
>  src/gallium/drivers/radeonsi/si_hw_context.c  | 5 ++---
>  5 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
> index b8cc316..2ee9b54 100644
> --- a/src/gallium/drivers/r300/r300_blit.c
> +++ b/src/gallium/drivers/r300/r300_blit.c
> @@ -382,7 +382,7 @@ static void r300_clear(struct pipe_context* pipe,
>              r300_get_num_cs_end_dwords(r300);
>
>          /* Reserve CS space. */
> -        if (dwords > (r300->cs->max_dw - r300->cs->cdw)) {
> +        if (!r300->rws->cs_check_space(r300->cs, dwords)) {
>              r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
>          }
>
> diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
> index 43860f3..ad0f489 100644
> --- a/src/gallium/drivers/r300/r300_render.c
> +++ b/src/gallium/drivers/r300/r300_render.c
> @@ -215,7 +215,7 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
>      cs_dwords += r300_get_num_cs_end_dwords(r300);
>
>      /* Reserve requested CS space. */
> -    if (cs_dwords > (r300->cs->max_dw - r300->cs->cdw)) {
> +    if (!r300->rws->cs_check_space(r300->cs, cs_dwords)) {
>          r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
>          flushed = TRUE;
>      }
> diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
> index 0b36494..425cda4 100644
> --- a/src/gallium/drivers/r600/r600_hw_context.c
> +++ b/src/gallium/drivers/r600/r600_hw_context.c
> @@ -47,9 +47,7 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
>         ctx->b.gtt = 0;
>         ctx->b.vram = 0;
>
> -       /* The number of dwords we already used in the CS so far. */
> -       num_dw += ctx->b.gfx.cs->cdw;
> -
> +       /* Check available space in CS. */
>         if (count_draw_in) {
>                 uint64_t mask;
>
> @@ -82,7 +80,7 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
>         num_dw += 10;
>
>         /* Flush if there's not enough space. */
> -       if (num_dw > ctx->b.gfx.cs->max_dw) {
> +       if (!ctx->b.ws->cs_check_space(ctx->b.gfx.cs, num_dw)) {
>                 ctx->b.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
>         }
>  }
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index feddb5c..8b76be0 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -143,7 +143,7 @@ void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw)
>                 ctx->gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
>
>         /* Flush if there's not enough space. */
> -       if ((num_dw + ctx->dma.cs->cdw) > ctx->dma.cs->max_dw) {
> +       if (!ctx->ws->cs_check_space(ctx->dma.cs, num_dw)) {
>                 ctx->dma.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
>                 assert((num_dw + ctx->dma.cs->cdw) <= ctx->dma.cs->max_dw);
>         }
> diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
> index dcf206d..2dac824 100644
> --- a/src/gallium/drivers/radeonsi/si_hw_context.c
> +++ b/src/gallium/drivers/radeonsi/si_hw_context.c
> @@ -84,9 +84,8 @@ void si_need_cs_space(struct si_context *ctx)
>         /* If the CS is sufficiently large, don't count the space needed
>          * and just flush if there is not enough space left.
>          */
> -       if (unlikely(cs->cdw > cs->max_dw - 2048 ||
> -                     (ce_ib && ce_ib->max_dw - ce_ib->cdw <
> -                      si_ce_needed_cs_space())))
> +       if (!ctx->b.ws->cs_check_space(cs, 2048) ||
> +           (ce_ib && !ctx->b.ws->cs_check_space(ce_ib, si_ce_needed_cs_space())))
>                 ctx->b.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
>  }
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list