panvk/csf: factor out cs_match_iter_sb helper macro
This simplifies cases where we need to match on all of the possible iter_sb values, which occurs frequently. Signed-off-by: Olivia Lee <olivia.lee@collabora.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Acked-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38496>
This commit is contained in:
@@ -470,6 +470,15 @@ extern const struct vk_command_buffer_ops panvk_per_arch(cmd_buffer_ops);
|
||||
|
||||
void panvk_per_arch(cmd_flush_draws)(struct panvk_cmd_buffer *cmdbuf);
|
||||
|
||||
#if PAN_ARCH == 10
|
||||
/* Match against all possible iter_sb values. The constant iter_sb value for
|
||||
* the current match arm is in '__val'. */
|
||||
#define cs_match_iter_sb(__b, __val, __iter_sb, __scratch) \
|
||||
cs_match(__b, __iter_sb, __scratch) \
|
||||
for (unsigned __val = 0; __val < PANVK_SB_ITER_COUNT; __val++) \
|
||||
cs_case(__b, SB_ITER(__val))
|
||||
#endif
|
||||
|
||||
void panvk_per_arch(cs_next_iter_sb)(struct panvk_cmd_buffer *cmdbuf,
|
||||
enum panvk_subqueue_id subqueue,
|
||||
struct cs_index scratch_regs);
|
||||
|
||||
@@ -808,19 +808,9 @@ panvk_per_arch(cs_next_iter_sb)(struct panvk_cmd_buffer *cmdbuf,
|
||||
cs_move32_to(b, iter_sb, SB_ITER(0));
|
||||
}
|
||||
|
||||
cs_match(b, iter_sb, cmp_scratch) {
|
||||
#define CASE(x) \
|
||||
cs_case(b, SB_ITER(x)) { \
|
||||
cs_wait_slot(b, SB_ITER(x)); \
|
||||
cs_select_sb_entries_for_async_ops(b, SB_ITER(x)); \
|
||||
}
|
||||
|
||||
CASE(0)
|
||||
CASE(1)
|
||||
CASE(2)
|
||||
CASE(3)
|
||||
CASE(4)
|
||||
#undef CASE
|
||||
cs_match_iter_sb(b, x, iter_sb, cmp_scratch) {
|
||||
cs_wait_slot(b, SB_ITER(x));
|
||||
cs_select_sb_entries_for_async_ops(b, SB_ITER(x));
|
||||
}
|
||||
|
||||
cs_store32(b, iter_sb, cs_subqueue_ctx_reg(b),
|
||||
|
||||
@@ -330,20 +330,10 @@ cmd_dispatch(struct panvk_cmd_buffer *cmdbuf, struct panvk_dispatch_info *info)
|
||||
PANVK_SUBQUEUE_COMPUTE * sizeof(struct panvk_cs_sync64));
|
||||
cs_move64_to(b, add_val, 1);
|
||||
|
||||
cs_match(b, iter_sb, cmp_scratch) {
|
||||
#define CASE(x) \
|
||||
cs_case(b, SB_ITER(x)) { \
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_COMPUTE, true, \
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr, \
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC))); \
|
||||
}
|
||||
|
||||
CASE(0)
|
||||
CASE(1)
|
||||
CASE(2)
|
||||
CASE(3)
|
||||
CASE(4)
|
||||
#undef CASE
|
||||
cs_match_iter_sb(b, x, iter_sb, cmp_scratch) {
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_COMPUTE, true,
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr,
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2979,22 +2979,12 @@ flush_tiling(struct panvk_cmd_buffer *cmdbuf)
|
||||
|
||||
cs_move64_to(b, add_val, 1);
|
||||
|
||||
cs_match(b, iter_sb, cmp_scratch) {
|
||||
#define CASE(x) \
|
||||
cs_case(b, SB_ITER(x)) { \
|
||||
cs_heap_operation(b, MALI_CS_HEAP_OPERATION_VERTEX_TILER_COMPLETED, \
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC))); \
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_VERTEX_TILER, true, \
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr, \
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC))); \
|
||||
}
|
||||
|
||||
CASE(0)
|
||||
CASE(1)
|
||||
CASE(2)
|
||||
CASE(3)
|
||||
CASE(4)
|
||||
#undef CASE
|
||||
cs_match_iter_sb(b, x, iter_sb, cmp_scratch) {
|
||||
cs_heap_operation(b, MALI_CS_HEAP_OPERATION_VERTEX_TILER_COMPLETED,
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC)));
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_VERTEX_TILER, true,
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr,
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC)));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3358,66 +3348,56 @@ issue_fragment_jobs(struct panvk_cmd_buffer *cmdbuf)
|
||||
cs_add64(b, sync_addr, sync_addr,
|
||||
PANVK_SUBQUEUE_FRAGMENT * sizeof(struct panvk_cs_sync64));
|
||||
|
||||
cs_match(b, iter_sb, cmp_scratch) {
|
||||
#define CASE(x) \
|
||||
cs_case(b, SB_ITER(x)) { \
|
||||
const struct cs_async_op async = \
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC)); \
|
||||
if (td_count == 1) { \
|
||||
cs_load_to(b, completed, cur_tiler, BITFIELD_MASK(4), 40); \
|
||||
cs_finish_fragment(b, true, completed_top, completed_bottom, async); \
|
||||
} else if (td_count > 1) { \
|
||||
cs_while(b, MALI_CS_CONDITION_GREATER, tiler_count) { \
|
||||
cs_load_to(b, completed, cur_tiler, BITFIELD_MASK(4), 40); \
|
||||
cs_finish_fragment(b, false, completed_top, completed_bottom, \
|
||||
async); \
|
||||
cs_update_frag_ctx(b) \
|
||||
cs_add64(b, cur_tiler, cur_tiler, pan_size(TILER_CONTEXT)); \
|
||||
cs_add32(b, tiler_count, tiler_count, -1); \
|
||||
} \
|
||||
cs_frag_end(b, async); \
|
||||
} \
|
||||
if (free_render_descs) { \
|
||||
cs_sync32_add(b, true, MALI_CS_SYNC_SCOPE_CSG, release_sz, \
|
||||
ringbuf_sync_addr, async); \
|
||||
} \
|
||||
if (has_oq_chain) { \
|
||||
struct cs_index flush_id = oq_chain_lo; \
|
||||
cs_move32_to(b, flush_id, 0); \
|
||||
cs_flush_caches(b, MALI_CS_FLUSH_MODE_CLEAN, \
|
||||
MALI_CS_FLUSH_MODE_CLEAN, \
|
||||
MALI_CS_OTHER_FLUSH_MODE_NONE, flush_id, \
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_FLUSH))); \
|
||||
cs_load64_to( \
|
||||
b, oq_chain, cs_subqueue_ctx_reg(b), \
|
||||
offsetof(struct panvk_cs_subqueue_context, render.oq_chain)); \
|
||||
/* For WAR dependency on subqueue_context.render.oq_chain. */ \
|
||||
cs_flush_loads(b); \
|
||||
/* We use oq_syncobj as a placeholder to reset the oq_chain. */ \
|
||||
cs_move64_to(b, oq_syncobj, 0); \
|
||||
cs_store64( \
|
||||
b, oq_syncobj, cs_subqueue_ctx_reg(b), \
|
||||
offsetof(struct panvk_cs_subqueue_context, render.oq_chain)); \
|
||||
cs_single_link_list_for_each_from( \
|
||||
b, oq_chain, struct panvk_cs_occlusion_query, node) { \
|
||||
cs_load64_to(b, oq_syncobj, oq_chain, \
|
||||
offsetof(struct panvk_cs_occlusion_query, syncobj)); \
|
||||
cs_sync32_set( \
|
||||
b, true, MALI_CS_SYNC_SCOPE_CSG, add_val_lo, oq_syncobj, \
|
||||
cs_defer(SB_MASK(DEFERRED_FLUSH), SB_ID(DEFERRED_SYNC))); \
|
||||
} \
|
||||
} \
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_FRAGMENT, true, \
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr, \
|
||||
async); \
|
||||
}
|
||||
|
||||
CASE(0)
|
||||
CASE(1)
|
||||
CASE(2)
|
||||
CASE(3)
|
||||
CASE(4)
|
||||
#undef CASE
|
||||
cs_match_iter_sb(b, x, iter_sb, cmp_scratch) {
|
||||
const struct cs_async_op async =
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_SYNC));
|
||||
if (td_count == 1) {
|
||||
cs_load_to(b, completed, cur_tiler, BITFIELD_MASK(4), 40);
|
||||
cs_finish_fragment(b, true, completed_top, completed_bottom, async);
|
||||
} else if (td_count > 1) {
|
||||
cs_while(b, MALI_CS_CONDITION_GREATER, tiler_count) {
|
||||
cs_load_to(b, completed, cur_tiler, BITFIELD_MASK(4), 40);
|
||||
cs_finish_fragment(b, false, completed_top, completed_bottom,
|
||||
async);
|
||||
cs_update_frag_ctx(b)
|
||||
cs_add64(b, cur_tiler, cur_tiler, pan_size(TILER_CONTEXT));
|
||||
cs_add32(b, tiler_count, tiler_count, -1);
|
||||
}
|
||||
cs_frag_end(b, async);
|
||||
}
|
||||
if (free_render_descs) {
|
||||
cs_sync32_add(b, true, MALI_CS_SYNC_SCOPE_CSG, release_sz,
|
||||
ringbuf_sync_addr, async);
|
||||
}
|
||||
if (has_oq_chain) {
|
||||
struct cs_index flush_id = oq_chain_lo;
|
||||
cs_move32_to(b, flush_id, 0);
|
||||
cs_flush_caches(b, MALI_CS_FLUSH_MODE_CLEAN,
|
||||
MALI_CS_FLUSH_MODE_CLEAN,
|
||||
MALI_CS_OTHER_FLUSH_MODE_NONE, flush_id,
|
||||
cs_defer(SB_WAIT_ITER(x), SB_ID(DEFERRED_FLUSH)));
|
||||
cs_load64_to(
|
||||
b, oq_chain, cs_subqueue_ctx_reg(b),
|
||||
offsetof(struct panvk_cs_subqueue_context, render.oq_chain));
|
||||
/* For WAR dependency on subqueue_context.render.oq_chain. */
|
||||
cs_flush_loads(b);
|
||||
/* We use oq_syncobj as a placeholder to reset the oq_chain. */
|
||||
cs_move64_to(b, oq_syncobj, 0);
|
||||
cs_store64(
|
||||
b, oq_syncobj, cs_subqueue_ctx_reg(b),
|
||||
offsetof(struct panvk_cs_subqueue_context, render.oq_chain));
|
||||
cs_single_link_list_for_each_from(
|
||||
b, oq_chain, struct panvk_cs_occlusion_query, node) {
|
||||
cs_load64_to(b, oq_syncobj, oq_chain,
|
||||
offsetof(struct panvk_cs_occlusion_query, syncobj));
|
||||
cs_sync32_set(
|
||||
b, true, MALI_CS_SYNC_SCOPE_CSG, add_val_lo, oq_syncobj,
|
||||
cs_defer(SB_MASK(DEFERRED_FLUSH), SB_ID(DEFERRED_SYNC)));
|
||||
}
|
||||
}
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_FRAGMENT, true,
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr,
|
||||
async);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -150,21 +150,11 @@ panvk_per_arch(dispatch_precomp)(struct panvk_precomp_ctx *ctx,
|
||||
PANVK_SUBQUEUE_COMPUTE * sizeof(struct panvk_cs_sync64));
|
||||
cs_move64_to(b, add_val, 1);
|
||||
|
||||
cs_match(b, iter_sb, cmp_scratch) {
|
||||
#define CASE(x) \
|
||||
cs_case(b, SB_ITER(x)) { \
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_COMPUTE, true, \
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr, \
|
||||
cs_defer(SB_WAIT_ITER(x), \
|
||||
SB_ID(DEFERRED_SYNC))); \
|
||||
}
|
||||
|
||||
CASE(0)
|
||||
CASE(1)
|
||||
CASE(2)
|
||||
CASE(3)
|
||||
CASE(4)
|
||||
#undef CASE
|
||||
cs_match_iter_sb(b, x, iter_sb, cmp_scratch) {
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_COMPUTE, true,
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr,
|
||||
cs_defer(SB_WAIT_ITER(x),
|
||||
SB_ID(DEFERRED_SYNC)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user