summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2021-09-14 16:59:03 +1000
committerMarge Bot <eric+marge@anholt.net>2021-09-14 07:03:36 +0000
commit4149a60209ddd91f52e35318d58831e3196dd67f (patch)
tree5391e13ccdef416bfd100e9a2c6fff8c8ddf1a46
parentbe35fdae5fc4c1a407d9707a0a43ccaa8218f656 (diff)
crocus/gen7: add missing IVB/GT2 geom shader workaround.
Noticed this in passing. Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12847>
-rw-r--r--src/gallium/drivers/crocus/crocus_context.h2
-rw-r--r--src/gallium/drivers/crocus/crocus_state.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/crocus/crocus_context.h b/src/gallium/drivers/crocus/crocus_context.h
index 4cb936831a0..06a0ff0f2fa 100644
--- a/src/gallium/drivers/crocus/crocus_context.h
+++ b/src/gallium/drivers/crocus/crocus_context.h
@@ -626,6 +626,8 @@ struct crocus_context {
struct crocus_shader_state shaders[MESA_SHADER_STAGES];
+ /* track if geom shader is active for IVB GT2 workaround */
+ bool gs_enabled;
/** Do vertex shader uses shader draw parameters ? */
bool vs_uses_draw_params;
bool vs_uses_derived_draw_params;
diff --git a/src/gallium/drivers/crocus/crocus_state.c b/src/gallium/drivers/crocus/crocus_state.c
index 7eb3dc74245..0b6545176f5 100644
--- a/src/gallium/drivers/crocus/crocus_state.c
+++ b/src/gallium/drivers/crocus/crocus_state.c
@@ -6809,6 +6809,22 @@ crocus_upload_dirty_render_state(struct crocus_context *ice,
emit_push_constant_packets(ice, batch, MESA_SHADER_GEOMETRY, &push_bos);
#endif
+#if GFX_VERx10 == 70
+ /**
+ * From Graphics BSpec: 3D-Media-GPGPU Engine > 3D Pipeline Stages >
+ * Geometry > Geometry Shader > State:
+ *
+ * "Note: Because of corruption in IVB:GT2, software needs to flush the
+ * whole fixed function pipeline when the GS enable changes value in
+ * the 3DSTATE_GS."
+ *
+ * The hardware architects have clarified that in this context "flush the
+ * whole fixed function pipeline" means to emit a PIPE_CONTROL with the "CS
+ * Stall" bit set.
+ */
+ if (batch->screen->devinfo.gt == 2 && ice->state.gs_enabled != active)
+ gen7_emit_cs_stall_flush(batch);
+#endif
#if GFX_VER >= 6
crocus_emit_cmd(batch, GENX(3DSTATE_GS), gs)
#else
@@ -6954,6 +6970,7 @@ crocus_upload_dirty_render_state(struct crocus_context *ice,
gs.MaximumVPIndex = ice->state.num_viewports - 1;
#endif
}
+ ice->state.gs_enabled = active;
}
#if GFX_VER >= 7