From 7d9cf48fd7e0f48c0998806959f2a5d255b1fc7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Fri, 17 Oct 2025 13:15:51 +0300 Subject: [PATCH] iris: implement autostrip disable for Wa_14024997852 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that currently autostrip is disabled globally with Wa_14021490052 for some gfx versions and steppings. Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/iris_context.h | 3 ++ src/gallium/drivers/iris/iris_state.c | 50 +++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index fd887ef9a32..a05d54e5389 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -1068,6 +1068,9 @@ struct iris_context { /** State for Wa_14015055625, Wa_14019166699 */ bool uses_primitive_id; + /** State for Wa_14024997852. */ + bool autostrip_state; + /** Do we have integer RT in current framebuffer state? */ bool has_integer_rt; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 9e275b47188..e1332d9ac48 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -6904,6 +6904,34 @@ emit_wa_18020335297_dummy_draw(struct iris_batch *batch) } } +static void +setup_autostrip_state(struct iris_context *ice, + struct iris_batch *batch, + bool enable) +{ +#if GFX_VERx10 >= 200 + if (ice->state.autostrip_state != enable) { + iris_emit_pipe_control_flush(batch, + "Wa_14024997852", + PIPE_CONTROL_CS_STALL); + /* VF */ + iris_emit_reg(batch, GENX(VFL_SCRATCH_PAD), vfl) { + vfl.AutostripDisable = !enable; + vfl.PartialAutostripDisable = !enable; + vfl.AutostripDisableMask = true; + vfl.PartialAutostripDisableMask = true; + } + /* TE and Mesh. */ + iris_emit_reg(batch, GENX(FF_MODE), ff) { + ff.TEAutostripDisable = !enable; + ff.MeshShaderAutostripDisable = !enable; + ff.MeshShaderPartialAutostripDisable = !enable; + } + ice->state.autostrip_state = enable; + } +#endif +} + static void iris_upload_dirty_render_state(struct iris_context *ice, struct iris_batch *batch, @@ -6939,6 +6967,28 @@ iris_upload_dirty_render_state(struct iris_context *ice, struct iris_fs_data *fs_data = iris_fs_data(ice->shaders.prog[MESA_SHADER_FRAGMENT]); + /* Wa_14024997852: When Draw Cut Index or primitive id is enabled + * and topology is tri list, we need to toggle autostrip. + * + * Note that we do not take primitive id in to account because it + * is mentioned only in xe2 clone of this wa and autostrip has been + * disabled globally on xe2 (+xe3 a0) by kernel due to 14021490052 + * workaround. + */ + if (intel_needs_workaround(batch->screen->devinfo, 14024997852) && + dirty & (IRIS_DIRTY_VF | IRIS_DIRTY_VF_TOPOLOGY)) { + bool tri_list_topology = + translate_prim_type(draw->mode, ice->state.vertices_per_patch) == + _3DPRIM_TRILIST; + + /* Enable autostrip unless having triangle list topology and + * IndexedDrawCutIndexEnable (only used on primitive_restart). + */ + setup_autostrip_state(ice, batch, + tri_list_topology && + draw->primitive_restart); + } + /* When MSAA is enabled, instead of using BLENDFACTOR_ZERO use * CONST_COLOR, CONST_ALPHA and supply zero by using blend constants. */