panvk/csf: put precomp syncobj behind PANLIB_BARRIER_CSF_SYNC option
In some cases, we don't need to signal the syncobj yet because we will be issuing a second asynchronous instruction afterwards blocking on the first. Signed-off-by: Olivia Lee <olivia.lee@collabora.com> Acked-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37971>
This commit is contained in:
@@ -11,6 +11,8 @@ enum panlib_barrier {
|
||||
PANLIB_BARRIER_NONE = 0,
|
||||
PANLIB_BARRIER_JM_BARRIER = (1 << 0),
|
||||
PANLIB_BARRIER_JM_SUPPRESS_PREFETCH = (1 << 1),
|
||||
/* On panvk, increment the syncobj on the compute subqueue */
|
||||
PANLIB_BARRIER_CSF_SYNC = (1 << 2),
|
||||
};
|
||||
|
||||
struct panlib_precomp_grid {
|
||||
@@ -52,4 +54,4 @@ panlib_1d_with_jm_deps(uint32_t x, uint16_t local_dep, uint16_t global_dep)
|
||||
return panlib_3d_with_jm_deps(x, 1, 1, local_dep, global_dep);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,8 @@ panvk_per_arch(dispatch_precomp)(struct panvk_precomp_ctx *ctx,
|
||||
enum libpan_shaders_program idx, void *data,
|
||||
size_t data_size)
|
||||
{
|
||||
assert(barrier == PANLIB_BARRIER_NONE && "Unsupported barrier flags");
|
||||
enum panlib_barrier supported_barriers = PANLIB_BARRIER_CSF_SYNC;
|
||||
assert(!(barrier & ~supported_barriers) && "Unsupported barrier flags");
|
||||
|
||||
struct panvk_cmd_buffer *cmdbuf = ctx->cmdbuf;
|
||||
struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device);
|
||||
@@ -117,50 +118,53 @@ panvk_per_arch(dispatch_precomp)(struct panvk_precomp_ctx *ctx,
|
||||
task_increment, task_axis,
|
||||
cs_shader_res_sel(0, 0, 0, 0));
|
||||
|
||||
if (barrier & PANLIB_BARRIER_CSF_SYNC) {
|
||||
#if PAN_ARCH >= 11
|
||||
struct cs_index sync_addr = cs_scratch_reg64(b, 0);
|
||||
struct cs_index add_val = cs_scratch_reg64(b, 2);
|
||||
struct cs_index sync_addr = cs_scratch_reg64(b, 0);
|
||||
struct cs_index add_val = cs_scratch_reg64(b, 2);
|
||||
|
||||
cs_load64_to(b, sync_addr, cs_subqueue_ctx_reg(b),
|
||||
offsetof(struct panvk_cs_subqueue_context, syncobjs));
|
||||
cs_add64(b, sync_addr, sync_addr,
|
||||
PANVK_SUBQUEUE_COMPUTE * sizeof(struct panvk_cs_sync64));
|
||||
cs_move64_to(b, add_val, 1);
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_COMPUTE, true,
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr,
|
||||
cs_defer_indirect());
|
||||
cs_load64_to(b, sync_addr, cs_subqueue_ctx_reg(b),
|
||||
offsetof(struct panvk_cs_subqueue_context, syncobjs));
|
||||
cs_add64(b, sync_addr, sync_addr,
|
||||
PANVK_SUBQUEUE_COMPUTE * sizeof(struct panvk_cs_sync64));
|
||||
cs_move64_to(b, add_val, 1);
|
||||
panvk_instr_sync64_add(cmdbuf, PANVK_SUBQUEUE_COMPUTE, true,
|
||||
MALI_CS_SYNC_SCOPE_CSG, add_val, sync_addr,
|
||||
cs_defer_indirect());
|
||||
#else
|
||||
struct cs_index sync_addr = cs_scratch_reg64(b, 0);
|
||||
struct cs_index iter_sb = cs_scratch_reg32(b, 2);
|
||||
struct cs_index cmp_scratch = cs_scratch_reg32(b, 3);
|
||||
struct cs_index add_val = cs_scratch_reg64(b, 4);
|
||||
struct cs_index sync_addr = cs_scratch_reg64(b, 0);
|
||||
struct cs_index iter_sb = cs_scratch_reg32(b, 2);
|
||||
struct cs_index cmp_scratch = cs_scratch_reg32(b, 3);
|
||||
struct cs_index add_val = cs_scratch_reg64(b, 4);
|
||||
|
||||
cs_load_to(b, cs_scratch_reg_tuple(b, 0, 3), cs_subqueue_ctx_reg(b),
|
||||
BITFIELD_MASK(3),
|
||||
offsetof(struct panvk_cs_subqueue_context, syncobjs));
|
||||
cs_load_to(b, cs_scratch_reg_tuple(b, 0, 3), cs_subqueue_ctx_reg(b),
|
||||
BITFIELD_MASK(3),
|
||||
offsetof(struct panvk_cs_subqueue_context, syncobjs));
|
||||
|
||||
cs_add64(b, sync_addr, sync_addr,
|
||||
PANVK_SUBQUEUE_COMPUTE * sizeof(struct panvk_cs_sync64));
|
||||
cs_move64_to(b, add_val, 1);
|
||||
cs_add64(b, sync_addr, sync_addr,
|
||||
PANVK_SUBQUEUE_COMPUTE * sizeof(struct panvk_cs_sync64));
|
||||
cs_move64_to(b, add_val, 1);
|
||||
|
||||
cs_match(b, iter_sb, cmp_scratch) {
|
||||
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))); \
|
||||
}
|
||||
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)
|
||||
CASE(0)
|
||||
CASE(1)
|
||||
CASE(2)
|
||||
CASE(3)
|
||||
CASE(4)
|
||||
#undef CASE
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
++cmdbuf->state.cs[PANVK_SUBQUEUE_COMPUTE].relative_sync_point;
|
||||
++cmdbuf->state.cs[PANVK_SUBQUEUE_COMPUTE].relative_sync_point;
|
||||
}
|
||||
|
||||
/* XXX: clobbers the registers instead to avoid recreating them when calling
|
||||
* a dispatch after? */
|
||||
|
||||
@@ -635,7 +635,7 @@ panvk_copy_timestamp_query_results(struct panvk_cmd_buffer *cmd,
|
||||
|
||||
struct panvk_precomp_ctx precomp_ctx = panvk_per_arch(precomp_cs)(cmd);
|
||||
panlib_copy_ts_query_result_struct(&precomp_ctx, panlib_1d(query_count),
|
||||
PANLIB_BARRIER_NONE, push);
|
||||
PANLIB_BARRIER_CSF_SYNC, push);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
|
||||
@@ -21,6 +21,10 @@ panvk_per_arch(dispatch_precomp)(struct panvk_precomp_ctx *ctx,
|
||||
enum libpan_shaders_program idx, void *data,
|
||||
size_t data_size)
|
||||
{
|
||||
enum panlib_barrier supported_barriers =
|
||||
PANLIB_BARRIER_JM_BARRIER | PANLIB_BARRIER_JM_SUPPRESS_PREFETCH;
|
||||
assert(!(barrier & ~supported_barriers) && "Unsupported barrier flags");
|
||||
|
||||
struct panvk_cmd_buffer *cmdbuf = ctx->cmdbuf;
|
||||
|
||||
/* Make sure we have a batch opened to queue our COMPUTE job to. */
|
||||
|
||||
@@ -651,7 +651,8 @@ cmd_clear_afbc_metadata(VkCommandBuffer _cmdbuf,
|
||||
&precomp_ctx,
|
||||
panlib_3d(slayout->afbc.header.surface_size_B / 16,
|
||||
layers_or_slices, 1),
|
||||
PAN_ARCH >= 10 ? PANLIB_BARRIER_NONE : PANLIB_BARRIER_JM_BARRIER,
|
||||
PAN_ARCH >= 10 ? PANLIB_BARRIER_CSF_SYNC :
|
||||
PANLIB_BARRIER_JM_BARRIER,
|
||||
args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user