From d8e1d0fecc962152fa3543d7da4aa514a3b79638 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 19 Oct 2021 05:22:45 -0700 Subject: [PATCH] iris: Set MOCS on NULL vertex buffers We'd like to add safeguards against accidental use of MOCS 0 (uncached), which can have large performance implications. One case where we use MOCS of 0 is 3DSTATE_VERTEX_BUFFERS where we set NullVertexBuffer. It shouldn't matter here, as there's no actual buffer to be cached. That said, it should be harmless to set MOCS for null vertex buffers. We can assume an internal buffer and request isl's vertex buffer MOCS. Reviewed-by: Jason Ekstrand Part-of: --- src/gallium/drivers/iris/iris_state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 7515452049e..1c5a9ba8189 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3477,6 +3477,8 @@ iris_set_vertex_buffers(struct pipe_context *ctx, #endif } else { vb.NullVertexBuffer = true; + vb.MOCS = iris_mocs(NULL, &screen->isl_dev, + ISL_SURF_USAGE_VERTEX_BUFFER_BIT); } } }