<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 23, 2016 at 1:16 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">Originally re-clears where skipped but when lossless compression<br>
was introduced the re-clears where errorneously enabled also for<br>
non-compressed fast clears.<br>
<br>
Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
CC: Ben Widawsky <<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.com</a>><br>
CC: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
CC: Harri Syrja <<a href="mailto:harri.syrja@intel.com">harri.syrja@intel.com</a>><br>
Cc: Chad Versace <<a href="mailto:chad@kiwitree.net">chad@kiwitree.net</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 19 ++++++++++++++++---<br>
 1 file changed, 16 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
index 556f2c0..9a849f5 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -825,10 +825,23 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
                                     brw, &irb->mt->gen9_fast_clear_<wbr>color,<br>
                                     &override_color);<br>
<br>
-      /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, the clear<br>
-       * is redundant and can be skipped.<br>
+      /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, and the<br>
+       * buffer isn't compressed, the clear is redundant and can be skipped.<br>
+       *<br>
+       * Without compression fast clear only operates on the mcs buffer<br>
+       * recording if color values are cleared. The hardware, however,<br>
+       * doesn't write the actual color value into the mcs or color<br>
+       * buffer. Only by the time of render (inclucing color resolve) does the<br>
+       * hardware read the _current_ color value in the surface state and<br>
+       * write the actual pixel values in the color buffer accordingly.<br>
+       *<br>
+       * This seems to be the reason why sampler engine cannot handle<br>
+       * non-compressed fast clear - it doesn't know how to read the color<br>
+       * value from the surface state. With compression the color value is<br>
+       * recorded in the color buffer (only not for every pixel) and therefore<br>
+       * it is available without consulting the surface state.<br></blockquote><div><br></div><div>This doesn't jive with my understanding of fast clears on gen9.  Everything I've seen so far indicates that the clear color in the surface state *does* matter.  Otherwise, why would it be there?  In particular, my understanding of the 2-bit CCS values is that 0 means resolved, 1 means compressed and 3 means clear where "clear" means "go look at the clear color".  Have you done experiments that lead you to some other conclusion?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
        */<br>
-      if (!color_updated &&<br>
+      if ((!color_updated || !is_lossless_compressed) &&<br>
           irb->mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR)<br>
          return true;<br>
<span class="HOEnZb"><font color="#888888"><br>
--<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>