<div dir="ltr">Thanks, that change makes it look a bit tidier - I'll send a v2 and wait to see what Jason thinks.<div><div class="gmail_extra"><br><div class="gmail_quote">On 5 January 2018 at 16:06, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This makes sense to me, it would be good to have Jason's opinion.<br>
I have a suggestion below.<br>
<br>
Reviewed-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>><br>
<br>
Thanks!<div><div class="h5"><br>
<br>
On 05/01/18 11:20, Alex Smith 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>
<br>
Signed-off-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>><br>
---<br>
  src/intel/vulkan/genX_cmd_buff<wbr>er.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..2036151249 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(p<wbr>BeginInfo->pInheritanceInfo->r<wbr>enderPass);<br>
        cmd_buffer->state.subpass =<br>
           &cmd_buffer->state.pass->subp<wbr>asses[pBeginInfo->pInheritance<wbr>Info->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>
          result = genX(cmd_buffer_setup_attachme<wbr>nts)(cmd_buffer,<br>
                                                    cmd_buffer->state.pass, NULL);<br>
  +      /* Record that HiZ is enabled if we can. */<br>
+      if (cmd_buffer->state.framebuffer<wbr>) {<br>
</blockquote>
<br></div></div>
You might be able to knock a few lines below by reusing anv_cmd_buffer_get_depth_stenc<wbr>il_view().<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+         const VkAttachmentReference * const ds =<br>
+            &cmd_buffer->state.subpass->de<wbr>pth_stencil_attachment;<br>
+<br>
+         if (ds->attachment != VK_ATTACHMENT_UNUSED) {<br>
+            const struct anv_image_view * const iview =<br>
+               cmd_buffer->state.<wbr>framebuffer->attachments[ds-><wbr>attachment];<br>
+            const struct anv_image * const image = iview->image;<br>
+            enum isl_aux_usage aux_usage =<br>
+               anv_layout_to_aux_usage(&cmd_<wbr>buffer->device->info, image,<br>
+                                       VK_IMAGE_ASPECT_DEPTH_BIT, ds->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>
  <br>
</blockquote>
<br>
<br>
</div></div></blockquote></div><br></div></div></div>