hk,asahi,libagx: unify a bit of code

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32434>
This commit is contained in:
Alyssa Rosenzweig
2024-11-28 15:39:45 -05:00
committed by Marge Bot
parent b41b7e6bc8
commit d894941895
3 changed files with 8 additions and 16 deletions

View File

@@ -230,6 +230,12 @@ agx_vdm_jump(global_ uint32_t *out, uint64_t target)
return out;
}
static inline global_ uint32_t *
agx_cs_jump(global_ uint32_t *out, uint64_t target, bool vdm)
{
return vdm ? agx_vdm_jump(out, target) : agx_cdm_jump(out, target);
}
static inline global_ uint32_t *
agx_cdm_call(global_ uint32_t *out, uint64_t target)
{

View File

@@ -812,11 +812,7 @@ hk_ensure_cs_has_space(struct hk_cmd_buffer *cmd, struct hk_cs *cs,
struct agx_ptr T = hk_pool_alloc(cmd, size, 256);
/* Jump from the old control stream to the new control stream */
if (vdm) {
agx_vdm_jump(cs->current, T.gpu);
} else {
agx_cdm_jump(cs->current, T.gpu);
}
agx_cs_jump(cs->current, T.gpu, vdm);
/* Swap out the control stream */
cs->current = T.cpu;

View File

@@ -3869,17 +3869,7 @@ agx_ensure_cmdbuf_has_space(struct agx_batch *batch, struct agx_encoder *enc,
struct agx_ptr T = agx_pool_alloc_aligned(&batch->pool, size, 256);
/* Jump from the old command buffer to the new command buffer */
if (vdm) {
agx_pack(enc->current, VDM_STREAM_LINK, cfg) {
cfg.target_lo = T.gpu & BITFIELD_MASK(32);
cfg.target_hi = T.gpu >> 32;
}
} else {
agx_pack(enc->current, CDM_STREAM_LINK, cfg) {
cfg.target_lo = T.gpu & BITFIELD_MASK(32);
cfg.target_hi = T.gpu >> 32;
}
}
agx_cs_jump((uint32_t *)enc->current, T.gpu, vdm);
/* Swap out the command buffer */
enc->current = T.cpu;