<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 11, 2016 at 12:26 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">From: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
<br>
Signed-off-by: Ben Widawsky <<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 51 ++++++++++++++++++---------<br>
 1 file changed, 34 insertions(+), 17 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 f51392f..a41a654 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>
@@ -224,33 +224,50 @@ intel_miptree_supports_non_<wbr>msrt_fast_clear(struct brw_context *brw,<br>
       return false;<br>
    }<br>
<br>
+   /* Handle the hardware restrictions...<br>
+    *<br>
+    * All GENs have the following restriction: "MCS buffer for non-MSRT is<br>
+    * supported only for RT formats 32bpp, 64bpp, and 128bpp."<br>
+    *<br>
+    * From the HSW PRM Volume 7: 3D-Media-GPGPU, page 652: (Color Clear of<br>
+    * Non-MultiSampler Render Target Restrictions) Support is for non-mip-mapped<br>
+    * and non-array surface types only.<br>
+    *<br>
+    * From the BDW PRM Volume 7: 3D-Media-GPGPU, page 649: (Color Clear of<br>
+    * Non-MultiSampler Render Target Restriction). Mip-mapped and arrayed<br>
+    * surfaces are supported with MCS buffer layout with these alignments in the<br>
+    * RT space: Horizontal Alignment = 256 and Vertical Alignment = 128.<br>
+    *<br>
+    * Skylake and above (docs are currently unpublished) are similar to BDW with<br></blockquote><div><br></div><div>Heh... Old patch.  We should put in the real PRM citation.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    * looser restrictions.<br>
+    */<br>
+   const bool mip_mapped = mt->first_level != 0 || mt->last_level != 0;<br>
+   const bool arrayed = mt->physical_depth0 != 1;<br>
+<br>
    if (mt->cpp != 4 && mt->cpp != 8 && mt->cpp != 16)<br>
       return false;<br>
-   if (mt->first_level != 0 || mt->last_level != 0) {<br>
-      if (brw->gen >= 8) {<br>
+<br>
+   if (mip_mapped || arrayed) {<br>
+      /* Multisample surfaces with the CMS layout are not layered surfaces, yet<br>
+       * still have physical_depth0 > 1. Assert that we don't accidentally<br>
+       * reject a multisampled surface here. We should have rejected it earlier<br>
+       * by explicitly checking the sample count.<br>
+       */<br>
+      if (arrayed)<br>
+         assert(mt->num_samples <= 1);<br>
+<br>
+      if (mip_mapped && brw->gen >= 8) {<br>
          perf_debug("Multi-LOD fast clear - giving up (%dx%dx%d).\n",<br>
                     mt->logical_width0, mt->logical_height0, mt->last_level);<br>
+         return false;<br>
       }<br>
<br>
-      return false;<br>
-   }<br>
-<br>
-   /* Check for layered surfaces. */<br>
-   if (mt->physical_depth0 != 1) {<br>
-       /* Multisample surfaces with the CMS layout are not layered surfaces,<br>
-        * yet still have physical_depth0 > 1. Assert that we don't<br>
-        * accidentally reject a multisampled surface here. We should have<br>
-        * rejected it earlier by explicitly checking the sample count.<br>
-        */<br>
-      assert(mt->num_samples <= 1);<br>
-<br>
-      if (brw->gen >= 8) {<br>
+      if (arrayed && brw->gen >= 8) {<br>
          perf_debug("Layered fast clear - giving up. (%dx%d%d)\n",<br>
                     mt->logical_width0, mt->logical_height0,<br>
                     mt->physical_depth0);<br>
+         return false;<br>
       }<br>
-<br>
-      return false;<br>
    }<br>
<br>
    /* There's no point in using an MCS buffer if the surface isn't in a<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<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>