hk: ensure space with the dispatch

cleaner.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33682>
This commit is contained in:
Alyssa Rosenzweig 2025-01-15 12:52:18 -05:00 committed by Marge Bot
parent ed7d11e389
commit 29d80221db
3 changed files with 1 additions and 16 deletions

View file

@ -59,7 +59,7 @@ hk_dispatch_with_usc_launch(struct hk_device *dev, struct hk_cs *cs,
uint32_t usc, struct agx_grid grid,
struct agx_workgroup wg)
{
assert(cs->current + 0x2000 < cs->end && "should have ensured space");
hk_ensure_cs_has_space(cs->cmd, cs, 0x2000 /* TODO */);
cs->stats.cmds++;
cs->current =
@ -107,8 +107,6 @@ dispatch(struct hk_cmd_buffer *cmd, struct agx_grid grid)
stat, agx_workgroup_threads(local_size));
}
hk_ensure_cs_has_space(cmd, cs, 0x2000 /* TODO */);
if (!agx_is_indirect(grid)) {
grid.count[0] *= local_size.x;
grid.count[1] *= local_size.y;

View file

@ -1409,8 +1409,6 @@ hk_launch_gs_prerast(struct hk_cmd_buffer *cmd, struct hk_cs *cs,
struct vk_dynamic_graphics_state *dyn = &cmd->vk.dynamic_graphics_state;
bool rast_disc = dyn->rs.rasterizer_discard_enable;
hk_ensure_cs_has_space(cmd, cs, 0x2000 /*XXX*/);
struct hk_shader *vs = hk_bound_sw_vs_before_gs(gfx);
struct hk_shader *main = hk_main_gs_variant(gs, rast_disc);
struct hk_shader *count = hk_count_gs_variant(gs, rast_disc);
@ -1517,8 +1515,6 @@ hk_launch_tess(struct hk_cmd_buffer *cmd, struct hk_cs *cs,
uint64_t state = gfx->descriptors.root.draw.tess_params;
struct hk_tess_info info = gfx->tess.info;
hk_ensure_cs_has_space(cmd, cs, 0x2000 /*XXX*/);
perf_debug(dev, "Tessellation");
uint64_t tcs_stat = hk_pipeline_stat_addr(
@ -3324,7 +3320,6 @@ hk_ia_update(struct hk_cmd_buffer *cmd, struct hk_cs *cs, struct agx_draw draw,
uint64_t ia_vertices, uint64_t ia_prims, uint64_t vs_invocations,
uint64_t c_prims, uint64_t c_inv)
{
/* XXX: stream link needed? */
struct hk_device *dev = hk_cmd_buffer_device(cmd);
perf_debug(dev, "Input assembly counters");
@ -3719,8 +3714,6 @@ hk_draw_indirect_count(VkCommandBuffer commandBuffer, VkBuffer _buffer,
if (!cs)
return;
hk_ensure_cs_has_space(cmd, cs, 0x2000 /* TODO */);
assert((stride % 4) == 0 && "aligned");
size_t out_stride = sizeof(uint32_t) * (indexed ? 5 : 4);
@ -3810,7 +3803,6 @@ hk_begin_end_xfb(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
hk_cmd_buffer_get_cs_general(cmd, &cmd->current_cs.pre_gfx, true);
if (!cs)
return;
hk_ensure_cs_has_space(cmd, cs, 0x2000 /* TODO */);
struct libagx_xfb_counter_copy params = {};
unsigned copies = 0;

View file

@ -247,8 +247,6 @@ hk_query_report_map(struct hk_device *dev, struct hk_query_pool *pool,
void
hk_dispatch_imm_writes(struct hk_cmd_buffer *cmd, struct hk_cs *cs)
{
hk_ensure_cs_has_space(cmd, cs, 0x2000 /* TODO */);
/* As soon as we mark a query available, it needs to be available system
* wide, otherwise a CPU-side get result can query. As such, we cache flush
* before and then let coherency works its magic. Without this barrier, we
@ -292,8 +290,6 @@ hk_queue_write(struct hk_cmd_buffer *cmd, uint64_t address, uint32_t value,
return;
}
hk_ensure_cs_has_space(cmd, cs, 0x2000 /* TODO */);
/* As soon as we mark a query available, it needs to be available system
* wide, otherwise a CPU-side get result can query. As such, we cache flush
* before and then let coherency works its magic. Without this barrier, we
@ -684,7 +680,6 @@ hk_CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
return;
perf_debug(dev, "Query pool copy");
hk_ensure_cs_has_space(cmd, cs, 0x2000 /* TODO */);
struct libagx_copy_query_args info = {
.availability = hk_has_available(pool) ? pool->bo->va->addr : 0,