[Mesa-dev] [v3 15/19] i965/miptree: Add option to resolve offsets using isl_surf

Topi Pohjolainen topi.pohjolainen at gmail.com
Mon May 15 12:08:05 UTC 2017


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 20 ++++++++++++++++++++
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 21 +++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 4804d25..9f7c7fc 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1130,6 +1130,26 @@ intel_miptree_get_image_offset(const struct intel_mipmap_tree *mt,
 			       GLuint level, GLuint slice,
 			       GLuint *x, GLuint *y)
 {
+   if (mt->surf.size > 0) {
+      uint32_t x_offset_sa, y_offset_sa;
+
+      if (mt->array_layout == GEN6_BACK_TO_BACK) {
+         gen6_back_to_back_offset(&mt->surf, level, slice,
+                                  &x_offset_sa, &y_offset_sa);
+
+      } else {
+         const unsigned z = mt->surf.dim == ISL_SURF_DIM_3D ? slice : 0;
+         slice = mt->surf.dim == ISL_SURF_DIM_3D ? 0 : slice;
+         isl_surf_get_image_offset_sa(&mt->surf, level, slice, z,
+                                      &x_offset_sa, &y_offset_sa);
+
+      }
+
+      *x = x_offset_sa;
+      *y = y_offset_sa;
+      return;
+   }
+
    assert(slice < mt->level[level].depth);
 
    *x = mt->level[level].slice[slice].x_offset;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 5269a5e..691ff2c 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -251,6 +251,27 @@ enum miptree_array_layout {
     *   +---+
     */
    ALL_SLICES_AT_EACH_LOD,
+
+   /* Similar to ALL_SLICES_AT_EACH_LOD but simply stacking all levels one
+    * after another.
+    *
+    *   +----------+
+    *   |          |
+    *   |          |
+    *   +----------+
+    *   |          |
+    *   |          |
+    *   +----------+
+    *   +---+
+    *   |   |
+    *   +---+
+    *   |   |
+    *   +---+
+    *   +-+
+    *   +-+
+    *   +-+
+    */
+   GEN6_BACK_TO_BACK,
 };
 
 enum intel_aux_disable {
-- 
2.9.3



More information about the mesa-dev mailing list