radv: set WD_SWITCH_ON_EOP=1 when drawing primitives from a stream output buffer
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 2 May 2019 12:56:46 +0000 (14:56 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 2 May 2019 13:55:46 +0000 (15:55 +0200)
According to RadeonSI, this seems to be required by the hardware
to avoid GPU hangs. I think I just forgot to set that bit when I
implemented VK_EXT_transform_feedback.

This fixes a GPU hang with Space Engineers and DXVK.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110291
Fixes: b4eb029062a ("radv: implement VK_EXT_transform_feedback")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/si_cmd_buffer.c

index 963118215fa8912213f3b3a91ddc22a7d5f0bebc..b04c998fac2ed33030203ec59355b1ac1ec49d2d 100644 (file)
@@ -2202,6 +2202,7 @@ radv_emit_draw_registers(struct radv_cmd_buffer *cmd_buffer,
        ia_multi_vgt_param =
                si_get_ia_multi_vgt_param(cmd_buffer, draw_info->instance_count > 1,
                                          draw_info->indirect,
+                                         !!draw_info->strmout_buffer,
                                          draw_info->indirect ? 0 : draw_info->count);
 
        if (state->last_ia_multi_vgt_param != ia_multi_vgt_param) {
index 352072f8ff3f176f4df93889c76083066fcb127e..df85d0cf889753c253633f74aa062cd97821d2a4 100644 (file)
@@ -1160,6 +1160,7 @@ void si_write_scissors(struct radeon_cmdbuf *cs, int first,
                       const VkViewport *viewports, bool can_use_guardband);
 uint32_t si_get_ia_multi_vgt_param(struct radv_cmd_buffer *cmd_buffer,
                                   bool instanced_draw, bool indirect_draw,
+                                  bool count_from_stream_output,
                                   uint32_t draw_vertex_count);
 void si_cs_emit_write_event_eop(struct radeon_cmdbuf *cs,
                                enum chip_class chip_class,
index e75c6d127d66968ac4d23a3c7cf1fa88c4188b7e..e73c13762e5fadc542cb6cf209bc6668292b57ab 100644 (file)
@@ -561,6 +561,7 @@ radv_prims_for_vertices(struct radv_prim_vertex_count *info, unsigned num)
 uint32_t
 si_get_ia_multi_vgt_param(struct radv_cmd_buffer *cmd_buffer,
                          bool instanced_draw, bool indirect_draw,
+                         bool count_from_stream_output,
                          uint32_t draw_vertex_count)
 {
        enum chip_class chip_class = cmd_buffer->device->physical_device->rad_info.chip_class;
@@ -622,6 +623,12 @@ si_get_ia_multi_vgt_param(struct radv_cmd_buffer *cmd_buffer,
                    (instanced_draw || indirect_draw))
                        partial_vs_wave = true;
 
+               /* Hardware requirement when drawing primitives from a stream
+                * output buffer.
+                */
+               if (count_from_stream_output)
+                       wd_switch_on_eop = true;
+
                /* If the WD switch is false, the IA switch must be false too. */
                assert(wd_switch_on_eop || !ia_switch_on_eop);
        }