radeonsi: only do VGT_FLUSH for fast launch if previous draw was normal launch
authorMarek Olšák <marek.olsak@amd.com>
Fri, 16 Oct 2020 15:37:16 +0000 (11:37 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 18 Nov 2020 06:19:58 +0000 (06:19 +0000)
Fixes: 3da91b3327f - radeonsi/ngg: add VGT_FLUSH when enabling fast launch

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7542>

src/gallium/drivers/radeonsi/si_gfx_cs.c
src/gallium/drivers/radeonsi/si_state_draw.c

index 4747ffd..2ce9540 100644 (file)
@@ -425,6 +425,10 @@ void si_begin_new_gfx_cs(struct si_context *ctx, bool first_cs)
    ctx->flags |= SI_CONTEXT_INV_ICACHE | SI_CONTEXT_INV_SCACHE | SI_CONTEXT_INV_VCACHE |
                  SI_CONTEXT_INV_L2 | SI_CONTEXT_START_PIPELINE_STATS;
 
+   /* We don't know if the last draw call used GS fast launch, so assume it didn't. */
+   if (ctx->ngg_culling & SI_NGG_CULL_GS_FAST_LAUNCH_ALL)
+      ctx->flags |= SI_CONTEXT_VGT_FLUSH;
+
    radeon_add_to_buffer_list(ctx, ctx->gfx_cs, ctx->border_color_buffer,
                              RADEON_USAGE_READ, RADEON_PRIO_BORDER_COLORS);
    if (ctx->shadowed_regs) {
index cb21f21..9a1c275 100644 (file)
@@ -2104,7 +2104,8 @@ static void si_draw_vbo(struct pipe_context *ctx,
          /* Insert a VGT_FLUSH when enabling fast launch changes to prevent hangs.
           * See issues #2418, #2426, #2434
           */
-         if (ngg_culling & SI_NGG_CULL_GS_FAST_LAUNCH_ALL)
+         if (ngg_culling & SI_NGG_CULL_GS_FAST_LAUNCH_ALL &&
+             !(sctx->ngg_culling & SI_NGG_CULL_GS_FAST_LAUNCH_ALL))
             sctx->flags |= SI_CONTEXT_VGT_FLUSH;
          sctx->ngg_culling = ngg_culling;
          sctx->do_update_shaders = true;