<p dir="ltr"></p>
<p dir="ltr">On Nov 24, 2016 8:42 AM, "Ben Widawsky" <<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.com</a>> wrote:<br>
><br>
> On 16-11-23 12:04:02, Jason Ekstrand wrote:<br>
>><br>
>> On Wed, Nov 23, 2016 at 10:16 AM, Pohjolainen, Topi <<br>
>> <a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a>> wrote:<br>
>><br>
>>> On Wed, Nov 23, 2016 at 09:05:39AM -0800, Jason Ekstrand wrote:<br>
>>> >    On Wed, Nov 23, 2016 at 1:16 AM, Topi Pohjolainen<br>
>>> >    <[1]<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a>> wrote:<br>
>>> ><br>
>>> >      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>
>>> >      Signed-off-by: Topi Pohjolainen <[2]<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
>>> >      CC: Ben Widawsky <[3]<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.com</a>><br>
>>> >      CC: Kenneth Graunke <[4]<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
>>> >      CC: Harri Syrja <[5]<a href="mailto:harri.syrja@intel.com">harri.syrja@intel.com</a>><br>
>>> >      Cc: Chad Versace <[6]<a href="mailto:chad@kiwitree.net">chad@kiwitree.net</a>><br>
>>> >      ---<br>
>>> >       src/mesa/drivers/dri/i965/brw_blorp.c | 19 ++++++++++++++++---<br>
>>> >       1 file changed, 16 insertions(+), 3 deletions(-)<br>
>>> >      diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
>>> >      b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
>>> >      index 556f2c0..9a849f5 100644<br>
>>> >      --- a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
>>> >      +++ b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
>>> >      @@ -825,10 +825,23 @@ do_single_blorp_clear(struct brw_context *brw,<br>
>>> >      struct gl_framebuffer *fb,<br>
>>> >                                           brw, &irb->mt->gen9_fast_clear_<br>
>>> >      color,<br>
>>> >                                           &override_color);<br>
>>> >      -      /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR,<br>
>>> >      the clear<br>
>>> >      -       * is redundant and can be skipped.<br>
>>> >      +      /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR,<br>
>>> >      and the<br>
>>> >      +       * buffer isn't compressed, the clear is redundant and can be<br>
>>> >      skipped.<br>
>>> >      +       *<br>
>>> >      +       * Without compression fast clear only operates on the mcs<br>
>>> >      buffer<br>
>>> >      +       * recording if color values are cleared. The hardware,<br>
>>> >      however,<br>
>>> >      +       * doesn't write the actual color value into the mcs or color<br>
>>> >      +       * buffer. Only by the time of render (inclucing color<br>
>>> >      resolve) does the<br>
>>> >      +       * hardware read the _current_ color value in the surface<br>
>>> >      state and<br>
>>> >      +       * write the actual pixel values in the color buffer<br>
>>> >      accordingly.<br>
>>> >      +       *<br>
>>> >      +       * This seems to be the reason why sampler engine cannot<br>
>>> >      handle<br>
>>> >      +       * non-compressed fast clear - it doesn't know how to read<br>
>>> >      the color<br>
>>> >      +       * value from the surface state. With compression the color<br>
>>> >      value is<br>
>>> >      +       * recorded in the color buffer (only not for every pixel)<br>
>>> >      and therefore<br>
>>> >      +       * it is available without consulting the surface state.<br>
>>> ><br>
>>> >    This doesn't jive with my understanding of fast clears on gen9.<br>
>>> >    Everything I've seen so far indicates that the clear color in the<br>
>>> >    surface state *does* matter.  Otherwise, why would it be there?  In<br>
>>> >    particular, my understanding of the 2-bit CCS values is that 0 means<br>
>>> >    resolved, 1 means compressed and 3 means clear where "clear" means "go<br>
>>> >    look at the clear color".  Have you done experiments that lead you to<br>
>>> >    some other conclusion?<br>
>>><br>
>>> Right, you are correct. This is actually a patch from really early days<br>
>>> when I<br>
>>> didn't know any better. We might want to drop this for now, there is the<br>
>>> 0/1<br>
>>> color thing for sampler engine that we probably need to fix first anyway.<br>
>>><br>
>><br>
>> Let's drop it if we can.<br>
>><br>
>> We should already have code for Broadwell and earlier that prevents<br>
>> fast-clears with non-0/1 clear colors.  We could just also do that on Sky<br>
>> Lake and deal with partial resolves later.  I doubt non-0/1 fast-clear is a<br>
>> big enough deal over color compression to slow down getting this landed.<br>
>><br>
><br>
> Numbers</p>
<p dir="ltr">What do you mean?  Of i recall correctly, we noticed zero speedups in any apps when we enabled non-0/1 fast clears in the first place.  Also, I wasn't trying to say we shouldn't enable them or shouldn't get them working;  my understanding is that they're enabled and broken today.  I was saying that we shouldn't block landing this on coming up with a partial resolve story to fix non-0/1 clears with compression because that's really an unrelated task.  We do need better resolves and hopefully we'll get that done soon but poor Topi has been sitting on this 3‰ perf improvement and trying to land it fitter months now.</p>
<p dir="ltr">Sorry of that got a bit ranty. I hope it makes more sense.</p>
<p dir="ltr">>><br>
>>> What do you think?<br>
>>><br>
>>> ><br>
>>> >              */<br>
>>> >      -      if (!color_updated &&<br>
>>> >      +      if ((!color_updated || !is_lossless_compressed) &&<br>
>>> >                 irb->mt->fast_clear_state ==<br>
>>> >      INTEL_FAST_CLEAR_STATE_CLEAR)<br>
>>> >                return true;<br>
>>> >      --<br>
>>> >      2.5.5<br>
>>> >      _______________________________________________<br>
>>> >      mesa-dev mailing list<br>
>>> >      [7]<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>>> >      [8]<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
>>> ><br>
>>> > References<br>
>>> ><br>
>>> >    1. mailto:<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a><br>
>>> >    2. mailto:<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a><br>
>>> >    3. mailto:<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.com</a><br>
>>> >    4. mailto:<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a><br>
>>> >    5. mailto:<a href="mailto:harri.syrja@intel.com">harri.syrja@intel.com</a><br>
>>> >    6. mailto:<a href="mailto:chad@kiwitree.net">chad@kiwitree.net</a><br>
>>> >    7. mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>>> >    8. <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
>>><br>
><br>
> -- <br>
> Ben Widawsky, Intel Open Source Technology Center<br></p>