<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 6, 2017 at 1:58 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Broadwell we still need to do a resolve between the subpass<br>
that writes and the subpass that reads when there is a<br>
self-dependency because HW could not see fast-clears and works<br>
on the render cache as if there was regular non-fast-clear surface.<br>
<br>
Fixes 16 tests on BDW:<br>
<br>
dEQP-VK.renderpass.formats.*.<wbr>input.clear.store.self_dep*<br>
<br>
Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
---<br>
 src/intel/vulkan/anv_blorp.c | 16 ++++++++++++++--<br>
 1 file changed, 14 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
index 72a468a744a..daf13d360c4 100644<br>
--- a/src/intel/vulkan/anv_blorp.c<br>
+++ b/src/intel/vulkan/anv_blorp.c<br>
@@ -1457,6 +1457,7 @@ ccs_resolve_attachment(struct anv_cmd_buffer *cmd_buffer,<br>
     * still hot in the cache.<br>
     */<br>
    bool found_draw = false;<br>
+   bool self_dep = false;<br>
    enum anv_subpass_usage usage = 0;<br>
    for (uint32_t s = subpass_idx + 1; s < pass->subpass_count; s++) {<br>
       usage |= pass->attachments[att].<wbr>subpass_usage[s];<br>
@@ -1466,6 +1467,8 @@ ccs_resolve_attachment(struct anv_cmd_buffer *cmd_buffer,<br>
           * wait to resolve until then.<br>
           */<br>
          found_draw = true;<br>
+         if (pass->attachments[att].<wbr>subpass_usage[s] & ANV_SUBPASS_USAGE_INPUT)<br>
+            self_dep = true;<br>
          break;<br>
       }<br>
    }<br>
@@ -1509,10 +1512,19 @@ ccs_resolve_attachment(struct anv_cmd_buffer *cmd_buffer,<br>
           */<br>
       }<br>
    } else if (usage & ANV_SUBPASS_USAGE_INPUT) {<br>
-      /* Input attachments are clear-color aware so, at least on Sky Lake, we<br>
+      /* Input attachments are clear-color aware, at least on Sky Lake, so we<br>
        * can frequently sample from them with no resolves at all.<br>
+       *<br>
+       * However on Broadwell we still need to do resolves when there is a<br>
+       * self-dependency because HW could not see fast-clears and works<br>
+       * on the render cache as if there was regular non-fast-clear surface.<br>
+       * To avoid any inconsistency, we force the resolve.<br>
        */<br>
-      if (att_state->aux_usage != att_state->input_aux_usage) {<br>
+      if (cmd_buffer->device->info.gen == 8 && self_dep &&<br>
+          att_state->aux_usage == ISL_AUX_USAGE_CCS_D &&<br>
+          att_state->input_aux_usage == ISL_AUX_USAGE_CCS_D) {<br>
+         resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_<wbr>FULL;<br></blockquote><div><br>Would it make a tad bit more sense to move this down in the if-ladder a bit?  It would let us simplify the condition because we would already know that aux_usage == input_aux_usage but I think it's also the most special of our special cases.<br><br></div><div>Either way,<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+      } else if (att_state->aux_usage != att_state->input_aux_usage) {<br>
          assert(att_state->input_aux_<wbr>usage == ISL_AUX_USAGE_NONE);<br>
          resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_<wbr>FULL;<br>
       } else if (!att_state->clear_color_is_<wbr>zero_one) {<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
</font></span></blockquote></div><br></div></div>