From: Marek Olšák Date: Mon, 10 Oct 2022 21:18:52 +0000 (-0400) Subject: radeonsi: fix max_dw computation for CS preambles X-Git-Tag: upstream/22.3.5~1583 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9341eb9dadcb4688181ec3bfe4bfeb1153d86e4;p=platform%2Fupstream%2Fmesa.git radeonsi: fix max_dw computation for CS preambles Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c b/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c index 48b36b6..d58b9a9 100644 --- a/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c +++ b/src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c @@ -75,7 +75,7 @@ si_create_shadowing_ib_preamble(struct si_context *sctx) 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); + pm4->max_dw = (sizeof(struct si_shadow_preamble) - offsetof(struct si_shadow_preamble, pm4.pm4)) / 4; if (sctx->screen->dpbb_allowed) { si_pm4_cmd_add(pm4, PKT3(PKT3_EVENT_WRITE, 0, 0)); diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 664c802..3219891 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -5553,7 +5553,7 @@ void si_init_cs_preamble_state(struct si_context *sctx, bool uses_reg_shadowing) return; /* Add all the space that we allocated. */ - pm4->max_dw = sizeof(struct si_cs_preamble) - offsetof(struct si_cs_preamble, pm4.pm4); + pm4->max_dw = (sizeof(struct si_cs_preamble) - offsetof(struct si_cs_preamble, pm4.pm4)) / 4; if (!uses_reg_shadowing) { si_pm4_cmd_add(pm4, PKT3(PKT3_CONTEXT_CONTROL, 1, 0));