tu: Fix hangs for DS with no output
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 22 Jul 2020 21:52:50 +0000 (23:52 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 24 Jul 2020 18:43:40 +0000 (18:43 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5738>

src/freedreno/vulkan/tu_pipeline.c

index 541d834bb9c514fbd28b3060ae2ea9e8dac0fbb5..679e76fffa4b9ed52ff26167cb14192bc801a18c 100644 (file)
@@ -847,6 +847,14 @@ tu6_emit_vpc(struct tu_cs *cs,
 
    tu6_setup_streamout(cs, last_shader, &linkage);
 
+   /* The GPU hangs on some models when there are no outputs (xs_pack::CNT),
+    * at least when a DS is the last stage, so add a dummy output to keep it
+    * happy if there aren't any. We do this late in order to avoid emitting
+    * any unused code and make sure that optimizations don't remove it.
+    */
+   if (linkage.cnt == 0)
+      ir3_link_add(&linkage, 0, 0x1, linkage.max_loc);
+
    /* map outputs of the last shader to VPC */
    assert(linkage.cnt <= 32);
    const uint32_t sp_out_count = DIV_ROUND_UP(linkage.cnt, 2);