All that's really needed here is to handle the array offsetting by using
an Z or array offset instead of the Y offset.
---
 src/intel/isl/isl.c | 45 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 35793b3..0806474 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1987,7 +1987,9 @@ static void
 get_image_offset_sa_gen4_2d(const struct isl_surf *surf,
                             uint32_t level, uint32_t logical_array_layer,
                             uint32_t *x_offset_sa,
-                            uint32_t *y_offset_sa)
+                            uint32_t *y_offset_sa,
+                            uint32_t *z_offset_sa,
+                            uint32_t *array_offset)
 {
    assert(level < surf->levels);
    if (surf->dim == ISL_SURF_DIM_3D)
@@ -2004,8 +2006,21 @@ get_image_offset_sa_gen4_2d(const struct isl_surf *surf,
    const uint32_t phys_layer = logical_array_layer *
       (surf->msaa_layout == ISL_MSAA_LAYOUT_ARRAY ? surf->samples : 1);
 
-   uint32_t x = 0;
-   uint32_t y = phys_layer * isl_surf_get_array_pitch_sa_rows(surf);
+   uint32_t x = 0, y;
+   if (isl_tiling_is_std_y(surf->tiling)) {
+      y = 0;
+      if (surf->dim == ISL_SURF_DIM_3D) {
+         *z_offset_sa = logical_array_layer;
+         *array_offset = 0;
+      } else {
+         *z_offset_sa = 0;
+         *array_offset = phys_layer;
+      }
+   } else {
+      y = phys_layer * isl_surf_get_array_pitch_sa_rows(surf);
+      *z_offset_sa = 0;
+      *array_offset = 0;
+   }
 
    for (uint32_t l = 0; l < level; ++l) {
       if (l == 1) {
@@ -2145,7 +2160,9 @@ static void
 get_image_offset_sa_gen9_1d(const struct isl_surf *surf,
                             uint32_t level, uint32_t layer,
                             uint32_t *x_offset_sa,
-                            uint32_t *y_offset_sa)
+                            uint32_t *y_offset_sa,
+                            uint32_t *z_offset_sa,
+                            uint32_t *array_offset)
 {
    assert(level < surf->levels);
    assert(layer < surf->phys_level0_sa.array_len);
@@ -2167,7 +2184,15 @@ get_image_offset_sa_gen9_1d(const struct isl_surf *surf,
    }
 
    *x_offset_sa = x;
-   *y_offset_sa = layer * isl_surf_get_array_pitch_sa_rows(surf);
+   *z_offset_sa = 0;
+   if (surf->tiling == ISL_TILING_LINEAR) {
+      *y_offset_sa = layer * isl_surf_get_array_pitch_sa_rows(surf);
+      *array_offset = 0;
+   } else {
+      assert(isl_tiling_is_std_y(surf->tiling));
+      *y_offset_sa = 0;
+      *array_offset = layer;
+   }
 }
 
 /**
@@ -2196,16 +2221,14 @@ isl_surf_get_image_offset_sa(const struct isl_surf 
*surf,
    switch (surf->dim_layout) {
    case ISL_DIM_LAYOUT_GEN9_1D:
       get_image_offset_sa_gen9_1d(surf, level, logical_array_layer,
-                                  x_offset_sa, y_offset_sa);
-      *z_offset_sa = 0;
-      *array_offset = 0;
+                                  x_offset_sa, y_offset_sa,
+                                  z_offset_sa, array_offset);
       break;
    case ISL_DIM_LAYOUT_GEN4_2D:
       get_image_offset_sa_gen4_2d(surf, level, logical_array_layer
                                   + logical_z_offset_px,
-                                  x_offset_sa, y_offset_sa);
-      *z_offset_sa = 0;
-      *array_offset = 0;
+                                  x_offset_sa, y_offset_sa,
+                                  z_offset_sa, array_offset);
       break;
    case ISL_DIM_LAYOUT_GEN4_3D:
       get_image_offset_sa_gen4_3d(surf, level, logical_array_layer +
-- 
2.5.0.400.gff86faf

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to