From c968caaa69b71370f5a0144dcf1765935e95362d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 6 Mar 2024 21:40:59 -0800 Subject: [PATCH] iris: Fix tessellation evaluation shaders that use scratch The code path for emitting tessellation commands when the TES needed scratch space was failing to emit 3DSTATE_TE, and instead only emitting 3DSTATE_DS. This meant that you could get HS and DS enabled with tessellation itself turned off, which is utter nonsense and would cause a GPU hang. Alchemist and later takes a different path and don't take this bug, but all earlier hardware would hit it. Discovered while working on compiler changes that caused a single piglit test to spill minorly, and thus break entirely. Fixes: 4256f7ed584 ("iris: Fill out scratch base address dynamically") Reviewed-by: Lionel Landwerlin Part-of: (cherry picked from commit 9e5fd49cbe98dd3afb8660f85b687efe36364127) --- .pick_status.json | 2 +- src/gallium/drivers/iris/iris_state.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9c88a417566..5d18c932edf 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -24,7 +24,7 @@ "description": "iris: Fix tessellation evaluation shaders that use scratch", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4256f7ed5847505c30e903b6674dac88c5d03315", "notes": null diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 992d859b3a8..efca66cfe21 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -7278,7 +7278,13 @@ iris_upload_dirty_render_state(struct iris_context *ice, switch (stage) { case MESA_SHADER_VERTEX: MERGE_SCRATCH_ADDR(3DSTATE_VS); break; case MESA_SHADER_TESS_CTRL: MERGE_SCRATCH_ADDR(3DSTATE_HS); break; - case MESA_SHADER_TESS_EVAL: MERGE_SCRATCH_ADDR(3DSTATE_DS); break; + case MESA_SHADER_TESS_EVAL: { + uint32_t *shader_ds = (uint32_t *) shader->derived_data; + uint32_t *shader_te = shader_ds + GENX(3DSTATE_DS_length); + iris_batch_emit(batch, shader_te, 4 * GENX(3DSTATE_TE_length)); + MERGE_SCRATCH_ADDR(3DSTATE_DS); + break; + } case MESA_SHADER_GEOMETRY: MERGE_SCRATCH_ADDR(3DSTATE_GS); break; } } else {