[Mesa-dev] [PATCH 15/22] i965/miptree: Prepare compressed offsets for isl based

Topi Pohjolainen topi.pohjolainen at gmail.com
Tue Jul 18 08:46:25 UTC 2017


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index a0b129adb4..1b8c0da80d 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1462,6 +1462,15 @@ intel_miptree_get_image_offset(const struct intel_mipmap_tree *mt,
       isl_surf_get_image_offset_sa(&mt->surf, level, slice, z,
                                    &x_offset_sa, &y_offset_sa);
 
+      /* In case of compressed formats offsets are expected as blocks. */
+      if (mt->compressed) {
+         const struct isl_format_layout *fmtl =
+            isl_format_get_layout(mt->surf.format);
+
+         x_offset_sa /= fmtl->bw;
+         y_offset_sa /= fmtl->bh;
+      }
+
       *x = x_offset_sa;
       *y = y_offset_sa;
       return;
-- 
2.11.0



More information about the mesa-dev mailing list