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

Author: Rohan Garg <rohan.g...@intel.com>
Date:   Fri Nov  3 15:11:45 2023 +0100

iris: pull WA 22014412737 into emit_3dprimitive_was

Consolidate 3DPRIMITIVE WA's into a single function for iris

Signed-off-by: Rohan Garg <rohan.g...@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25039>

---

 src/gallium/drivers/iris/iris_genx_protos.h |  5 +++-
 src/gallium/drivers/iris/iris_state.c       | 45 +++++++++++++++--------------
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_genx_protos.h 
b/src/gallium/drivers/iris/iris_genx_protos.h
index bedce464abc..44c5d427ce6 100644
--- a/src/gallium/drivers/iris/iris_genx_protos.h
+++ b/src/gallium/drivers/iris/iris_genx_protos.h
@@ -44,7 +44,10 @@ void genX(update_pma_fix)(struct iris_context *ice,
 void genX(invalidate_aux_map_state)(struct iris_batch *batch);
 
 void genX(emit_breakpoint)(struct iris_batch *batch, bool emit_before_draw);
-void genX(emit_3dprimitive_was)(struct iris_batch *batch);
+void genX(emit_3dprimitive_was)(struct iris_batch *batch,
+                                const struct pipe_draw_indirect_info *indirect,
+                                uint32_t primitive_topology,
+                                uint32_t vertex_count);
 
 static inline void
 genX(maybe_emit_breakpoint)(struct iris_batch *batch,
diff --git a/src/gallium/drivers/iris/iris_state.c 
b/src/gallium/drivers/iris/iris_state.c
index f32e7e60479..18900f2b5e0 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -7870,19 +7870,32 @@ genX(emit_breakpoint)(struct iris_batch *batch, bool 
emit_before_draw)
 }
 
 void
-genX(emit_3dprimitive_was)(struct iris_batch *batch)
+genX(emit_3dprimitive_was)(struct iris_batch *batch,
+                           const struct pipe_draw_indirect_info *indirect,
+                           uint32_t primitive_type,
+                           uint32_t vertex_count)
 {
    UNUSED const struct intel_device_info *devinfo = batch->screen->devinfo;
-#if INTEL_NEEDS_WA_16014538804
-   if (!intel_needs_workaround(devinfo, 16014538804))
-      return;
-
-   batch->num_3d_primitives_emitted++;
+   UNUSED const struct iris_context *ice = batch->ice;
 
-   /* Wa_16014538804 - Send empty/dummy pipe control after 3 3DPRIMITIVE. */
-   if (batch->num_3d_primitives_emitted == 3) {
-      iris_emit_pipe_control_flush(batch, "Wa_16014538804", 0);
+#if INTEL_NEEDS_WA_22014412737 || INTEL_NEEDS_WA_16014538804
+   if (intel_needs_workaround(devinfo, 22014412737) &&
+       (point_or_line_list(primitive_type) || indirect ||
+        (vertex_count == 1 || vertex_count == 2))) {
+         iris_emit_pipe_control_write(batch, "Wa_22014412737",
+                                      PIPE_CONTROL_WRITE_IMMEDIATE,
+                                      batch->screen->workaround_bo,
+                                      batch->screen->workaround_address.offset,
+                                      0ull);
       batch->num_3d_primitives_emitted = 0;
+   } else if (intel_needs_workaround(devinfo, 16014538804)) {
+      batch->num_3d_primitives_emitted++;
+
+      /* Wa_16014538804 - Send empty/dummy pipe control after 3 3DPRIMITIVE. */
+      if (batch->num_3d_primitives_emitted == 3) {
+         iris_emit_pipe_control_flush(batch, "Wa_16014538804", 0);
+         batch->num_3d_primitives_emitted = 0;
+      }
    }
 #endif
 }
@@ -8132,21 +8145,9 @@ iris_upload_render_state(struct iris_context *ice,
       }
    }
 
-   genX(emit_3dprimitive_was)(batch);
+   genX(emit_3dprimitive_was)(batch, indirect, ice->state.prim_mode, 
sc->count);
    genX(maybe_emit_breakpoint)(batch, false);
 
-#if GFX_VERx10 == 125
-   if (intel_needs_workaround(devinfo, 22014412737) &&
-       (point_or_line_list(ice->state.prim_mode) || indirect ||
-        (sc->count == 1 || sc->count == 2))) {
-         iris_emit_pipe_control_write(batch, "Wa_22014412737",
-                                      PIPE_CONTROL_WRITE_IMMEDIATE,
-                                      batch->screen->workaround_bo,
-                                      batch->screen->workaround_address.offset,
-                                      0ull);
-   }
-#endif
-
    iris_batch_sync_region_end(batch);
 
    uint32_t count = (sc) ? sc->count : 0;

Reply via email to