[Mesa-dev] [PATCH 11/21] intel/isl: Use the depth field of phys_level0_sa for GEN4_2D 3D surfaces

Jason Ekstrand jason at jlekstrand.net
Fri Feb 23 07:06:51 UTC 2018


This makes things a tiny bit stickier in isl_calc_phys_total_extent_el
but will be worth it when we enable Yf and Ys.
---
 src/intel/isl/isl.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 68a92b8..d3efc76 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -827,21 +827,10 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev,
          unreachable("bad isl_dim_layout");
 
       case ISL_DIM_LAYOUT_GEN4_2D:
-         assert(ISL_DEV_GEN(dev) >= 9);
-
+      case ISL_DIM_LAYOUT_GEN4_3D:
          *phys_level0_sa = (struct isl_extent4d) {
             .w = isl_align_npot(info->width, fmtl->bw),
             .h = isl_align_npot(info->height, fmtl->bh),
-            .d = 1,
-            .a = info->depth,
-         };
-         break;
-
-      case ISL_DIM_LAYOUT_GEN4_3D:
-         assert(ISL_DEV_GEN(dev) < 9);
-         *phys_level0_sa = (struct isl_extent4d) {
-            .w = isl_align(info->width, fmtl->bw),
-            .h = isl_align(info->height, fmtl->bh),
             .d = info->depth,
             .a = 1,
          };
@@ -968,8 +957,6 @@ isl_calc_phys_slice0_extent_sa_gen4_2d(
 {
    const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
 
-   assert(phys_level0_sa->depth == 1);
-
    if (info->levels == 1) {
       /* Do not pad the surface to the image alignment. Instead, pad it only
        * to the pixel format's block alignment.
@@ -1052,9 +1039,10 @@ isl_calc_phys_total_extent_el_gen4_2d(
                                            image_align_sa, phys_level0_sa,
                                            array_pitch_span,
                                            &phys_slice0_sa);
+   uint32_t array_len = MAX(phys_level0_sa->d, phys_level0_sa->a);
    *phys_total_el = (struct isl_extent4d) {
       .w = isl_assert_div(phys_slice0_sa.w, fmtl->bw),
-      .h = *array_pitch_el_rows * (phys_level0_sa->array_len - 1) +
+      .h = *array_pitch_el_rows * (array_len - 1) +
            isl_assert_div(phys_slice0_sa.h, fmtl->bh),
       .d = 1,
       .a = 1,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list