<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 4, 2016 at 3:48 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"><div class="HOEnZb"><div class="h5">On Mon, Oct 03, 2016 at 04:27:53PM -0700, Jason Ekstrand wrote:<br>
> On Mon, Sep 26, 2016 at 5:10 PM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>> wrote:<br>
><br>
> > From: Chad Versace <<a href="mailto:chad.versace@intel.com">chad.versace@intel.com</a>><br>
> ><br>
> > Nanley Chery:<br>
> > (rebase)<br>
> >  - Use isl_surf_get_hiz_surf()<br>
> > (amend)<br>
> >  - Only add a HiZ surface onto a depth/stencil attachment<br>
> >  - Add comment above HiZ surface addition<br>
> >  - Hide HiZ behind INTEL_VK_HIZ prior to BDW<br>
> >  - Disable HiZ for untested cases<br>
> >  - Remove DISABLE_AUX_BIT instead of preventing it from being added<br>
> ><br>
> > Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
> > Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> > Reviewed-by: Chad Versace <<a href="mailto:chadversary@chromium.org">chadversary@chromium.org</a>> (v1)<br>
> ><br>
> > ---<br>
> ><br>
> > v2: Disable certain HiZ cases here (Jason)<br>
> ><br>
> >  src/intel/vulkan/anv_image.c | 39 ++++++++++++++++++++++++++++++<wbr>++++++---<br>
> >  1 file changed, 36 insertions(+), 3 deletions(-)<br>
> ><br>
> > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
> > index f6e8672..d408819 100644<br>
> > --- a/src/intel/vulkan/anv_image.c<br>
> > +++ b/src/intel/vulkan/anv_image.c<br>
> > @@ -28,6 +28,7 @@<br>
> >  #include <fcntl.h><br>
> ><br>
> >  #include "anv_private.h"<br>
> > +#include "util/debug.h"<br>
> ><br>
> >  #include "vk_format_info.h"<br>
> ><br>
> > @@ -60,6 +61,7 @@ choose_isl_surf_usage(<wbr>VkImageUsageFlags vk_usage,<br>
> >        default:<br>
> >           unreachable("bad VkImageAspect");<br>
> >        case VK_IMAGE_ASPECT_DEPTH_BIT:<br>
> > +         isl_usage &= ~ISL_SURF_USAGE_DISABLE_AUX_<wbr>BIT;<br>
> >           isl_usage |= ISL_SURF_USAGE_DEPTH_BIT;<br>
> >           break;<br>
> >        case VK_IMAGE_ASPECT_STENCIL_BIT:<br>
> > @@ -99,6 +101,16 @@ get_surface(struct anv_image *image,<br>
> > VkImageAspectFlags aspect)<br>
> >     }<br>
> >  }<br>
> ><br>
> > +static void<br>
> > +add_surface(struct anv_image *image, struct anv_surface *surf)<br>
> > +{<br>
> > +   assert(surf->isl.size > 0); /* isl surface must be initialized */<br>
> > +<br>
> > +   surf->offset = align_u32(image->size, surf->isl.alignment);<br>
> > +   image->size = surf->offset + surf->isl.size;<br>
> > +   image->alignment = MAX(image->alignment, surf->isl.alignment);<br>
> > +}<br>
> > +<br>
> >  /**<br>
> >   * Initialize the anv_image::*_surface selected by \a aspect. Then update<br>
> > the<br>
> >   * image's memory requirements (that is, the image's size and alignment).<br>
> > @@ -160,9 +172,30 @@ make_surface(const struct anv_device *dev,<br>
> >      */<br>
> >     assert(ok);<br>
> ><br>
> > -   anv_surf->offset = align_u32(image->size, anv_surf->isl.alignment);<br>
> > -   image->size = anv_surf->offset + anv_surf->isl.size;<br>
> > -   image->alignment = MAX(image->alignment, anv_surf->isl.alignment);<br>
> > +   add_surface(image, anv_surf);<br>
> ><br>
><br>
> In my CCS series, I split this in two and had a precursor patch that added<br>
> the add_surface helper.  Do with that information what you will.  I'm fine<br>
> with having it all in one patch.<br>
><br>
><br>
> > +<br>
> > +   /* Allow the user to control HiZ enabling. Disable by default on gen7<br>
> > +    * because resolves are not currently implemented pre-BDW.<br>
> > +    */<br>
> > +   if (!env_var_as_boolean("INTEL_<wbr>VK_HIZ", dev->info.gen >= 8)) {<br>
> > +      anv_finishme("Implement gen7 HiZ");<br>
> > +      return VK_SUCCESS;<br>
> > +   } else if (vk_info->mipLevels > 1) {<br>
> > +      anv_finishme("Test multi-LOD HiZ");<br>
> > +      return VK_SUCCESS;<br>
> > +   } else if (dev->info.gen == 8 && vk_info->samples > 1) {<br>
> > +      anv_finishme("Test gen8 multisampled HiZ");<br>
> > +      return VK_SUCCESS;<br>
> > +   }<br>
> ><br>
><br>
> It may be better to pull this (and the usage check below) into an<br>
> image_supports_hiz helper.  The early returns work for now but as soon as<br>
> we have multiple kinds of aux surfaces, we'll have to do that refactor<br>
> anyway.<br>
><br>
><br>
<br>
</div></div>I'll nest the hunk above into the following if statement. That should<br>
prevent conflicts with other aux surfaces.<span class="im HOEnZb"><br></span></blockquote><div><br></div><div>I suppose that works.  If it's a problem, we can always do that refactor later.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="im HOEnZb">
> > +<br>
> > +   /* Add a HiZ surface to a depth buffer that will be used for rendering.<br>
> > +    */<br>
> > +   if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT &&<br>
> > +       (image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_<wbr>ATTACHMENT_BIT)) {<br>
<br>
</span><span class="HOEnZb"><font color="#888888">-Nanley<br>
</font></span><div class="HOEnZb"><div class="h5"><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>
> > +   }<br>
> ><br>
> >     return VK_SUCCESS;<br>
> >  }<br>
> > --<br>
> > 2.10.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>
> ><br>
</div></div></blockquote></div><br></div></div>