[Mesa-dev] [PATCH v2 19/32] intel/isl: Support Ys and Yf in isl_surf_get_uncompressed_surf

Jason Ekstrand jason at jlekstrand.net
Fri Oct 12 18:46:49 UTC 2018


Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/intel/isl/isl.c | 47 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index b8af8ad1176..3d0741bc207 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -2441,7 +2441,52 @@ isl_surf_get_uncompressed_surf(const struct isl_device *dev,
    const uint32_t ucompr_width = isl_align_div_npot(view_width, fmtl->bw);
    const uint32_t ucompr_height = isl_align_div_npot(view_height, fmtl->bh);
 
-   {
+   if (isl_tiling_is_std_y(surf->tiling)) {
+      /* Offset to the given miplevel.  Because we're using standard tilings
+       * with no miptail, arrays and 3D textures should just work so long as
+       * we have the right array stride in the end.
+       */
+      isl_surf_get_image_offset_B_tile_el(surf, view->base_level, 0, 0,
+                                          offset_B, x_offset_el, y_offset_el);
+      /* Ys and Yf should have no intratile X or Y offset */
+      assert(*x_offset_el == 0 && *y_offset_el == 0);
+
+      /* Save off the array pitch */
+      const uint32_t array_pitch_el_rows = surf->array_pitch_el_rows;
+
+      const uint32_t view_depth =
+         isl_minify(surf->logical_level0_px.depth, view->base_level);
+      const uint32_t ucompr_depth = isl_align_div_npot(view_depth, fmtl->bd);
+
+      bool ok UNUSED;
+      ok = isl_surf_init(dev, ucompr_surf,
+                         .dim = surf->dim,
+                         .format = view->format,
+                         .width = ucompr_width,
+                         .height = ucompr_height,
+                         .depth = ucompr_depth,
+                         .levels = 1,
+                         .array_len = surf->logical_level0_px.array_len,
+                         .samples = surf->samples,
+                         .row_pitch_B = surf->row_pitch_B,
+                         .usage = surf->usage,
+                         .tiling_flags = (1u << surf->tiling));
+      assert(ok);
+
+      /* Use the array pitch from the original surface.  This way 2D arrays
+       * and 3D textures should work properly, just with one LOD.
+       */
+      assert(ucompr_surf->array_pitch_el_rows <= array_pitch_el_rows);
+      ucompr_surf->array_pitch_el_rows = array_pitch_el_rows;
+
+      /* The newly created image represents only the one miplevel so we
+       * need to adjust the view accordingly.  Because we offset it to
+       * miplevel but used a Z and array slice of 0, the array range can be
+       * left alone.
+       */
+      *ucompr_view = *view;
+      ucompr_view->base_level = 0;
+   } else {
       /* For legacy tilings, we just make a new 2D surface which represents
        * the single slice of the main surface.  Due to hardware restrictions
        * with intratile offsets, we can only handle a single slice.
-- 
2.19.1



More information about the mesa-dev mailing list