anv, iris: fix MOCS Index setting of EXECUTE_INDIRECT_* commands

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: d1109f67bb ("iris: Emit EXECUTE_INDIRECT_DRAW when available")
Fixes: d161e3c2e2 ("iris: Emit a EXECUTE_INDIRECT_DISPATCH when available")
Fixes: 580728564e ("anv: Emit a EXECUTE_INDIRECT_DISPATCH when available")
Fixes: 6d4f43f0d6 ("anv: Emit EXECUTE_INDIRECT_DRAW when available")
Fixes: 7a9e82e82f ("genxml/12.5: Add the EXECUTE_INDIRECT_DISPATCH instruction")
Fixes: 4229757309 ("genxml/12.5: Add the EXECUTE_INDIRECT_DRAW instruction")
Signed-off-by: Iván Briano <ivan.briano@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41372>
This commit is contained in:
Iván Briano 2026-05-14 14:02:52 -07:00 committed by Marge Bot
parent 7b26ff692b
commit b420958166
6 changed files with 12 additions and 12 deletions

View file

@ -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)

View file

@ -1966,7 +1966,7 @@
<instruction name="EXECUTE_INDIRECT_DISPATCH" bias="2" length="44" engine="render|compute">
<field name="DWord Length" dword="0" bits="7:0" type="uint" default="42" />
<field name="Predicate Enable" dword="0" bits="8:8" type="bool" />
<field name="MOCS" dword="0" bits="15:12" type="uint" nonzero="true" />
<field name="MOCS Index" dword="0" bits="15:12" type="uint" nonzero="true" />
<field name="3D Command Sub Opcode" dword="0" bits="23:16" type="uint" default="1" />
<field name="3D Command Opcode" dword="0" bits="26:24" type="uint" default="4" />
<field name="Command SubType" dword="0" bits="28:27" type="uint" default="3" />
@ -1987,7 +1987,7 @@
<value name="MESH_3D" value="2" />
<value name="MESH_1D" value="3" />
</field>
<field name="MOCS" dword="0" bits="15:12" type="uint" nonzero="true" />
<field name="MOCS Index" dword="0" bits="15:12" type="uint" nonzero="true" />
<field name="3D Command Sub Opcode" dword="0" bits="23:16" type="uint" default="0" />
<field name="3D Command Opcode" dword="0" bits="26:24" type="uint" default="4" />
<field name="Command SubType" dword="0" bits="28:27" type="uint" default="3" />

View file

@ -1520,7 +1520,7 @@
<instruction name="EXECUTE_INDIRECT_DISPATCH" bias="2" length="45" engine="render|compute">
<field name="DWord Length" dword="0" bits="7:0" type="uint" default="43" />
<field name="Predicate Enable" dword="0" bits="8:8" type="bool" />
<field name="MOCS" dword="0" bits="15:12" type="uint" nonzero="true" />
<field name="MOCS Index" dword="0" bits="15:12" type="uint" nonzero="true" />
<field name="3D Command Sub Opcode" dword="0" bits="23:16" type="uint" default="1" />
<field name="3D Command Opcode" dword="0" bits="26:24" type="uint" default="4" />
<field name="Command SubType" dword="0" bits="28:27" type="uint" default="3" />

View file

@ -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,

View file

@ -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);

View file

@ -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));
}