anv: Fix MI_ARB_CHECK calls in generated indirect draws optimization
authorSviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Wed, 29 Nov 2023 22:42:07 +0000 (00:42 +0200)
committerEric Engestrom <eric@engestrom.ch>
Tue, 5 Dec 2023 14:34:03 +0000 (14:34 +0000)
commitd6711f9e2d8879947d1c092511014b7755d30ea7
tree1de998266b6d395ff8bce663b0f76f76ff98c030
parent50cbb6ae23f674679c0606f904942cce46156d48
anv: Fix MI_ARB_CHECK calls in generated indirect draws optimization

According to PRMs, to use self-modifying code correctly we have to
disable preparser before jumping to the generated commands, and re-enable
it with a first command in that buffer.

Old implementation did it wrong: for both inplace and inring generation
it disabled preparser before running the generation shader, had it
disabled during generation, and re-enabled it just before jumping to
the generated commands.

This usually didn't cause any trouble, because the generation shader and
generated draws are in different BOs, and the jump distance is greater than
the command FIFO depth. But we allocate them from the same pool,
so there are rare cases where the end of the BO with generation commands,
and the beginning of the BO with generated draws are adjacent. In such
cases, the wrong commands might be fetched.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10162
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26427>
(cherry picked from commit 5cb20b5edc6e6fcde49490bb6ac832023d001e5b)
.pick_status.json
src/intel/vulkan/genX_cmd_draw_generated_indirect.h