*/
ISL_AUX_USAGE_MC,
- /** The auxiliary surface is a HiZ surface and CCS is also enabled */
+ /** The auxiliary surface is a HiZ surface operating in write-through mode
+ * and CCS is also enabled
+ *
+ * In this mode, the HiZ and CCS surfaces act as a single fused compression
+ * surface where resolves and ambiguates operate on both surfaces at the
+ * same time. In this mode, the HiZ surface operates in write-through
+ * mode where it is only used for accelerating depth testing and not for
+ * actual compression. The CCS-compressed surface contains valid data at
+ * all times.
+ *
+ * @invariant isl_surf::samples == 1
+ */
+ ISL_AUX_USAGE_HIZ_CCS_WT,
+
+ /** The auxiliary surface is a HiZ surface with and CCS is also enabled
+ *
+ * In this mode, the HiZ and CCS surfaces act as a single fused compression
+ * surface where resolves and ambiguates operate on both surfaces at the
+ * same time. In this mode, full HiZ compression is enabled and the
+ * CCS-compressed main surface may not contain valid data. The only way to
+ * read the surface outside of the depth hardware is to do a full resolve
+ * which resolves both HiZ and CCS so the surface is in the pass-through
+ * state.
+ */
ISL_AUX_USAGE_HIZ_CCS,
/** The auxiliary surface is an MCS and CCS is also enabled
isl_aux_usage_has_hiz(enum isl_aux_usage usage)
{
return usage == ISL_AUX_USAGE_HIZ ||
+ usage == ISL_AUX_USAGE_HIZ_CCS_WT ||
usage == ISL_AUX_USAGE_HIZ_CCS;
}
return usage == ISL_AUX_USAGE_CCS_D ||
usage == ISL_AUX_USAGE_CCS_E ||
usage == ISL_AUX_USAGE_MC ||
+ usage == ISL_AUX_USAGE_HIZ_CCS_WT ||
usage == ISL_AUX_USAGE_HIZ_CCS ||
usage == ISL_AUX_USAGE_MCS_CCS;
}
/* write_behavior c fc pr fra */
AUX( COMPRESS, Y, Y, x, x, HIZ)
AUX( COMPRESS, Y, Y, x, x, HIZ_CCS)
+ AUX( COMPRESS, Y, Y, x, x, HIZ_CCS_WT)
AUX( COMPRESS, Y, Y, Y, x, MCS)
AUX( COMPRESS, Y, Y, Y, x, MCS_CCS)
AUX( COMPRESS, Y, Y, Y, Y, CCS_E)
#if GEN_GEN >= 12
db.ControlSurfaceEnable = db.DepthBufferCompressionEnable =
- info->hiz_usage == ISL_AUX_USAGE_HIZ_CCS;
+ isl_aux_usage_has_ccs(info->hiz_usage);
#endif
}
};
assert(info->hiz_usage == ISL_AUX_USAGE_NONE ||
- info->hiz_usage == ISL_AUX_USAGE_HIZ ||
- info->hiz_usage == ISL_AUX_USAGE_HIZ_CCS);
- if (info->hiz_usage == ISL_AUX_USAGE_HIZ ||
- info->hiz_usage == ISL_AUX_USAGE_HIZ_CCS) {
+ isl_aux_usage_has_hiz(info->hiz_usage));
+ if (isl_aux_usage_has_hiz(info->hiz_usage)) {
assert(GEN_GEN >= 12 || info->hiz_usage == ISL_AUX_USAGE_HIZ);
db.HierarchicalDepthBufferEnable = true;
#if GEN_GEN >= 12
hiz.HierarchicalDepthBufferWriteThruEnable =
isl_surf_supports_hiz_ccs_wt(dev->info, info->depth_surf,
- info->hiz_usage);
+ info->hiz_usage) ||
+ info->hiz_usage == ISL_AUX_USAGE_HIZ_CCS_WT;
+
+ /* The bspec docs for this bit are fairly unclear about exactly what is
+ * and isn't supported with HiZ write-through. It's fairly clear that
+ * you can't sample from a multisampled depth buffer with CCS. This
+ * limitation isn't called out explicitly but the docs for the CCS_E
+ * value of RENDER_SURFACE_STATE::AuxiliarySurfaceMode say:
+ *
+ * "If Number of multisamples > 1, programming this value means MSAA
+ * compression is enabled for that surface. Auxillary surface is MSC
+ * with tile y."
+ *
+ * Since this interpretation ignores whether the surface is
+ * depth/stencil or not and since multisampled depth buffers use
+ * ISL_MSAA_LAYOUT_INTERLEAVED which is incompatible with MCS
+ * compression, this means that we can't even specify MSAA depth CCS in
+ * RENDER_SURFACE_STATE::AuxiliarySurfaceMode. The BSpec also says, for
+ * 3DSTATE_HIER_DEPTH_BUFFER::HierarchicalDepthBufferWriteThruEnable,
+ *
+ * "This bit must NOT be set for >1x MSAA modes, since sampler
+ * doesn't support sampling from >1x MSAA depth buffer."
+ *
+ * Again, this is all focused around what the sampler can do and not
+ * what the depth hardware can do.
+ *
+ * Reading even more internal docs which can't be quoted here makes it
+ * pretty clear that, even if it's not currently called out in the
+ * BSpec, HiZ+CCS write-through isn't intended to work with MSAA and we
+ * shouldn't try to use it. Treat it as if it's disallowed even if the
+ * BSpec doesn't explicitly document that.
+ */
+ if (hiz.HierarchicalDepthBufferWriteThruEnable)
+ assert(info->depth_surf->samples == 1);
#endif
#if GEN_GEN >= 8
[ISL_AUX_USAGE_NONE] = AUX_NONE,
[ISL_AUX_USAGE_MCS] = AUX_CCS_E,
[ISL_AUX_USAGE_CCS_E] = AUX_CCS_E,
+ [ISL_AUX_USAGE_HIZ_CCS_WT] = AUX_CCS_E,
[ISL_AUX_USAGE_MCS_CCS] = AUX_MCS_LCE,
};
#elif GEN_GEN >= 9
if (GEN_GEN >= 12) {
assert(info->aux_usage == ISL_AUX_USAGE_MCS ||
info->aux_usage == ISL_AUX_USAGE_CCS_E ||
+ info->aux_usage == ISL_AUX_USAGE_HIZ_CCS_WT ||
info->aux_usage == ISL_AUX_USAGE_MCS_CCS);
} else if (GEN_GEN >= 9) {
assert(info->aux_usage == ISL_AUX_USAGE_HIZ ||
*/
assert(!(info->view->usage & ISL_SURF_USAGE_STORAGE_BIT));
- if (info->aux_usage == ISL_AUX_USAGE_HIZ) {
- /* The number of samples must be 1 */
+ if (isl_aux_usage_has_hiz(info->aux_usage)) {
+ /* For Gen8-10, there are some restrictions around sampling from HiZ.
+ * The Skylake PRM docs for RENDER_SURFACE_STATE::AuxiliarySurfaceMode
+ * say:
+ *
+ * "If this field is set to AUX_HIZ, Number of Multisamples must
+ * be MULTISAMPLECOUNT_1, and Surface Type cannot be SURFTYPE_3D."
+ *
+ * On Gen12, the docs are a bit less obvious but the restriction is
+ * the same. The limitation isn't called out explicitly but the docs
+ * for the CCS_E value of RENDER_SURFACE_STATE::AuxiliarySurfaceMode
+ * say:
+ *
+ * "If Number of multisamples > 1, programming this value means
+ * MSAA compression is enabled for that surface. Auxillary surface
+ * is MSC with tile y."
+ *
+ * Since this interpretation ignores whether the surface is
+ * depth/stencil or not and since multisampled depth buffers use
+ * ISL_MSAA_LAYOUT_INTERLEAVED which is incompatible with MCS
+ * compression, this means that we can't even specify MSAA depth CCS
+ * in RENDER_SURFACE_STATE::AuxiliarySurfaceMode.
+ */
assert(info->surf->samples == 1);
/* The dimension must not be 3D */