r300: reduce number of iterations for vertex shader loops
authorPavel Ondračka <pavel.ondracka@gmail.com>
Sun, 22 Jan 2023 15:45:00 +0000 (16:45 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 11 Sep 2023 19:30:52 +0000 (19:30 +0000)
Using the default value leads to occasional hangs on RV516 for unknown
reasons. Set it to 128 insted of 255.

dEQP and piglit are still happy and I don't expect any real app to hit
this, but lets see. As a side effect this boosts fps in the apps that
have non-unrollable vertex shaders (as the shaders now effectivelly run
almost two times faster) and ~5% dEQP runtime decrease.

Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7934
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20873>

src/gallium/drivers/r300/compiler/r3xx_vertprog.c

index 4ee3b87..a02147a 100644 (file)
@@ -502,11 +502,15 @@ static void translate_vertex_program(struct radeon_compiler *c, void *user)
                                        "Too many flow control instructions.");
                                return;
                        }
+                       /* Maximum of R500_PVS_FC_LOOP_CNT_JMP_INST is 0xff, here
+                        * we reduce it to half to avoid occasional hangs on RV516
+                        * and downclocked RV530.
+                        */
                        if (compiler->Base.is_r500) {
                                compiler->code->fc_op_addrs.r500
                                        [compiler->code->num_fc_ops].lw =
                                        R500_PVS_FC_ACT_ADRS(act_addr)
-                                       | R500_PVS_FC_LOOP_CNT_JMP_INST(0x00ff)
+                                       | R500_PVS_FC_LOOP_CNT_JMP_INST(0x0080)
                                        ;
                                compiler->code->fc_op_addrs.r500
                                        [compiler->code->num_fc_ops].uw =