<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 12, 2017 at 5:33 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"><span class="">The helper doesn't provide additional functionality over the current<br>
infrastructure.<br>
<br>
</span>v2: Add comment to anv_image::aux_usage (Jason Ekstrand)<br>
<span class=""><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       |  2 +-<br>
 src/intel/vulkan/anv_image.c       | 10 ++++++++--<br>
</span> src/intel/vulkan/anv_private.h     | 15 ++++-----------<br>
<span class=""> src/intel/vulkan/gen8_cmd_<wbr>buffer.c |  2 +-<br>
 src/intel/vulkan/genX_cmd_<wbr>buffer.c |  2 +-<br>
</span> 5 files changed, 15 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
index 7e157b4d26..97ce236fc5 100644<br>
--- a/src/intel/vulkan/anv_blorp.c<br>
+++ b/src/intel/vulkan/anv_blorp.c<br>
@@ -858,7 +858,7 @@ void anv_CmdClearDepthStencilImage(<br>
<div><div class="h5">    struct blorp_surf depth, stencil;<br>
    if (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {<br>
       get_blorp_surf_for_anv_image(<wbr>image, VK_IMAGE_ASPECT_DEPTH_BIT,<br>
-                                   image->aux_usage, &depth);<br>
+                                   ISL_AUX_USAGE_NONE, &depth);<br>
    } else {<br>
       memset(&depth, 0, sizeof(depth));<br>
    }<br>
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
index f262d8a524..d821629191 100644<br>
--- a/src/intel/vulkan/anv_image.c<br>
+++ b/src/intel/vulkan/anv_image.c<br>
@@ -195,6 +195,7 @@ make_surface(const struct anv_device *dev,<br>
          isl_surf_get_hiz_surf(&dev-><wbr>isl_dev, &image->depth_surface.isl,<br>
                                &image->aux_surface.isl);<br>
          add_surface(image, &image->aux_surface);<br>
+         image->aux_usage = ISL_AUX_USAGE_HIZ;<br>
       }<br>
    } else if (aspect == VK_IMAGE_ASPECT_COLOR_BIT && vk_info->samples == 1) {<br>
       if (!unlikely(INTEL_DEBUG & DEBUG_NO_RBC)) {<br>
@@ -523,6 +524,11 @@ anv_CreateImageView(VkDevice _device,<br>
       iview->isl.usage = 0;<br>
    }<br>
<br>
+   /* Sampling from HiZ is not yet enabled */<br>
+   enum isl_aux_usage surf_usage = image->aux_usage;<br>
+   if (surf_usage == ISL_AUX_USAGE_HIZ)<br>
+      surf_usage = ISL_AUX_USAGE_NONE;<br>
+<br>
    /* Input attachment surfaces for color or depth are allocated and filled<br>
     * out at BeginRenderPass time because they need compression information.<br>
     * Stencil image do not support compression so we just use the texture<br>
@@ -540,7 +546,7 @@ anv_CreateImageView(VkDevice _device,<br>
                           .surf = &surface->isl,<br>
                           .view = &view,<br>
                           .aux_surf = &image->aux_surface.isl,<br>
-                          .aux_usage = image->aux_usage,<br>
+                          .aux_usage = surf_usage,<br>
                           .mocs = device->default_mocs);<br>
<br>
       if (!device->info.has_llc)<br>
@@ -564,7 +570,7 @@ anv_CreateImageView(VkDevice _device,<br>
                              .surf = &surface->isl,<br>
                              .view = &view,<br>
                              .aux_surf = &image->aux_surface.isl,<br>
-                             .aux_usage = image->aux_usage,<br>
+                             .aux_usage = surf_usage,<br>
                              .mocs = device->default_mocs);<br>
       } else {<br>
          anv_fill_buffer_surface_state(<wbr>device, iview->storage_surface_state,<br>
diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
</div></div>index dbc8c3cf68..26f2986005 100644<br>
--- a/src/intel/vulkan/anv_<wbr>private.h<br>
+++ b/src/intel/vulkan/anv_<wbr>private.h<br>
@@ -1581,7 +1581,10 @@ struct anv_image {<br>
       };<br>
    };<br>
<br>
-   /** The aux usage for this surface when outside a render pass */<br>
+   /**<br>
+    * The aux usage for this surface when outside a render pass<br>
+    * (and inside a render pass for HiZ-enabled depth stencil attachments).<br>
+    */<br></blockquote><div><br></div><div>How about:<br><br></div><div>For color images, this is the aux usage for this image when not used as a color attachment.<br><br></div><div>For depth/stencil images, this is set to ISL_AUX_USAGE_HIZ if the image has a HiZ buffer.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    enum isl_aux_usage aux_usage;<br>
<br>
    struct anv_surface aux_surface;<br>
@@ -1642,16 +1645,6 @@ const struct anv_surface *<br>
<div class="HOEnZb"><div class="h5"> anv_image_get_surface_for_<wbr>aspect_mask(const struct anv_image *image,<br>
                                       VkImageAspectFlags aspect_mask);<br>
<br>
-static inline bool<br>
-anv_image_has_hiz(const struct anv_image *image)<br>
-{<br>
-   /* We must check the aspect because anv_image::aux_surface may be used for<br>
-    * any type of auxiliary surface, not just HiZ.<br>
-    */<br>
-   return (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&<br>
-          image->aux_surface.isl.size > 0;<br>
-}<br>
-<br>
 struct anv_buffer_view {<br>
    enum isl_format format; /**< VkBufferViewCreateInfo::format */<br>
    struct anv_bo *bo;<br>
diff --git a/src/intel/vulkan/gen8_cmd_<wbr>buffer.c b/src/intel/vulkan/gen8_cmd_<wbr>buffer.c<br>
index 3e4aa9bc62..892a035304 100644<br>
--- a/src/intel/vulkan/gen8_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/gen8_cmd_<wbr>buffer.c<br>
@@ -337,7 +337,7 @@ genX(cmd_buffer_emit_hz_op)(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
    const struct anv_image_view *iview =<br>
       anv_cmd_buffer_get_depth_<wbr>stencil_view(cmd_buffer);<br>
<br>
-   if (iview == NULL || !anv_image_has_hiz(iview-><wbr>image))<br>
+   if (iview == NULL || iview->image->aux_usage != ISL_AUX_USAGE_HIZ)<br>
       return;<br>
<br>
    /* FINISHME: Implement multi-subpass HiZ */<br>
diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
index 7ff0d3ebba..a372e6420f 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -2087,7 +2087,7 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
       anv_cmd_buffer_get_depth_<wbr>stencil_view(cmd_buffer);<br>
    const struct anv_image *image = iview ? iview->image : NULL;<br>
    const bool has_depth = image && (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT);<br>
-   const bool has_hiz = image != NULL && anv_image_has_hiz(image);<br>
+   const bool has_hiz = image != NULL && image->aux_usage == ISL_AUX_USAGE_HIZ;<br>
    const bool has_stencil =<br>
       image && (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT);<br>
<br>
--<br>
2.11.0<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>
</div></div></blockquote></div><br></div></div>