<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 13, 2017 at 12:10 PM, 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">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_blit.c | 62 ++++++++++++++++++++++++++----<wbr>----<br>
 1 file changed, 48 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_blit.c b/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
index e79e02a075..456c5e56bc 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
@@ -131,6 +131,10 @@ set_blitter_tiling(struct brw_context *brw,<br>
 static int<br>
 blt_pitch(struct intel_mipmap_tree *mt)<br>
 {<br>
+   if (mt->surf.size > 0)<br>
+      return (mt->surf.tiling != ISL_TILING_LINEAR) ?<br>
+             mt->surf.row_pitch / 4 : mt->surf.row_pitch;<br>
+<br>
    int pitch = mt->pitch;<br>
    if (mt->tiling)<br>
       pitch /= 4;<br>
@@ -171,8 +175,21 @@ get_blit_intratile_offset_el(<wbr>const struct brw_context *brw,<br>
                              uint32_t *x_offset_el,<br>
                              uint32_t *y_offset_el)<br>
 {<br>
-   enum isl_tiling tiling = intel_miptree_get_isl_tiling(<wbr>mt);<br>
-   isl_tiling_get_intratile_<wbr>offset_el(tiling, mt->cpp * 8, mt->pitch,<br>
+   unsigned cpp;<br>
+   unsigned pitch;<br>
+   enum isl_tiling tiling;<br>
+<br>
+   if (mt->surf.size > 0) {<br>
+      cpp = isl_format_get_layout(mt-><wbr>surf.format)->bpb / 8;<br>
+      pitch = mt->surf.row_pitch;<br>
+      tiling = mt->surf.tiling;<br>
+   } else {<br>
+      cpp = mt->cpp;<br>
+      pitch = mt->pitch;<br>
+      tiling = intel_miptree_get_isl_tiling(<wbr>mt);<br>
+   }<br>
+<br>
+   isl_tiling_get_intratile_<wbr>offset_el(tiling, cpp * 8, pitch,<br>
                                       total_x_offset_el, total_y_offset_el,<br>
                                       base_address_offset,<br>
                                       x_offset_el, y_offset_el);<br>
@@ -187,11 +204,11 @@ get_blit_intratile_offset_el(<wbr>const struct brw_context *brw,<br>
        * The offsets we get from ISL in the tiled case are already aligned.<br>
        * In the linear case, we need to do some of our own aligning.<br>
        */<br>
-      assert(mt->pitch % 64 == 0);<br>
+      assert(pitch % 64 == 0);<br>
       uint32_t delta = *base_address_offset & 63;<br>
-      assert(delta % mt->cpp == 0);<br>
+      assert(delta % cpp == 0);<br>
       *base_address_offset -= delta;<br>
-      *x_offset_el += delta / mt->cpp;<br>
+      *x_offset_el += delta / cpp;<br>
    } else {<br>
       assert(*base_address_offset % 4096 == 0);<br>
    }<br>
@@ -206,6 +223,17 @@ emit_miptree_blit(struct brw_context *brw,<br>
                   uint32_t width, uint32_t height,<br>
                   bool reverse, GLenum logicop)<br>
 {<br>
+   const unsigned src_cpp = src_mt->surf.size > 0 ?<br>
+      isl_format_get_layout(src_mt-><wbr>surf.format)->bpb / 8 : src_mt->cpp;<br>
+   const unsigned src_pitch =<br>
+      src_mt->surf.size > 0 ? src_mt->surf.row_pitch : src_mt->pitch;<br>
+   const unsigned dst_pitch =<br>
+      dst_mt->surf.size > 0 ? dst_mt->surf.row_pitch : dst_mt->pitch;<br>
+   const unsigned src_tiling = src_mt->surf.size > 0 ?<br>
+      isl_tiling_to_bufmgr_tiling(<wbr>src_mt->surf.tiling) : src_mt->tiling;<br>
+   const unsigned dst_tiling = dst_mt->surf.size > 0 ?<br>
+      isl_tiling_to_bufmgr_tiling(<wbr>dst_mt->surf.tiling) : dst_mt->tiling;<br></blockquote><div><br></div><div>This would be easier to read as an if/else like you did above.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
    /* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics<br>
     * Data Size Limitations):<br>
     *<br>
@@ -250,13 +278,13 @@ emit_miptree_blit(struct brw_context *brw,<br>
                                       &dst_offset, &dst_tile_x, &dst_tile_y);<br>
<br>
          if (!intelEmitCopyBlit(brw,<br>
-                                src_mt->cpp,<br>
-                                reverse ? -src_mt->pitch : src_mt->pitch,<br>
+                                src_cpp,<br>
+                                reverse ? -src_pitch : src_pitch,<br>
                                 src_mt->bo, src_mt->offset + src_offset,<br>
-                                src_mt->tiling,<br>
-                                dst_mt->pitch,<br>
+                                src_tiling,<br>
+                                dst_pitch,<br>
                                 dst_mt->bo, dst_mt->offset + dst_offset,<br>
-                                dst_mt->tiling,<br>
+                                dst_tiling,<br>
                                 src_tile_x, src_tile_y,<br>
                                 dst_tile_x, dst_tile_y,<br>
                                 chunk_w, chunk_h,<br>
@@ -327,11 +355,17 @@ intel_miptree_blit(struct brw_context *brw,<br>
    intel_miptree_access_raw(brw, src_mt, src_level, src_slice, false);<br>
    intel_miptree_access_raw(brw, dst_mt, dst_level, dst_slice, true);<br>
<br>
-   if (src_flip)<br>
-      src_y = minify(src_mt->physical_<wbr>height0, src_level - src_mt->first_level) - src_y - height;<br>
+   if (src_flip) {<br>
+      const unsigned h0 = src_mt->surf.size > 0 ?<br>
+         src_mt->surf.phys_level0_sa.<wbr>height : src_mt->physical_height0;<br>
+      src_y = minify(h0, src_level - src_mt->first_level) - src_y - height;<br>
+   }<br>
<br>
-   if (dst_flip)<br>
-      dst_y = minify(dst_mt->physical_<wbr>height0, dst_level - dst_mt->first_level) - dst_y - height;<br>
+   if (dst_flip) {<br>
+      const unsigned h0 = dst_mt->surf.size > 0 ?<br>
+         dst_mt->surf.phys_level0_sa.<wbr>height : dst_mt->physical_height0;<br>
+      dst_y = minify(h0, dst_level - dst_mt->first_level) - dst_y - height;<br>
+   }<br>
<br>
    uint32_t src_image_x, src_image_y, dst_image_x, dst_image_y;<br>
    intel_miptree_get_image_<wbr>offset(src_mt, src_level, src_slice,<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>