From: Emma Anholt Date: Tue, 30 Aug 2022 22:30:27 +0000 (-0700) Subject: turnip: Skip emitting empty CP_COND_REG_EXEC. X-Git-Tag: upstream/23.3.3~3226 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=139cc91697088c3d5b1a4546ed2e4ba5c916baef;p=platform%2Fupstream%2Fmesa.git turnip: Skip emitting empty CP_COND_REG_EXEC. If we ended up emitting no code to be conditionally run, then drop the whole conditional exec packet. Part-of: --- diff --git a/src/freedreno/vulkan/tu_cs.h b/src/freedreno/vulkan/tu_cs.h index 2a4a298..3d6a503 100644 --- a/src/freedreno/vulkan/tu_cs.h +++ b/src/freedreno/vulkan/tu_cs.h @@ -471,8 +471,13 @@ tu_cond_exec_end(struct tu_cs *cs) cs->cond_flags[cs->cond_stack_depth] = 0; /* Subtract one here to account for the DWORD field itself. */ - *cs->cond_dwords[cs->cond_stack_depth] = - cs->cur - cs->cond_dwords[cs->cond_stack_depth] - 1; + uint32_t cond_len = cs->cur - cs->cond_dwords[cs->cond_stack_depth] - 1; + if (cond_len) { + *cs->cond_dwords[cs->cond_stack_depth] = cond_len; + } else { + /* rewind the CS to drop the empty cond reg packet. */ + cs->cur = cs->cur - 3; + } } /* Temporary struct for tracking a register state to be written, used by