<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 28, 2016 at 3:06 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Fri, Oct 28, 2016 at 02:17:05AM -0700, Jason Ekstrand wrote:<br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> ---<br>
> src/intel/vulkan/anv_image.c | 16 ++++++++--------<br>
> src/intel/vulkan/anv_private.h | 5 +++--<br>
> src/intel/vulkan/genX_cmd_<wbr>buffer.c | 10 +++++-----<br>
> 3 files changed, 16 insertions(+), 15 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
> index 6151d8e..2104901 100644<br>
> --- a/src/intel/vulkan/anv_image.c<br>
> +++ b/src/intel/vulkan/anv_image.c<br>
> @@ -190,8 +190,8 @@ make_surface(const struct anv_device *dev,<br>
> anv_finishme("Test gen8 multisampled HiZ");<br>
> } else {<br>
> isl_surf_get_hiz_surf(&dev-><wbr>isl_dev, &image->depth_surface.isl,<br>
> - &image->hiz_surface.isl);<br>
> - add_surface(image, &image->hiz_surface);<br>
> + &image->aux_surface.isl);<br>
> + add_surface(image, &image->aux_surface);<br>
> }<br>
> }<br>
><br>
> @@ -298,16 +298,16 @@ VkResult anv_BindImageMemory(<br>
> /* The offset and size must be a multiple of 4K or else the<br>
> * anv_gem_mmap call below will return NULL.<br>
> */<br>
> - assert((image->offset + image->hiz_surface.offset) % 4096 == 0);<br>
> - assert(image->hiz_surface.isl.<wbr>size % 4096 == 0);<br>
> + assert((image->offset + image->aux_surface.offset) % 4096 == 0);<br>
> + assert(image->aux_surface.isl.<wbr>size % 4096 == 0);<br>
><br>
> /* HiZ surfaces need to have their memory cleared to 0 before they<br>
> * can be used. If we let it have garbage data, it can cause GPU<br>
> * hangs on some hardware.<br>
> */<br>
> void *map = anv_gem_mmap(device, image->bo->gem_handle,<br>
> - image->offset + image->hiz_surface.offset,<br>
> - image->hiz_surface.isl.size,<br>
> + image->offset + image->aux_surface.offset,<br>
> + image->aux_surface.isl.size,<br>
> device->info.has_llc ? 0 : I915_MMAP_WC);<br>
><br>
> /* If anv_gem_mmap returns NULL, it's likely that the kernel was<br>
> @@ -316,9 +316,9 @@ VkResult anv_BindImageMemory(<br>
> if (map == NULL)<br>
> return vk_error(VK_ERROR_OUT_OF_HOST_<wbr>MEMORY);<br>
><br>
> - memset(map, 0, image->hiz_surface.isl.size);<br>
> + memset(map, 0, image->aux_surface.isl.size);<br>
><br>
> - anv_gem_munmap(map, image->hiz_surface.isl.size);<br>
> + anv_gem_munmap(map, image->aux_surface.isl.size);<br>
> }<br>
><br>
> return VK_SUCCESS;<br>
> diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
> index b135dc9..f05bf91 100644<br>
> --- a/src/intel/vulkan/anv_<wbr>private.h<br>
> +++ b/src/intel/vulkan/anv_<wbr>private.h<br>
> @@ -1528,10 +1528,11 @@ struct anv_image {<br>
><br>
> struct {<br>
> struct anv_surface depth_surface;<br>
> - struct anv_surface hiz_surface;<br>
> struct anv_surface stencil_surface;<br>
> };<br>
> };<br>
> +<br>
> + struct anv_surface aux_surface;<br>
> };<br>
><br>
> static inline uint32_t<br>
> @@ -1596,7 +1597,7 @@ anv_image_has_hiz(const struct anv_image *image)<br>
> * a union.<br>
> */<br>
<br>
</div></div>The comment in this function must also be updated as it's no longer<br>
true with this change.<br></blockquote><div><br></div><div>Yup, thanks for catching that. I've replaced the above comment with:<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><br></div><div>Sound good?<br><br></div><div>--Jason<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">
-Nanley<br>
<div><div class="gmail-h5"><br>
> return (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&<br>
> - image->hiz_surface.isl.size > 0;<br>
> + image->aux_surface.isl.size > 0;<br>
> }<br>
><br>
> struct anv_buffer_view {<br>
> diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> index a5e4d0e..a87e5a3 100644<br>
> --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> @@ -1876,10 +1876,10 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
> if (has_hiz) {<br>
> anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_HIER_DEPTH_<wbr>BUFFER), hdb) {<br>
> hdb.<wbr>HierarchicalDepthBufferObjectC<wbr>ontrolState = GENX(MOCS);<br>
> - hdb.SurfacePitch = image->hiz_surface.isl.row_<wbr>pitch - 1;<br>
> + hdb.SurfacePitch = image->aux_surface.isl.row_<wbr>pitch - 1;<br>
> hdb.SurfaceBaseAddress = (struct anv_address) {<br>
> .bo = image->bo,<br>
> - .offset = image->offset + image->hiz_surface.offset,<br>
> + .offset = image->offset + image->aux_surface.offset,<br>
> };<br>
> #if GEN_GEN >= 8<br>
> /* From the SKL PRM Vol2a:<br>
> @@ -1891,9 +1891,9 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
> * - SURFTYPE_3D: distance in rows between R - slices<br>
> */<br>
> hdb.SurfaceQPitch =<br>
> - image->hiz_surface.isl.dim == ISL_SURF_DIM_1D ?<br>
> - isl_surf_get_array_pitch_el(&<wbr>image->hiz_surface.isl) >> 2 :<br>
> - isl_surf_get_array_pitch_el_<wbr>rows(&image->hiz_surface.isl) >> 2;<br>
> + image->aux_surface.isl.dim == ISL_SURF_DIM_1D ?<br>
> + isl_surf_get_array_pitch_el(&<wbr>image->aux_surface.isl) >> 2 :<br>
> + isl_surf_get_array_pitch_el_<wbr>rows(&image->aux_surface.isl) >> 2;<br>
> #endif<br>
> }<br>
> } else {<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<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>
</blockquote></div><br></div></div>