radeonsi/gfx11: move the PIXEL_PIPE_STAT_CONTROL event into the GFX preambles
authorMarek Olšák <marek.olsak@amd.com>
Tue, 24 Jan 2023 11:02:15 +0000 (06:02 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 3 Feb 2023 00:18:01 +0000 (00:18 +0000)
Both the normal and shadowing preamable should do this.

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

src/amd/common/ac_shadowed_regs.c
src/gallium/drivers/radeonsi/si_query.c
src/gallium/drivers/radeonsi/si_state.c

index e4fb6c9..e1f958b 100644 (file)
@@ -4196,6 +4196,15 @@ void ac_create_shadowing_ib_preamble(const struct radeon_info *info,
    pm4_cmd_add(pm4_cmdbuf, EVENT_TYPE(V_028A90_VGT_FLUSH) | EVENT_INDEX(0));
 
    if (info->gfx_level >= GFX11) {
+      uint64_t rb_mask = BITFIELD64_MASK(info->max_render_backends);
+
+      pm4_cmd_add(pm4_cmdbuf, PKT3(PKT3_EVENT_WRITE, 2, 0));
+      pm4_cmd_add(pm4_cmdbuf, EVENT_TYPE(V_028A90_PIXEL_PIPE_STAT_CONTROL) | EVENT_INDEX(1));
+      pm4_cmd_add(pm4_cmdbuf, PIXEL_PIPE_STATE_CNTL_COUNTER_ID(0) |
+                              PIXEL_PIPE_STATE_CNTL_STRIDE(2) |
+                              PIXEL_PIPE_STATE_CNTL_INSTANCE_EN_LO(rb_mask));
+      pm4_cmd_add(pm4_cmdbuf, PIXEL_PIPE_STATE_CNTL_INSTANCE_EN_HI(rb_mask));
+
       /* We must wait for idle using an EOP event before changing the attribute ring registers.
        * Use the bottom-of-pipe EOP event, but increment the PWS counter instead of writing memory.
        */
index ba82464..7a23627 100644 (file)
@@ -813,17 +813,6 @@ static void si_query_hw_do_emit_start(struct si_context *sctx, struct si_query_h
    case PIPE_QUERY_OCCLUSION_PREDICATE:
    case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: {
       radeon_begin(cs);
-      if (sctx->gfx_level >= GFX11) {
-         uint64_t rb_mask = BITFIELD64_MASK(sctx->screen->info.max_render_backends);
-
-         radeon_emit(PKT3(PKT3_EVENT_WRITE, 2, 0));
-         radeon_emit(EVENT_TYPE(V_028A90_PIXEL_PIPE_STAT_CONTROL) | EVENT_INDEX(1));
-         radeon_emit(PIXEL_PIPE_STATE_CNTL_COUNTER_ID(0) |
-                     PIXEL_PIPE_STATE_CNTL_STRIDE(2) |
-                     PIXEL_PIPE_STATE_CNTL_INSTANCE_EN_LO(rb_mask));
-         radeon_emit(PIXEL_PIPE_STATE_CNTL_INSTANCE_EN_HI(rb_mask));
-      }
-
       radeon_emit(PKT3(PKT3_EVENT_WRITE, 2, 0));
       if (sctx->gfx_level >= GFX11)
          radeon_emit(EVENT_TYPE(V_028A90_PIXEL_PIPE_STAT_DUMP) | EVENT_INDEX(1));
index 5b19e62..0d51e85 100644 (file)
@@ -5920,6 +5920,15 @@ void si_init_cs_preamble_state(struct si_context *sctx, bool uses_reg_shadowing)
       si_pm4_set_reg(pm4, R_028620_PA_RATE_CNTL,
                      S_028620_VERTEX_RATE(2) | S_028620_PRIM_RATE(1));
 
+      uint64_t rb_mask = BITFIELD64_MASK(sctx->screen->info.max_render_backends);
+
+      si_pm4_cmd_add(pm4, PKT3(PKT3_EVENT_WRITE, 2, 0));
+      si_pm4_cmd_add(pm4, EVENT_TYPE(V_028A90_PIXEL_PIPE_STAT_CONTROL) | EVENT_INDEX(1));
+      si_pm4_cmd_add(pm4, PIXEL_PIPE_STATE_CNTL_COUNTER_ID(0) |
+                          PIXEL_PIPE_STATE_CNTL_STRIDE(2) |
+                          PIXEL_PIPE_STATE_CNTL_INSTANCE_EN_LO(rb_mask));
+      si_pm4_cmd_add(pm4, PIXEL_PIPE_STATE_CNTL_INSTANCE_EN_HI(rb_mask));
+
       /* We must wait for idle using an EOP event before changing the attribute ring registers.
        * Use the bottom-of-pipe EOP event, but increment the PWS counter instead of writing memory.
        */