Module: Mesa
Branch: main
Commit: 626e1a01b02ce91c03d5b5412f3f208adb3f1491
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=626e1a01b02ce91c03d5b5412f3f208adb3f1491

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Mon Oct 23 23:03:21 2023 -0400

radeonsi: move buffered_xx_regs into a substructure

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-pra...@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26095>

---

 src/gallium/drivers/radeonsi/si_build_pm4.h    |  6 +++---
 src/gallium/drivers/radeonsi/si_compute.c      |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.h         | 11 +++++++----
 src/gallium/drivers/radeonsi/si_state.h        |  2 +-
 src/gallium/drivers/radeonsi/si_state_draw.cpp | 10 +++++-----
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_build_pm4.h 
b/src/gallium/drivers/radeonsi/si_build_pm4.h
index 3f45226dcb4..ab3e35ba6c8 100644
--- a/src/gallium/drivers/radeonsi/si_build_pm4.h
+++ b/src/gallium/drivers/radeonsi/si_build_pm4.h
@@ -262,9 +262,9 @@
 /* GFX11 generic packet building helpers for buffered SH registers. Don't use 
these directly. */
 #define gfx11_push_sh_reg(reg, value, type) do { \
    unsigned __i = sctx->num_buffered_##type##_sh_regs++; \
-   assert(__i / 2 < ARRAY_SIZE(sctx->buffered_##type##_sh_regs)); \
-   sctx->buffered_##type##_sh_regs[__i / 2].reg_offset[__i % 2] = ((reg) - 
SI_SH_REG_OFFSET) >> 2; \
-   sctx->buffered_##type##_sh_regs[__i / 2].reg_value[__i % 2] = value; \
+   assert(__i / 2 < ARRAY_SIZE(sctx->gfx11.buffered_##type##_sh_regs)); \
+   sctx->gfx11.buffered_##type##_sh_regs[__i / 2].reg_offset[__i % 2] = ((reg) 
- SI_SH_REG_OFFSET) >> 2; \
+   sctx->gfx11.buffered_##type##_sh_regs[__i / 2].reg_value[__i % 2] = value; \
 } while (0)
 
 #define gfx11_opt_push_sh_reg(reg, reg_enum, value, type) do { \
diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index bf534ce75a6..94a492765cc 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -859,7 +859,7 @@ static void si_emit_dispatch_packets(struct si_context 
*sctx, const struct pipe_
 
    if (sctx->gfx_level >= GFX11) {
       radeon_end();
-      gfx11_emit_buffered_compute_sh_regs(sctx);
+      si_emit_buffered_compute_sh_regs(sctx);
       radeon_begin_again(cs);
    }
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 87a576f6011..78a35d3a4f1 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -947,7 +947,7 @@ struct si_vertex_state {
 };
 
 /* The structure layout is identical to a pair of registers in 
SET_*_REG_PAIRS_PACKED. */
-struct si_sh_reg_pair {
+struct gfx11_reg_pair {
    union {
       /* A pair of register offsets. */
       struct {
@@ -1063,11 +1063,14 @@ struct si_context {
    uint64_t dirty_atoms; /* mask */
    union si_state queued;
    union si_state emitted;
-   /* Gfx11+: Buffered SH registers for SET_SH_REG_PAIRS_PACKED*. */
+
+   /* Gfx11+: Buffered SH registers for SET_SH_REG_PAIRS_*. */
    unsigned num_buffered_gfx_sh_regs;
-   struct si_sh_reg_pair buffered_gfx_sh_regs[32];
    unsigned num_buffered_compute_sh_regs;
-   struct si_sh_reg_pair buffered_compute_sh_regs[32];
+   struct {
+      struct gfx11_reg_pair buffered_gfx_sh_regs[32];
+      struct gfx11_reg_pair buffered_compute_sh_regs[32];
+   } gfx11;
 
    /* Atom declarations. */
    struct si_framebuffer framebuffer;
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 6a423aed2fd..542db0faa05 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -636,7 +636,7 @@ void si_cp_dma_prefetch(struct si_context *sctx, struct 
pipe_resource *buf,
 void si_set_vertex_buffer_descriptor(struct si_screen *sscreen, struct 
si_vertex_elements *velems,
                                      struct pipe_vertex_buffer *vb, unsigned 
element_index,
                                      uint32_t *out);
-void gfx11_emit_buffered_compute_sh_regs(struct si_context *sctx);
+void si_emit_buffered_compute_sh_regs(struct si_context *sctx);
 void si_init_draw_functions_GFX6(struct si_context *sctx);
 void si_init_draw_functions_GFX7(struct si_context *sctx);
 void si_init_draw_functions_GFX8(struct si_context *sctx);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp 
b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index ca8eb3b007c..0de66e638a9 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -1128,7 +1128,7 @@ static void si_emit_draw_registers(struct si_context 
*sctx,
 
 static ALWAYS_INLINE void
 gfx11_emit_buffered_sh_regs_inline(struct si_context *sctx, unsigned *num_regs,
-                                   struct si_sh_reg_pair *reg_pairs)
+                                   struct gfx11_reg_pair *reg_pairs)
 {
    unsigned reg_count = *num_regs;
 
@@ -1171,10 +1171,10 @@ gfx11_emit_buffered_sh_regs_inline(struct si_context 
*sctx, unsigned *num_regs,
 
 #if GFX_VER == 6 /* declare this function only once because there is only one 
variant. */
 
-void gfx11_emit_buffered_compute_sh_regs(struct si_context *sctx)
+void si_emit_buffered_compute_sh_regs(struct si_context *sctx)
 {
    gfx11_emit_buffered_sh_regs_inline(sctx, 
&sctx->num_buffered_compute_sh_regs,
-                                      sctx->buffered_compute_sh_regs);
+                                      sctx->gfx11.buffered_compute_sh_regs);
 }
 
 #endif
@@ -1342,7 +1342,7 @@ static void si_emit_draw_packets(struct si_context *sctx, 
const struct pipe_draw
       if (HAS_PAIRS) {
          radeon_end();
          gfx11_emit_buffered_sh_regs_inline(sctx, 
&sctx->num_buffered_gfx_sh_regs,
-                                            sctx->buffered_gfx_sh_regs);
+                                            sctx->gfx11.buffered_gfx_sh_regs);
          radeon_begin_again(cs);
       }
 
@@ -1451,7 +1451,7 @@ static void si_emit_draw_packets(struct si_context *sctx, 
const struct pipe_draw
       if (HAS_PAIRS) {
          radeon_end();
          gfx11_emit_buffered_sh_regs_inline(sctx, 
&sctx->num_buffered_gfx_sh_regs,
-                                            sctx->buffered_gfx_sh_regs);
+                                            sctx->gfx11.buffered_gfx_sh_regs);
          radeon_begin_again(cs);
       }
 

Reply via email to