isl: Fill in MOCS even for SURFTYPE_NULL surfaces.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 19 Oct 2021 20:54:29 +0000 (13:54 -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 use
MOCS of 0 is SURFTYPE_NULL surfaces, where MOCS really shouldn't matter,
as there's no actual surface to be cached.

That said, it should be harmless to set MOCS for these null surfaces;
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/intel/isl/isl.c
src/intel/isl/isl_genX_priv.h
src/intel/isl/isl_surface_state.c

index 8844db9..62835a2 100644 (file)
@@ -2443,7 +2443,7 @@ void
 isl_null_fill_state_s(const struct isl_device *dev, void *state,
                       const struct isl_null_fill_state_info *restrict info)
 {
-   isl_genX_call(dev, null_fill_state, state, info);
+   isl_genX_call(dev, null_fill_state, dev, state, info);
 }
 
 void
index c2a9b04..5fa545a 100644 (file)
@@ -45,5 +45,5 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
                                    const struct isl_depth_stencil_hiz_emit_info *restrict info);
 
 void
-isl_genX(null_fill_state)(void *state,
+isl_genX(null_fill_state)(const struct isl_device *dev, void *state,
                           const struct isl_null_fill_state_info *restrict info);
index dbbf2de..f6e7a48 100644 (file)
@@ -986,7 +986,7 @@ isl_genX(buffer_fill_state_s)(const struct isl_device *dev, void *state,
 }
 
 void
-isl_genX(null_fill_state)(void *state,
+isl_genX(null_fill_state)(const struct isl_device *dev, void *state,
                           const struct isl_null_fill_state_info *restrict info)
 {
    struct GENX(RENDER_SURFACE_STATE) s = {
@@ -1008,6 +1008,9 @@ isl_genX(null_fill_state)(void *state,
       .TiledSurface = true,
       .TileWalk = TILEWALK_YMAJOR,
 #endif
+#if GFX_VER >= 6
+      .MOCS = isl_mocs(dev, 0, false),
+#endif
 #if GFX_VER == 7
       /* According to PRMs: "Volume 4 Part 1: Subsystem and Cores – Shared
        * Functions"