isl: Fill in MOCS for NULL depth, stencil, and HiZ 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 SURFTYPE_NULL depth, stencil, and HiZ buffers, 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 now set the one provided in info->mocs regardless of whether any buffers actually exist or not. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13480>
This commit is contained in:

committed by
Marge Bot

parent
801ecb6f12
commit
c27fcb1d3b
@@ -71,6 +71,9 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
|
||||
{
|
||||
struct GENX(3DSTATE_DEPTH_BUFFER) db = {
|
||||
GENX(3DSTATE_DEPTH_BUFFER_header),
|
||||
#if GFX_VER >= 6
|
||||
.MOCS = info->mocs,
|
||||
#endif
|
||||
};
|
||||
|
||||
if (info->depth_surf) {
|
||||
@@ -118,9 +121,6 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
|
||||
db.DepthWriteEnable = true;
|
||||
#endif
|
||||
db.SurfaceBaseAddress = info->depth_address;
|
||||
#if GFX_VER >= 6
|
||||
db.MOCS = info->mocs;
|
||||
#endif
|
||||
|
||||
#if GFX_VERx10 >= 125
|
||||
db.TiledMode = isl_encode_tiling[info->depth_surf->tiling];
|
||||
@@ -160,6 +160,7 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
|
||||
#if GFX_VER >= 6
|
||||
struct GENX(3DSTATE_STENCIL_BUFFER) sb = {
|
||||
GENX(3DSTATE_STENCIL_BUFFER_header),
|
||||
sb.MOCS = info->mocs,
|
||||
};
|
||||
#else
|
||||
# define sb db
|
||||
@@ -193,9 +194,6 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
|
||||
sb.StencilBufferEnable = true;
|
||||
#endif
|
||||
sb.SurfaceBaseAddress = info->stencil_address;
|
||||
#if GFX_VER >= 6
|
||||
sb.MOCS = info->mocs;
|
||||
#endif
|
||||
sb.SurfacePitch = info->stencil_surf->row_pitch_B - 1;
|
||||
#if GFX_VER >= 8
|
||||
sb.SurfaceQPitch =
|
||||
@@ -219,6 +217,7 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
|
||||
#if GFX_VER >= 6
|
||||
struct GENX(3DSTATE_HIER_DEPTH_BUFFER) hiz = {
|
||||
GENX(3DSTATE_HIER_DEPTH_BUFFER_header),
|
||||
.MOCS = info->mocs,
|
||||
};
|
||||
struct GENX(3DSTATE_CLEAR_PARAMS) clear = {
|
||||
GENX(3DSTATE_CLEAR_PARAMS_header),
|
||||
@@ -231,7 +230,6 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
|
||||
db.HierarchicalDepthBufferEnable = true;
|
||||
|
||||
hiz.SurfaceBaseAddress = info->hiz_address;
|
||||
hiz.MOCS = info->mocs;
|
||||
hiz.SurfacePitch = info->hiz_surf->row_pitch_B - 1;
|
||||
|
||||
#if GFX_VERx10 >= 125
|
||||
|
Reference in New Issue
Block a user