<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jul 19, 2017 at 2:21 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Cc: <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
Suggested-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
---<br>
 src/intel/vulkan/anv_blorp.c       |  8 ++++----<br>
 src/intel/vulkan/anv_private.h     |  8 ++++----<br>
 src/intel/vulkan/genX_cmd_<wbr>buffer.c | 25 +++++++++++++++----------<br>
 3 files changed, 23 insertions(+), 18 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
index 459d57ec57..d6cbc1c0cd 100644<br>
--- a/src/intel/vulkan/anv_blorp.c<br>
+++ b/src/intel/vulkan/anv_blorp.c<br>
@@ -1434,10 +1434,10 @@ void anv_CmdResolveImage(<br>
 }<br>
<br>
 void<br>
-anv_image_ccs_clear(struct anv_cmd_buffer *cmd_buffer,<br>
-                    const struct anv_image *image,<br>
-                    const uint32_t base_level, const uint32_t level_count,<br>
-                    const uint32_t base_layer, uint32_t layer_count)<br>
+anv_image_fast_clear(struct anv_cmd_buffer *cmd_buffer,<br>
+                     const struct anv_image *image,<br>
+                     const uint32_t base_level, const uint32_t level_count,<br>
+                     const uint32_t base_layer, uint32_t layer_count)<br>
 {<br>
    assert(image->type == VK_IMAGE_TYPE_3D || image->extent.depth == 1);<br>
<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
index 4dce360c76..9a5d2d6fa4 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -2108,10 +2108,10 @@ anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,<br>
                 const enum blorp_fast_clear_op op);<br>
<br>
 void<br>
-anv_image_ccs_clear(struct anv_cmd_buffer *cmd_buffer,<br>
-                    const struct anv_image *image,<br>
-                    const uint32_t base_level, const uint32_t level_count,<br>
-                    const uint32_t base_layer, uint32_t layer_count);<br>
+anv_image_fast_clear(struct anv_cmd_buffer *cmd_buffer,<br>
+                     const struct anv_image *image,<br>
+                     const uint32_t base_level, const uint32_t level_count,<br>
+                     const uint32_t base_layer, uint32_t layer_count);<br>
<br>
 enum isl_aux_usage<br>
 anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,<br>
diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
index 9b3bb10164..81972821d1 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -392,7 +392,9 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
                         VkImageLayout initial_layout,<br>
                         VkImageLayout final_layout)<br>
 {<br>
-   if (image->aux_usage != ISL_AUX_USAGE_CCS_E)<br>
+   assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
+<br>
+   if (image->aux_usage == ISL_AUX_USAGE_NONE)<br>
       return;<br>
<br>
    if (initial_layout != VK_IMAGE_LAYOUT_UNDEFINED &&<br>
@@ -405,15 +407,18 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
       layer_count = anv_minify(image->extent.<wbr>depth, base_level);<br>
    }<br>
<br>
-#if GEN_GEN >= 9<br>
-   /* We're transitioning from an undefined layout so it doesn't really matter<br>
-    * what data ends up in the color buffer.  We do, however, need to ensure<br>
-    * that the CCS has valid data in it.  One easy way to do that is to<br>
-    * fast-clear the specified range.<br>
-    */<br>
-   anv_image_ccs_clear(cmd_<wbr>buffer, image, base_level, level_count,<br>
-                       base_layer, layer_count);<br>
-#endif<br>
+   if (image->aux_usage == ISL_AUX_USAGE_CCS_E ||<br>
+       image->samples == 2 || image->samples == 8) {<br></blockquote><div><br></div><div>As we discussed in the office, I'd rather we just do this for all MCS because my real concern isn't those few undefined bits but the undefined bit-patterns that can happen with any number of samples.  Feel free to add a perf_warn though and we'll revisit this if we ever think it's a perf issue.<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">
+      /* We're transitioning from an undefined layout so it doesn't really<br>
+       * matter what data ends up in the color buffer. We do, however, need to<br>
+       * ensure that the auxiliary surface is not in an undefined state. This<br>
+       * state is possible for CCS buffers SKL+ and MCS buffers with certain<br>
+       * sample counts. One easy way to get to a valid state is to fast-clear<br>
+       * the specified range.<br>
+       */<br>
+      anv_image_fast_clear(cmd_<wbr>buffer, image, base_level, level_count,<br>
+                           base_layer, layer_count);<br>
+   }<br>
 }<br>
<br>
 /**<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.3<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>