<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 2, 2016 at 12:45 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>
CC: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
---<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 35 ++++++++++++++++++++++++---<br>
1 file changed, 32 insertions(+), 3 deletions(-)<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 7a03597..357e587 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>
@@ -1566,6 +1566,35 @@ intel_miptree_alloc_mcs(struct brw_context *brw,<br>
return mt->mcs_mt;<br>
}<br>
<br>
+static unsigned<br>
+intel_miptree_non_msrt_<wbr>aligned_width(const struct brw_context *brw,<br>
+ const struct intel_mipmap_tree *mt)<br>
+{<br>
+ const bool mip_mapped = mt->first_level != 0 || mt->last_level != 0;<br>
+<br>
+ if (!mip_mapped)<br>
+ return mt->logical_width0;<br>
+<br>
+ if (brw->gen < 8)<br>
+ unreachable("mipmapped fast clear is only supported for gen8+");<br>
+<br>
+ /* From the BSpec: GT - Shared Functions - vol5c Shared Functions -<br>
+ * RENDER_SURFACE_STATE [BDW+] Issues Info 2:<br>
+ *<br>
+ * PRE-SKL<br>
+ * For non-multisampled render target's auxiliary surface, MCS, QPitch<br>
+ * must be computed with Horizontal Alignment = 256 and Surface Vertical<br>
+ * Alignment = 128. These alignments are only for MCS buffer and not for<br>
+ * associated render target.<br>
+ *<br>
+ * SKL+<br>
+ * For non-multisampled render target's CCS auxiliary surface, QPitch<br>
+ * must be computed with Horizontal Alignment = 128 and Surface Vertical<br>
+ * Alignment = 256. These alignments are only for CCS buffer and not for<br>
+ * associated render target.<br>
+ */<br>
+ return ALIGN(mt->logical_width0, brw->gen >= 9 ? 128 : 256);<br>
+}<br>
<br>
bool<br>
intel_miptree_alloc_non_msrt_<wbr>mcs(struct brw_context *brw,<br>
@@ -1602,9 +1631,9 @@ intel_miptree_alloc_non_msrt_<wbr>mcs(struct brw_context *brw,<br>
if (brw->gen >= 9)<br>
height_divisor /= 2;<br>
<br>
- unsigned mcs_width =<br>
- ALIGN(mt->logical_width0, width_divisor) / width_divisor;<br>
- unsigned mcs_height =<br>
+ const unsigned width = intel_miptree_non_msrt_<wbr>aligned_width(brw, mt);<br>
+ const unsigned mcs_width = ALIGN(width, width_divisor) / width_divisor;<br>
+ const unsigned mcs_height =<br>
ALIGN(mt->logical_height0, height_divisor) / height_divisor;<br></blockquote><div><br></div><div>This isn't the right place to be applying the alignment. It needs to be applied to each miplevel as the layout is calculated.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
assert(mt->logical_depth0 == 1);<br>
uint32_t layout_flags = MIPTREE_LAYOUT_TILING_Y;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
</font></span></blockquote></div><br></div></div>