iris: Set MOCS on 3DSTATE_CONSTANT_ALL packets that disable all buffers
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 19 Oct 2021 12:31:55 +0000 (05:31 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 28 Oct 2021 19:45:55 +0000 (19:45 +0000)
We'd like to add safeguards against accidental use of MOCS 0 (uncached),
which can have large performance implications.  One case where we missed
setting a non-zero MOCS was in 3DSTATE_CONSTANT_ALL packets which fully
disable all constant buffers.  (If any constant buffer was present, we
would set an actual MOCS value.)

MOCS really shouldn't matter here, as there are no actual constant
buffers to be cached.  That said, it should be harmless to do so, and
we can just assume a generic MOCS for internal buffers.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13480>

src/gallium/drivers/iris/iris_state.c

index 841365d..7515452 100644 (file)
@@ -5550,6 +5550,7 @@ emit_push_constant_packet_all(struct iris_context *ice,
    if (!push_bos) {
       iris_emit_cmd(batch, GENX(3DSTATE_CONSTANT_ALL), pc) {
          pc.ShaderUpdateEnable = shader_mask;
+         pc.MOCS = iris_mocs(NULL, isl_dev, 0);
       }
       return;
    }