[Mesa-dev] [PATCH V2 02/11] isl: Update isl_surf_get_hiz_surf()

Nanley Chery nanleychery at gmail.com
Tue Sep 27 00:10:16 UTC 2016


From: Nanley Chery <nanleychery at gmail.com>

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>
Reviewed-by: Chad Versace <chadversary at chromium.org>
---

Note: This patch will have to be rebased if/when the following series
lands upstream before this series:

https://lists.freedesktop.org/archives/mesa-dev/2016-September/128761.html

 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 b6e88ad..c68ab45 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1287,27 +1287,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.10.0



More information about the mesa-dev mailing list