From 0f96948dfab3b9d7cbda1d8cac1308e976a35eff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 26 Feb 2022 22:37:14 -0500 Subject: [PATCH] radeonsi: fix register shadowing after the pm4 state size was decreased Fixes: 946bd90a097e8 "radeonsi: decrease the size of si_pm4_state::pm4 except for cs_preamble_state" Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c b/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c index c3da8af..ca6b41d 100644 --- a/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c +++ b/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c @@ -68,7 +68,14 @@ static void si_build_load_reg(struct si_screen *sscreen, struct si_pm4_state *pm static struct si_pm4_state * si_create_shadowing_ib_preamble(struct si_context *sctx) { - struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state); + 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 *pm4 = (struct si_pm4_state *)CALLOC_STRUCT(si_shadow_preamble); + + /* Add all the space that we allocated. */ + pm4->max_dw = sizeof(struct si_shadow_preamble) - offsetof(struct si_shadow_preamble, pm4.pm4); if (sctx->screen->dpbb_allowed) { si_pm4_cmd_add(pm4, PKT3(PKT3_EVENT_WRITE, 0, 0)); -- 2.7.4