diff options
Diffstat (limited to 'src/freedreno/vulkan/tu_cs.h')
-rw-r--r-- | src/freedreno/vulkan/tu_cs.h | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/freedreno/vulkan/tu_cs.h b/src/freedreno/vulkan/tu_cs.h index f5c331cdd30..29baca74faf 100644 --- a/src/freedreno/vulkan/tu_cs.h +++ b/src/freedreno/vulkan/tu_cs.h @@ -238,41 +238,34 @@ tu_cs_emit_call(struct tu_cs *cs, const struct tu_cs *target) /* Helpers for bracketing a large sequence of commands of unknown size inside * a CP_COND_REG_EXEC packet. */ - -struct tu_cond_exec_state { - uint32_t *dword_ptr; - uint32_t max_dwords; -}; - -static inline VkResult -tu_cond_exec_start(struct tu_device *dev, struct tu_cs *cs, - struct tu_cond_exec_state *state, - uint32_t condition, uint32_t max_dwords) +static inline void +tu_cond_exec_start(struct tu_cs *cs, uint32_t cond_flags) { - /* Reserve enough space so that both the condition packet and the actual - * condition will fit in the same IB. - */ - VkResult result = tu_cs_reserve_space(cs, max_dwords + 3); - if (result != VK_SUCCESS) - return result; + assert(cs->mode == TU_CS_MODE_GROW); + assert(!cs->cond_flags && cond_flags); - state->max_dwords = max_dwords; tu_cs_emit_pkt7(cs, CP_COND_REG_EXEC, 2); - tu_cs_emit(cs, condition); - state->dword_ptr = cs->cur; + tu_cs_emit(cs, cond_flags); + + cs->cond_flags = cond_flags; + cs->cond_dwords = cs->cur; + /* Emit dummy DWORD field here */ tu_cs_emit(cs, CP_COND_REG_EXEC_1_DWORDS(0)); - - return VK_SUCCESS; } +#define CP_COND_EXEC_0_RENDER_MODE_GMEM \ + (CP_COND_REG_EXEC_0_MODE(RENDER_MODE) | CP_COND_REG_EXEC_0_GMEM) +#define CP_COND_EXEC_0_RENDER_MODE_SYSMEM \ + (CP_COND_REG_EXEC_0_MODE(RENDER_MODE) | CP_COND_REG_EXEC_0_SYSMEM) static inline void -tu_cond_exec_end(struct tu_cs *cs, struct tu_cond_exec_state *state) +tu_cond_exec_end(struct tu_cs *cs) { + assert(cs->cond_flags); + + cs->cond_flags = 0; /* Subtract one here to account for the DWORD field itself. */ - uint32_t actual_dwords = cs->cur - state->dword_ptr - 1; - assert(actual_dwords <= state->max_dwords); - *state->dword_ptr = actual_dwords; + *cs->cond_dwords = cs->cur - cs->cond_dwords - 1; } #define fd_reg_pair tu_reg_value |