From b4209581664db686a19862c28fd7f57c6a0894c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Thu, 14 May 2026 14:02:52 -0700 Subject: [PATCH] anv, iris: fix MOCS Index setting of EXECUTE_INDIRECT_* commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unlike most other things where the MOCS setting combines the MOCS Index and the protected memory bit, the EXECUTE_INDIRECT_DRAW/DISPATCH commands take only the MOCS Index, and it's limited to only 4 bits. Enabling the feature on ARL-H caused some tests to hit an assert when the MOCS selected ended up out of range. Rename the field to avoid confusion (and match documentation) and set it through a helper function that calls the same old function and shifts it down to fit. Fixes: d1109f67bb0 ("iris: Emit EXECUTE_INDIRECT_DRAW when available") Fixes: d161e3c2e2f ("iris: Emit a EXECUTE_INDIRECT_DISPATCH when available") Fixes: 580728564e5 ("anv: Emit a EXECUTE_INDIRECT_DISPATCH when available") Fixes: 6d4f43f0d6f ("anv: Emit EXECUTE_INDIRECT_DRAW when available") Fixes: 7a9e82e82f5 ("genxml/12.5: Add the EXECUTE_INDIRECT_DISPATCH instruction") Fixes: 4229757309a ("genxml/12.5: Add the EXECUTE_INDIRECT_DRAW instruction") Signed-off-by: Iván Briano Reviewed-by: Lionel Landwerlin Reviewed-by: Tapani Pälli Part-of: --- src/gallium/drivers/iris/iris_state.c | 8 ++++---- src/intel/genxml/gen125.xml | 4 ++-- src/intel/genxml/xe2.xml | 2 +- src/intel/vulkan/genX_cmd_buffer.c | 2 +- src/intel/vulkan/genX_cmd_compute.c | 4 ++-- src/intel/vulkan/genX_cmd_draw.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 3beeea937b1..aa61a583a70 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -8834,9 +8834,9 @@ iris_upload_indirect_render_state(struct iris_context *ice, if (indirect->buffer) { struct iris_bo *bo = iris_resource_bo(indirect->buffer); ind.ArgumentBufferStartAddress = ro_bo(bo, indirect->offset); - ind.MOCS = iris_mocs(bo, &screen->isl_dev, 0); + ind.MOCSIndex = MOCS_GET_INDEX(iris_mocs(bo, &screen->isl_dev, 0)); } else { - ind.MOCS = iris_mocs(NULL, &screen->isl_dev, 0); + ind.MOCSIndex = MOCS_GET_INDEX(iris_mocs(NULL, &screen->isl_dev, 0)); } if (indirect->indirect_draw_count) { @@ -9207,8 +9207,8 @@ struct GENX(COMPUTE_WALKER_BODY) body = { ind.MaxCount = 1; ind.body = body; ind.ArgumentBufferStartAddress = indirect_bo; - ind.MOCS = - iris_mocs(indirect_bo.bo, &screen->isl_dev, 0); + ind.MOCSIndex = + MOCS_GET_INDEX(iris_mocs(indirect_bo.bo, &screen->isl_dev, 0)); } } else { if (grid->indirect) diff --git a/src/intel/genxml/gen125.xml b/src/intel/genxml/gen125.xml index 1806396192f..74f042c27b6 100644 --- a/src/intel/genxml/gen125.xml +++ b/src/intel/genxml/gen125.xml @@ -1966,7 +1966,7 @@ - + @@ -1987,7 +1987,7 @@ - + diff --git a/src/intel/genxml/xe2.xml b/src/intel/genxml/xe2.xml index a0984f6c450..b71ca73e9f6 100644 --- a/src/intel/genxml/xe2.xml +++ b/src/intel/genxml/xe2.xml @@ -1520,7 +1520,7 @@ - + diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 0dffadeb66d..df04e16f616 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -7384,7 +7384,7 @@ void genX(cmd_emit_timestamp)(struct anv_batch *batch, GENX(EXECUTE_INDIRECT_DISPATCH_pack) (batch, dwords, &(struct GENX(EXECUTE_INDIRECT_DISPATCH)) { - .MOCS = anv_mocs(device, NULL, 0), + .MOCSIndex = MOCS_GET_INDEX(anv_mocs(device, NULL, 0)), .body = { .PostSync = (struct GENX(POSTSYNC_DATA)) { .Operation = WriteTimestamp, diff --git a/src/intel/vulkan/genX_cmd_compute.c b/src/intel/vulkan/genX_cmd_compute.c index 4baebe07cce..9df9f8a0334 100644 --- a/src/intel/vulkan/genX_cmd_compute.c +++ b/src/intel/vulkan/genX_cmd_compute.c @@ -552,8 +552,8 @@ emit_indirect_compute_walker(struct anv_cmd_buffer *cmd_buffer, .MaxCount = 1, .body = body, .ArgumentBufferStartAddress = indirect_addr, - .MOCS = anv_mocs(cmd_buffer->device, - indirect_addr.bo, 0), + .MOCSIndex = MOCS_GET_INDEX(anv_mocs(cmd_buffer->device, + indirect_addr.bo, 0)), ); cmd_buffer_post_dispatch_wa(cmd_buffer); diff --git a/src/intel/vulkan/genX_cmd_draw.c b/src/intel/vulkan/genX_cmd_draw.c index 061f7455a55..d86a7a0ef12 100644 --- a/src/intel/vulkan/genX_cmd_draw.c +++ b/src/intel/vulkan/genX_cmd_draw.c @@ -2032,8 +2032,8 @@ genX(cmd_buffer_emit_execute_indirect_draws)(struct anv_cmd_buffer *cmd_buffer, ind.ArgumentBufferStartAddress = draw; ind.CountBufferAddress = count_addr; ind.CountBufferIndirectEnable = !anv_address_is_null(count_addr); - ind.MOCS = - anv_mocs(cmd_buffer->device, draw.bo, 0); + ind.MOCSIndex = + MOCS_GET_INDEX(anv_mocs(cmd_buffer->device, draw.bo, 0)); }