<div dir="ltr">Thanks for hunting this down!  Incidentally, it will get fixed by switching to blorp but we might as well merge it and fix it now.<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 24, 2016 at 4:39 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:llandwerlin@gmail.com" target="_blank">llandwerlin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Outside the shader, our actual tiling is Y0 which pitch is larger that<br>
tiling W. Inside the shader we need to bring the pitch back to tiling W.<br>
<br>
Fixes dEQP-VK.api.copy_and_blit.<wbr>image_to_image_stencil<br>
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=97448" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=97448</a><br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
---<br>
 src/intel/vulkan/anv_meta_<wbr>blit2d.c | 5 ++++-<br>
 1 file changed, 4 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_meta_<wbr>blit2d.c b/src/intel/vulkan/anv_meta_<wbr>blit2d.c<br>
index 7085f2d..b0f17b7 100644<br>
--- a/src/intel/vulkan/anv_meta_<wbr>blit2d.c<br>
+++ b/src/intel/vulkan/anv_meta_<wbr>blit2d.c<br>
@@ -914,9 +914,12 @@ build_nir_w_tiled_fetch(struct nir_builder *b, struct anv_device *device,<br>
    /* First, compute the block-aligned offset */<br>
    nir_ssa_def *x_major = nir_ushr(b, x, nir_imm_int(b, 6));<br>
    nir_ssa_def *y_major = nir_ushr(b, y, nir_imm_int(b, 6));<br>
+   /* tex_pitch is expressed in terms of 128x32 Y tiled sizes. If we want to<br>
+    * have W tiled offset, we need to bring that back to 64x64 tile sizes,<br>
+    * hence the multiplication by 32 (instead of 64). */<br></blockquote><div><br></div><div>I believe this is the correct change but not the correct comment.  Really, what's going on is that W tiles have a "physical size" of 128x32 (same as a Y tile) and a logical size of 64x64.  The calculation here needs to be using the physical size.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    nir_ssa_def *offset =<br>
       nir_iadd(b, nir_imul(b, y_major,<br>
-                              nir_imul(b, tex_pitch, nir_imm_int(b, 64))),<br>
+                              nir_imul(b, tex_pitch, nir_imm_int(b, 32))),<br>
                   nir_imul(b, x_major, nir_imm_int(b, 4096)));<br>
<br>
    /* Compute the bottom 12 bits of the offset */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
</font></span></blockquote></div><br></div></div>