<div dir="ltr"><div>Both 7.5 and 8 are<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 12:23 AM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This helps to drop dependency to miptree::total_height which is<br>
used in brw_miptree_get_vertical_<wbr>slice_pitch().<br>
<br>
CC: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>tex_layout.c       |   2 +-<br>
 src/mesa/drivers/dri/i965/brw_<wbr>wm_surface_state.c | 100 ++++-------------------<br>
 src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h    |   9 --<br>
 3 files changed, 19 insertions(+), 92 deletions(-)<br></blockquote><div><br></div><div>It also has a nice diffstat. :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c b/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c<br>
index d06d654797..c76e87bc06 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c<br>
@@ -309,7 +309,7 @@ brw_miptree_get_horizontal_<wbr>slice_pitch(const struct brw_context *brw,<br>
    }<br>
 }<br>
<br>
-unsigned<br>
+static unsigned<br>
 brw_miptree_get_vertical_<wbr>slice_pitch(const struct brw_context *brw,<br>
                                      const struct intel_mipmap_tree *mt,<br>
                                      unsigned level)<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
index da5c5128c1..d88a2fb2be 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
@@ -1633,73 +1633,6 @@ update_buffer_image_param(<wbr>struct brw_context *brw,<br>
 }<br>
<br>
 static void<br>
-update_texture_image_param(<wbr>struct brw_context *brw,<br>
-                           struct gl_image_unit *u,<br>
-                           unsigned surface_idx,<br>
-                           struct brw_image_param *param)<br>
-{<br>
-   struct intel_mipmap_tree *mt = intel_texture_object(u-><wbr>TexObj)->mt;<br>
-<br>
-   update_default_image_param(<wbr>brw, u, surface_idx, param);<br>
-<br>
-   param->size[0] = minify(mt->logical_width0, u->Level);<br>
-   param->size[1] = minify(mt->logical_height0, u->Level);<br>
-   param->size[2] = (!u->Layered ? 1 :<br>
-                     u->TexObj->Target == GL_TEXTURE_CUBE_MAP ? 6 :<br>
-                     u->TexObj->Target == GL_TEXTURE_3D ?<br>
-                     minify(mt->logical_depth0, u->Level) :<br>
-                     mt->logical_depth0);<br>
-<br>
-   intel_miptree_get_image_<wbr>offset(mt, u->Level, u->_Layer,<br>
-                                  &param->offset[0],<br>
-                                  &param->offset[1]);<br>
-<br>
-   param->stride[0] = mt->cpp;<br>
-   param->stride[1] = mt->pitch / mt->cpp;<br>
-   param->stride[2] =<br>
-      brw_miptree_get_horizontal_<wbr>slice_pitch(brw, mt, u->Level);<br>
-   param->stride[3] =<br>
-      brw_miptree_get_vertical_<wbr>slice_pitch(brw, mt, u->Level);<br>
-<br>
-   if (mt->tiling == I915_TILING_X) {<br>
-      /* An X tile is a rectangular block of 512x8 bytes. */<br>
-      param->tiling[0] = _mesa_logbase2(512 / mt->cpp);<br>
-      param->tiling[1] = _mesa_logbase2(8);<br>
-<br>
-      if (brw->has_swizzling) {<br>
-         /* Right shifts required to swizzle bits 9 and 10 of the memory<br>
-          * address with bit 6.<br>
-          */<br>
-         param->swizzling[0] = 3;<br>
-         param->swizzling[1] = 4;<br>
-      }<br>
-   } else if (mt->tiling == I915_TILING_Y) {<br>
-      /* The layout of a Y-tiled surface in memory isn't really fundamentally<br>
-       * different to the layout of an X-tiled surface, we simply pretend that<br>
-       * the surface is broken up in a number of smaller 16Bx32 tiles, each<br>
-       * one arranged in X-major order just like is the case for X-tiling.<br>
-       */<br>
-      param->tiling[0] = _mesa_logbase2(16 / mt->cpp);<br>
-      param->tiling[1] = _mesa_logbase2(32);<br>
-<br>
-      if (brw->has_swizzling) {<br>
-         /* Right shift required to swizzle bit 9 of the memory address with<br>
-          * bit 6.<br>
-          */<br>
-         param->swizzling[0] = 3;<br>
-      }<br>
-   }<br>
-<br>
-   /* 3D textures are arranged in 2D in memory with 2^lod slices per row.  The<br>
-    * address calculation algorithm (emit_address_calculation() in<br>
-    * brw_fs_surface_builder.cpp) handles this as a sort of tiling with<br>
-    * modulus equal to the LOD.<br>
-    */<br>
-   param->tiling[2] = (u->TexObj->Target == GL_TEXTURE_3D ? u->Level :<br>
-                       0);<br>
-}<br>
-<br>
-static void<br>
 update_image_surface(struct brw_context *brw,<br>
                      struct gl_image_unit *u,<br>
                      GLenum access,<br>
@@ -1727,6 +1660,19 @@ update_image_surface(struct brw_context *brw,<br>
       } else {<br>
          struct intel_texture_object *intel_obj = intel_texture_object(obj);<br>
          struct intel_mipmap_tree *mt = intel_obj->mt;<br>
+         const unsigned num_layers = (!u->Layered ? 1 :<br>
+                                      obj->Target == GL_TEXTURE_CUBE_MAP ? 6 :<br>
+                                      mt->logical_depth0);<br>
+<br>
+         struct isl_view view = {<br>
+            .format = format,<br>
+            .base_level = obj->MinLevel + u->Level,<br>
+            .levels = 1,<br>
+            .base_array_layer = obj->MinLayer + u->_Layer,<br>
+            .array_len = num_layers,<br>
+            .swizzle = ISL_SWIZZLE_IDENTITY,<br>
+            .usage = ISL_SURF_USAGE_STORAGE_BIT,<br>
+         };<br>
<br>
          if (format == ISL_FORMAT_RAW) {<br>
             brw_emit_buffer_surface_state(<br>
@@ -1735,20 +1681,6 @@ update_image_surface(struct brw_context *brw,<br>
                access != GL_READ_ONLY);<br>
<br>
          } else {<br>
-            const unsigned num_layers = (!u->Layered ? 1 :<br>
-                                         obj->Target == GL_TEXTURE_CUBE_MAP ? 6 :<br>
-                                         mt->logical_depth0);<br>
-<br>
-            struct isl_view view = {<br>
-               .format = format,<br>
-               .base_level = obj->MinLevel + u->Level,<br>
-               .levels = 1,<br>
-               .base_array_layer = obj->MinLayer + u->_Layer,<br>
-               .array_len = num_layers,<br>
-               .swizzle = ISL_SWIZZLE_IDENTITY,<br>
-               .usage = ISL_SURF_USAGE_STORAGE_BIT,<br>
-            };<br>
-<br>
             const int surf_index = surf_offset - &brw->wm.base.surf_offset[0];<br>
             assert(!intel_miptree_has_<wbr>color_unresolved(mt,<br>
                                                        view.base_level, 1,<br>
@@ -1762,7 +1694,11 @@ update_image_surface(struct brw_context *brw,<br>
                                              I915_GEM_DOMAIN_SAMPLER);<br>
          }<br>
<br>
-         update_texture_image_param(<wbr>brw, u, surface_idx, param);<br>
+         struct isl_surf surf;<br>
+         intel_miptree_get_isl_surf(<wbr>brw, mt, &surf);<br>
+<br>
+         isl_surf_fill_image_param(&<wbr>brw->isl_dev, param, &surf, &view);<br>
+         param->surface_idx = surface_idx;<br>
       }<br>
<br>
    } else {<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
index cc896fc481..45ac5dfd38 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
@@ -976,15 +976,6 @@ brw_miptree_get_horizontal_<wbr>slice_pitch(const struct brw_context *brw,<br>
                                        const struct intel_mipmap_tree *mt,<br>
                                        unsigned level);<br>
<br>
-/**<br>
- * Vertical distance from one slice to the next in the two-dimensional miptree<br>
- * layout.<br>
- */<br>
-unsigned<br>
-brw_miptree_get_vertical_<wbr>slice_pitch(const struct brw_context *brw,<br>
-                                     const struct intel_mipmap_tree *mt,<br>
-                                     unsigned level);<br>
-<br>
 bool<br>
 brw_miptree_layout(struct brw_context *brw,<br>
                    struct intel_mipmap_tree *mt,<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
</font></span></blockquote></div><br></div></div>