radeonsi: fix NGG streamout hang by allocating GDS in the right place
authorMarek Olšák <marek.olsak@amd.com>
Mon, 6 Jun 2022 09:11:56 +0000 (05:11 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sat, 11 Jun 2022 11:14:16 +0000 (11:14 +0000)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16885>

src/gallium/drivers/radeonsi/si_state_shaders.cpp
src/gallium/drivers/radeonsi/si_state_streamout.c

index e83b6e7..8e8e364 100644 (file)
@@ -3290,6 +3290,10 @@ static void si_update_streamout_state(struct si_context *sctx)
 
    sctx->streamout.enabled_stream_buffers_mask = shader_with_so->info.enabled_streamout_buffer_mask;
    sctx->streamout.stride_in_dw = shader_with_so->info.base.xfb_stride;
+
+   /* GDS must be allocated when any GDS instructions are used, otherwise it hangs. */
+   if (sctx->screen->use_ngg_streamout && shader_with_so->info.enabled_streamout_buffer_mask)
+      si_allocate_gds(sctx);
 }
 
 static void si_update_clip_regs(struct si_context *sctx, struct si_shader_selector *old_hw_vs,
index e10174f..52cb4ec 100644 (file)
@@ -130,9 +130,6 @@ static void si_set_streamout_targets(struct pipe_context *ctx, unsigned num_targ
     * start writing to the targets.
     */
    if (num_targets) {
-      if (sctx->screen->use_ngg_streamout)
-         si_allocate_gds(sctx);
-
       sctx->flags |= SI_CONTEXT_PS_PARTIAL_FLUSH | SI_CONTEXT_CS_PARTIAL_FLUSH |
                      SI_CONTEXT_PFP_SYNC_ME;
    }