<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 21, 2017 at 8:00 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">See brw_miptree_choose_tiling().<br>
<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/<wbr>intel_mipmap_tree.c | 36 +++++++++++++++++++++++++++<br>
 1 file changed, 36 insertions(+)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
index 3cbdf3c938..cc0e58b74a 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
@@ -719,6 +719,29 @@ free_aux_state_map(enum isl_aux_state **state)<br>
    free(state);<br>
 }<br>
<br>
+static bool<br>
+need_to_retile_as_linear(<wbr>struct brw_context *brw, unsigned row_pitch,<br>
+                         enum isl_tiling tiling, unsigned samples)<br>
+{<br>
+   if (samples > 1)<br>
+      return false;<br>
+<br>
+   if (tiling == ISL_TILING_LINEAR)<br>
+      return false;<br>
+<br>
+    /* If the width is much smaller than a tile, don't bother tiling. */<br>
+   if (row_pitch < 64)<br>
+      return true;<br>
+<br>
+   if (ALIGN(row_pitch, 512) >= 32768) {<br>
+      perf_debug("row pitch %u too large to blit, falling back to untiled",<br>
+                 row_pitch);<br>
+      return true;<br>
+   }<br></blockquote><div><br></div><div>You're missing the gen6 fall-back to X<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   return false;<br>
+}<br>
+<br>
 static struct intel_mipmap_tree *<br>
 make_surface(struct brw_context *brw, GLenum target, mesa_format format,<br>
              unsigned first_level, unsigned last_level,<br>
@@ -767,6 +790,19 @@ make_surface(struct brw_context *brw, GLenum target, mesa_format format,<br>
    if (!isl_surf_init_s(&brw->isl_<wbr>dev, &mt->surf, &init_info))<br>
       goto fail;<br>
<br>
+   /* In case caller doesn't specifically request Y-tiling (needed<br>
+    * unconditionally for depth), check for corner cases needing special<br>
+    * treatment.<br>
+    */<br>
+   if (tiling_flags & ~ISL_TILING_Y0_BIT) {<br>
+      if (need_to_retile_as_linear(brw, mt->surf.row_pitch,<br>
+                                   mt->surf.tiling, mt->surf.samples)) {<br>
+         init_info.tiling_flags = 1u << ISL_TILING_LINEAR;<br></blockquote><div><br></div><div>We have TILING_LINEAR_BIT for this.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+         if (!isl_surf_init_s(&brw->isl_<wbr>dev, &mt->surf, &init_info))<br>
+            goto fail;<br>
+      }<br>
+   }<br>
+<br>
    assert(mt->surf.size % mt->surf.row_pitch == 0);<br>
<br>
    if (!bo) {<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>