<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">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><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><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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
v2: Use anv_cmd_buffer_get_depth_<wbr>stencil_view().<br>
<br>
Signed-off-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com">asmith@feralinteractive.com</a>><br>
Reviewed-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
src/intel/vulkan/genX_cmd_<wbr>buffer.c | 22 +++++++++++++++++++++-<br>
1 file changed, 21 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
index 0bd3874db7..b7253d5251 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -977,11 +977,31 @@ genX(BeginCommandBuffer)(<br>
anv_render_pass_from_handle(<wbr>pBeginInfo->pInheritanceInfo-><wbr>renderPass);<br>
cmd_buffer->state.subpass =<br>
&cmd_buffer->state.pass-><wbr>subpasses[pBeginInfo-><wbr>pInheritanceInfo->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(<wbr>pBeginInfo->pInheritanceInfo-><wbr>framebuffer);<br></blockquote><div><br></div><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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
result = genX(cmd_buffer_setup_<wbr>attachments)(cmd_buffer,<br>
cmd_buffer->state.pass, NULL);<br>
<br>
+ /* Record that HiZ is enabled if we can. */<br>
+ if (cmd_buffer->state.<wbr>framebuffer) {<br>
+ const struct anv_image_view * const iview =<br>
+ anv_cmd_buffer_get_depth_<wbr>stencil_view(cmd_buffer);<br>
+<br>
+ if (iview) {<br>
+ VkImageLayout layout =<br>
+ cmd_buffer->state.subpass-><wbr>depth_stencil_attachment.<wbr>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 class="HOEnZb"><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">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>