[Mesa-dev] [PATCH 02/12] isl: Update isl_surf_get_hiz_surf()
Nanley Chery
nanleychery at gmail.com
Thu Sep 1 03:29:48 UTC 2016
Modify extents and dimensions to match the PRMs more closely. Along with
being able to create the correct 3D surface this enables us to avoid working
with multisampled compressed textures.
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
src/intel/isl/isl.c | 39 +++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index c4989dd..1664dbf 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1259,27 +1259,54 @@ isl_surf_get_tile_info(const struct isl_device *dev,
isl_tiling_get_info(dev, surf->tiling, fmtl->bpb, tile_info);
}
+/**
+ * \todo Implement the correct dimensions pre-BDW.
+ */
void
isl_surf_get_hiz_surf(const struct isl_device *dev,
const struct isl_surf *surf,
struct isl_surf *hiz_surf)
{
+ assert(surf->usage & ISL_SURF_USAGE_DEPTH_BIT);
+ assert(surf->usage & ~ISL_SURF_USAGE_DISABLE_AUX_BIT);
+
assert(ISL_DEV_GEN(dev) >= 5 && ISL_DEV_USE_SEPARATE_STENCIL(dev));
/* Multisampled depth is always interleaved */
assert(surf->msaa_layout == ISL_MSAA_LAYOUT_NONE ||
surf->msaa_layout == ISL_MSAA_LAYOUT_INTERLEAVED);
+ uint32_t width, height;
+
+ /* On SKL+, one HiZ sample maps to one depth pixel and
+ * and the miplayout is recalculated.
+ */
+ if (ISL_DEV_GEN(dev) >= 9) {
+ width = surf->logical_level0_px.width;
+ height = surf->logical_level0_px.height;
+ } else {
+ /* On BDW+, one HiZ sample maps to one depth sample and
+ * and the miplayout is recalculated.
+ */
+ width = surf->phys_level0_sa.width;
+ height = surf->phys_level0_sa.height;
+ }
+
isl_surf_init(dev, hiz_surf,
- .dim = ISL_SURF_DIM_2D,
+ /* The layout of a 2D HiZ surface is identical to that of a
+ * 1D HiZ surface HSW+. Since ISL doesn't support compressed
+ * 1D surfaces currently and it is not yet needed, change the
+ * dimension for now.
+ */
+ .dim = surf->dim == ISL_SURF_DIM_1D ?
+ ISL_SURF_DIM_2D : surf->dim,
.format = ISL_FORMAT_HIZ,
- .width = surf->logical_level0_px.width,
- .height = surf->logical_level0_px.height,
- .depth = 1,
+ .width = width,
+ .height = height,
+ .depth = surf->logical_level0_px.depth,
.levels = surf->levels,
.array_len = surf->logical_level0_px.array_len,
- /* On SKL+, HiZ is always single-sampled */
- .samples = ISL_DEV_GEN(dev) >= 9 ? 1 : surf->samples,
+ .samples = 1,
.usage = ISL_SURF_USAGE_HIZ_BIT,
.tiling_flags = ISL_TILING_HIZ_BIT);
}
--
2.9.3
More information about the mesa-dev
mailing list