<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 5 January 2018 at 21:43, 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 Fri, Jan 5, 2018 at 9:06 AM, Alex Smith <span dir="ltr"><<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This was never enabled in secondary buffers because hiz_enabled was<br>
never set to true for those.<br>
<br>
If the app provides a framebuffer in the inheritance info when beginning<br>
a secondary buffer, we can determine if HiZ is enabled and therefore<br>
allow the PMA optimization to be enabled within the command buffer.<br>
<br>
This improves performance by ~13% on an internal benchmark on Skylake.<br></blockquote><div><br></div></span><div>Are you sure this is Sky Lake and not Broadwell?  We've never measured the stencil PMA to help anything before.  Neat!</div></div></div></div></blockquote><div><br></div><div>Yep, this was on HD 530 specifically.</div><div><br></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><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br></div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
v2: Use anv_cmd_buffer_get_depth_stenc<wbr>il_view().<br>
<br>
Signed-off-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>><br>
Reviewed-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
 src/intel/vulkan/genX_cmd_buf<wbr>fer.c | 22 +++++++++++++++++++++-<br>
 1 file changed, 21 insertions(+), 1 deletion(-)<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 0bd3874db7..b7253d5251 100644<br>
--- a/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
@@ -977,11 +977,31 @@ genX(BeginCommandBuffer)(<br>
          anv_render_pass_from_handle(pB<wbr>eginInfo->pInheritanceInfo->re<wbr>nderPass);<br>
       cmd_buffer->state.subpass =<br>
          &cmd_buffer->state.pass->subpa<wbr>sses[pBeginInfo->pInheritanceI<wbr>nfo->subpass];<br>
-      cmd_buffer->state.framebuffer = NULL;<br>
+<br>
+      /* This is optional in the inheritance info. */<br>
+      cmd_buffer->state.framebuffer =<br>
+         anv_framebuffer_from_handle(p<wbr>BeginInfo->pInheritanceInfo->f<wbr>ramebuffer);<br></blockquote><div><br></div></span><div>FYI: The only reason why we were always setting framebuffer to NULL for secondaries was because most of the CTS tests specify a framebuffer and I wanted our testing to run without the framebuffer because that's the more difficult case.  (It's easy to forget that framebuffer may be NULL.)  I knew it was a potential performance issue but no one was heavily using secondaries in the wild up until now.  Thanks for getting this working!<br></div></div></div></div></blockquote><div><br></div><div>All of our Vulkan games use secondary command buffers, but we also always set the framebuffer in the inheritance info :)</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></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
       result = genX(cmd_buffer_setup_attachme<wbr>nts)(cmd_buffer,<br>
                                                   cmd_buffer->state.pass, NULL);<br>
<br>
+      /* Record that HiZ is enabled if we can. */<br>
+      if (cmd_buffer->state.framebuffer<wbr>) {<br>
+         const struct anv_image_view * const iview =<br>
+            anv_cmd_buffer_get_depth_stenc<wbr>il_view(cmd_buffer);<br>
+<br>
+         if (iview) {<br>
+            VkImageLayout layout =<br>
+                cmd_buffer->state.subpass->dep<wbr>th_stencil_attachment.layout;<br>
+<br>
+            enum isl_aux_usage aux_usage =<br>
+               anv_layout_to_aux_usage(&cmd_<wbr>buffer->device->info, iview->image,<br>
+                                       VK_IMAGE_ASPECT_DEPTH_BIT, layout);<br>
+<br>
+            cmd_buffer->state.hiz_enabled = aux_usage == ISL_AUX_USAGE_HIZ;<br>
+         }<br>
+      }<br>
+<br>
       cmd_buffer->state.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS;<br>
    }<br>
</span><span class="HOEnZb"><font color="#888888"><span class="m_7806986790293800509HOEnZb"><font color="#888888"><br>
--<br>
2.13.6<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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></font></span></blockquote></div><br></div></div>
</blockquote></div><br></div></div>