i965/miptree: Add support for imported bo offsets for isl based
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Wed, 28 Jun 2017 05:56:26 +0000 (08:56 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Thu, 20 Jul 2017 08:32:21 +0000 (11:32 +0300)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index c2d5eafa51029bd2b23d31cfd2a86f671c4511ba..619b00567ed37932c1d2306ec8deed7064cf4820 100644 (file)
@@ -1453,9 +1453,22 @@ intel_miptree_get_image_offset(const struct intel_mipmap_tree *mt,
                               GLuint level, GLuint slice,
                               GLuint *x, GLuint *y)
 {
+   if (level == 0 && slice == 0) {
+      *x = mt->level[0].level_x;
+      *y = mt->level[0].level_y;
+      return;
+   }
+
    if (mt->surf.size > 0) {
       uint32_t x_offset_sa, y_offset_sa;
 
+      /* Miptree itself can have an offset only if it represents a single
+       * slice in an imported buffer object.
+       * See intel_miptree_create_for_dri_image().
+       */
+      assert(mt->level[0].level_x == 0);
+      assert(mt->level[0].level_y == 0);
+
       /* Given level is relative to level zero while the miptree may be
        * represent just a subset of all levels starting from 'first_level'.
        */