<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 23, 2016 at 10:16 AM, Pohjolainen, Topi <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"><span class="">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>
</span><span class="">> <[1]<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a><wbr>> 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>
</span>> Signed-off-by: Topi Pohjolainen <[2]<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a><wbr>><br>
> CC: Ben Widawsky <[3]<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.<wbr>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>
<div><div class="h5">> ---<br>
> src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 19 ++++++++++++++++---<br>
> 1 file changed, 16 insertions(+), 3 deletions(-)<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> 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,<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>
</div></div>Right, you are correct. This is actually a patch from really early days when I<br>
didn't know any better. We might want to drop this for now, there is the 0/1<br>
color thing for sampler engine that we probably need to fix first anyway.<br></blockquote><div><br></div><div>Let's drop it if we can.<br><br></div><div>We should already have code for Broadwell and earlier that prevents fast-clears with non-0/1 clear colors. We could just also do that on Sky Lake and deal with partial resolves later. I doubt non-0/1 fast-clear is a big enough deal over color compression to slow down getting this landed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What do you think?<br>
<span class=""><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>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
</span>> [7]<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.<wbr>org</a><br>
> [8]<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.<wbr>org/mailman/listinfo/mesa-dev</a><br>
><br>
> References<br>
><br>
> 1. mailto:<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.<wbr>com</a><br>
> 2. mailto:<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.<wbr>com</a><br>
> 3. mailto:<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@<wbr>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.<wbr>freedesktop.org</a><br>
> 8. <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>
</blockquote></div><br></div></div>