<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 6, 2018 at 8:30 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, Mar 6, 2018 at 7:49 AM, Juan A. Suarez Romero <span dir="ltr"><<a href="mailto:jasuarez@igalia.com" target="_blank">jasuarez@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Wed, 2018-02-14 at 12:16 -0800, Jason Ekstrand wrote:<br>
> Previously, we just used all the channels regardless of the format.<br>
> This is less than ideal because some channels may have undefined values<br>
> and this should be ok from the client's perspective.  Even though the<br>
> driver should do the correct thing regardless of what is in the<br>
> undefined value, it makes things less deterministic.  In particular, the<br>
> driver may choose to fast-clear or not based on undefined values.  This<br>
> level of nondeterminism is bad.<br>
><br>
> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.<wbr>org</a><br>
<br>
</span>In order to be able to cherry-pick this commit in 17.3.x stable branch,<br>
I'm cherry-picking also:<br>
<br>
<br>
commit b1f11450126b0b19754c0cc08103ca<wbr>98aa89658a<br>
Author: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com" target="_blank">jason.ekstrand@intel.com</a>><br>
Date:   Wed Jan 17 21:31:09 2018 -0800<br>
<br>
    anv: Only fast clear single-slice images<br>
<br>
<br>
Even when it was not nominated, I think it is a good idea to include as<br>
part of the stable release.<br></blockquote><div><br></div></span><div>I don't think that's needed.  I'll try to make a version of the patch which applies to 17.3 and send it to stable.<span class="HOEnZb"><font color="#888888"><br></font></span></div></div></div></div></blockquote><div><br></div><div>I just sent two patches to stable.  This patch and the ISL patch it depends on.  I haven't actually run them through Jenkins yet but everything looks ok visually.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span class="HOEnZb"><font color="#888888"></font></span></div><span class="HOEnZb"><font color="#888888"><div>--Jason<br></div></font></span><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Jason, let me know if you are against adding it into stable; if so,<br>
I'll drop both patches.<br>
<br>
Thanks!<br>
<span class="m_-7370290585798523482HOEnZb"><font color="#888888"><br>
<br>
        J.A.<br>
</font></span><div class="m_-7370290585798523482HOEnZb"><div class="m_-7370290585798523482h5"><br>
> ---<br>
>  src/intel/vulkan/genX_cmd_buff<wbr>er.c | 46 ++++++++++++++++--------------<wbr>--------<br>
>  1 file changed, 19 insertions(+), 27 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c b/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
> index ce47b8a..8b1816a 100644<br>
> --- a/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
> @@ -202,24 +202,6 @@ add_image_view_relocs(struct anv_cmd_buffer *cmd_buffer,<br>
>     }<br>
>  }<br>
><br>
> -static bool<br>
> -color_is_zero_one(VkClearColo<wbr>rValue value, enum isl_format format)<br>
> -{<br>
> -   if (isl_format_has_int_channel(fo<wbr>rmat)) {<br>
> -      for (unsigned i = 0; i < 4; i++) {<br>
> -         if (value.int32[i] != 0 && value.int32[i] != 1)<br>
> -            return false;<br>
> -      }<br>
> -   } else {<br>
> -      for (unsigned i = 0; i < 4; i++) {<br>
> -         if (value.float32[i] != 0.0f && value.float32[i] != 1.0f)<br>
> -            return false;<br>
> -      }<br>
> -   }<br>
> -<br>
> -   return true;<br>
> -}<br>
> -<br>
>  static void<br>
>  color_attachment_compute_aux_u<wbr>sage(struct anv_device * device,<br>
>                                     struct anv_cmd_state * cmd_state,<br>
> @@ -283,13 +265,25 @@ color_attachment_compute_aux_u<wbr>sage(struct anv_device * device,<br>
><br>
>     assert(iview->image->planes[<wbr>0].aux_surface.isl.usage & ISL_SURF_USAGE_CCS_BIT);<br>
><br>
> +   const struct isl_format_layout *view_fmtl =<br>
> +      isl_format_get_layout(iview->p<wbr>lanes[0].isl.format);<br>
> +   union isl_color_value clear_color = {};<br>
> +<br>
> +#define COPY_CLEAR_COLOR_CHANNEL(c, i) \<br>
> +   if (view_fmtl->channels.c.bits) \<br>
> +      clear_color.u32[i] = att_state->clear_value.color.u<wbr>int32[i]<br>
> +<br>
> +   COPY_CLEAR_COLOR_CHANNEL(r, 0);<br>
> +   COPY_CLEAR_COLOR_CHANNEL(g, 1);<br>
> +   COPY_CLEAR_COLOR_CHANNEL(b, 2);<br>
> +   COPY_CLEAR_COLOR_CHANNEL(a, 3);<br>
> +<br>
> +#undef COPY_CLEAR_COLOR_CHANNEL<br>
> +<br>
>     att_state->clear_color_is_zer<wbr>o_one =<br>
> -      color_is_zero_one(att_state->c<wbr>lear_value.color, iview->planes[0].isl.format);<br>
> +      isl_color_value_is_zero_one(cl<wbr>ear_color, iview->planes[0].isl.format);<br>
>     att_state->clear_color_is_<wbr>zero =<br>
> -      att_state->clear_value.color.u<wbr>int32[0] == 0 &&<br>
> -      att_state->clear_value.color.u<wbr>int32[1] == 0 &&<br>
> -      att_state->clear_value.color.u<wbr>int32[2] == 0 &&<br>
> -      att_state->clear_value.color.u<wbr>int32[3] == 0;<br>
> +      isl_color_value_is_zero(clear_<wbr>color, iview->planes[0].isl.format);<br>
><br>
>     if (att_state->pending_clear_aspe<wbr>cts == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
>        /* Start off assuming fast clears are possible */<br>
> @@ -341,10 +335,8 @@ color_attachment_compute_aux_u<wbr>sage(struct anv_device * device,<br>
>                         "LOAD_OP_CLEAR.  Only fast-clearing the first slice");<br>
>        }<br>
><br>
> -      if (att_state->fast_clear) {<br>
> -         memcpy(fast_clear_color->u32, att_state->clear_value.color.u<wbr>int32,<br>
> -                sizeof(fast_clear_color->u32))<wbr>;<br>
> -      }<br>
> +      if (att_state->fast_clear)<br>
> +         *fast_clear_color = clear_color;<br>
>     } else {<br>
>        att_state->fast_clear = false;<br>
>     }<br>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>