Mesa (main): radeonsi: decrease the size of si_pm4_state::pm4 except for cs_preamble_state
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jan 5 07:07:31 UTC 2022
Module: Mesa
Branch: main
Commit: 946bd90a097e8bf4f060f7a18d04f1df1c23275f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=946bd90a097e8bf4f060f7a18d04f1df1c23275f
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Dec 8 19:00:08 2021 -0500
radeonsi: decrease the size of si_pm4_state::pm4 except for cs_preamble_state
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
---
src/gallium/drivers/radeonsi/si_pm4.h | 4 +++-
src/gallium/drivers/radeonsi/si_state.c | 10 +++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_pm4.h b/src/gallium/drivers/radeonsi/si_pm4.h
index 3316cf77840..4ebc97cc260 100644
--- a/src/gallium/drivers/radeonsi/si_pm4.h
+++ b/src/gallium/drivers/radeonsi/si_pm4.h
@@ -54,7 +54,9 @@ struct si_pm4_state {
/* commands for the DE */
uint16_t max_dw;
- uint32_t pm4[480];
+
+ /* This must be the last field because the array can continue after the structure. */
+ uint32_t pm4[64];
};
void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw);
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 8d242b85c40..293b9b81f8e 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -5383,11 +5383,19 @@ void si_init_cs_preamble_state(struct si_context *sctx, bool uses_reg_shadowing)
struct si_screen *sscreen = sctx->screen;
uint64_t border_color_va = sctx->border_color_buffer->gpu_address;
bool has_clear_state = sscreen->info.has_clear_state;
- struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
+
+ struct si_cs_preamble {
+ struct si_pm4_state pm4;
+ uint32_t more_pm4[150]; /* Add more space because the preamble is large. */
+ };
+ struct si_pm4_state *pm4 = (struct si_pm4_state *)CALLOC_STRUCT(si_cs_preamble);
if (!pm4)
return;
+ /* Add all the space that we allocated. */
+ pm4->max_dw = sizeof(struct si_cs_preamble) - offsetof(struct si_cs_preamble, pm4.pm4);
+
if (!uses_reg_shadowing) {
si_pm4_cmd_add(pm4, PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
si_pm4_cmd_add(pm4, CC0_UPDATE_LOAD_ENABLES(1));
More information about the mesa-commit
mailing list