From c4811edfa693f3b417b41ead67b5b13d32913569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 10 Jun 2023 21:44:35 -0400 Subject: [PATCH] radeonsi: use si_pm4_create_sized for the shadowing preamble Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c b/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c index 8cbc8caa0a0..80272e98c8c 100644 --- a/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c +++ b/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c @@ -61,16 +61,8 @@ void si_init_cp_reg_shadowing(struct si_context *sctx) 0, sctx->shadowing.registers->bo_size, 0, SI_OP_SYNC_AFTER, SI_COHERENCY_CP, L2_BYPASS); - /* Create the shadowing preamble. */ - struct si_shadow_preamble { - struct si_pm4_state pm4; - uint32_t more_pm4[150]; /* Add more space because the command buffer is large. */ - }; - struct si_pm4_state *shadowing_preamble = (struct si_pm4_state *)CALLOC_STRUCT(si_shadow_preamble); - - /* Add all the space that we allocated. */ - shadowing_preamble->max_dw = (sizeof(struct si_shadow_preamble) - - offsetof(struct si_shadow_preamble, pm4.pm4)) / 4; + /* Create the shadowing preamble. (allocate enough dwords because the preamble is large) */ + struct si_pm4_state *shadowing_preamble = si_pm4_create_sized(sctx->screen, 256, false); ac_create_shadowing_ib_preamble(&sctx->screen->info, (pm4_cmd_add_fn)si_pm4_cmd_add, shadowing_preamble,