From dbbbe73d050920cc149bf99be912221a30920750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 6 Jun 2022 05:11:56 -0400 Subject: [PATCH] radeonsi: fix NGG streamout hang by allocating GDS in the right place Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_state_shaders.cpp | 4 ++++ src/gallium/drivers/radeonsi/si_state_streamout.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index e83b6e7e2fd..8e8e364098f 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -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, diff --git a/src/gallium/drivers/radeonsi/si_state_streamout.c b/src/gallium/drivers/radeonsi/si_state_streamout.c index e10174f3259..52cb4eccc1f 100644 --- a/src/gallium/drivers/radeonsi/si_state_streamout.c +++ b/src/gallium/drivers/radeonsi/si_state_streamout.c @@ -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; }