[Mesa-dev] [PATCH 09/18] anv/image: Rename hiz_surface to aux_surface

Nanley Chery nanleychery at gmail.com
Fri Oct 28 22:35:12 UTC 2016


On Fri, Oct 28, 2016 at 03:28:27PM -0700, Jason Ekstrand wrote:
> On Fri, Oct 28, 2016 at 3:06 PM, Nanley Chery <nanleychery at gmail.com> wrote:
> 
> > On Fri, Oct 28, 2016 at 02:17:05AM -0700, Jason Ekstrand wrote:
> > > Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> > > ---
> > >  src/intel/vulkan/anv_image.c       | 16 ++++++++--------
> > >  src/intel/vulkan/anv_private.h     |  5 +++--
> > >  src/intel/vulkan/genX_cmd_buffer.c | 10 +++++-----
> > >  3 files changed, 16 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> > > index 6151d8e..2104901 100644
> > > --- a/src/intel/vulkan/anv_image.c
> > > +++ b/src/intel/vulkan/anv_image.c
> > > @@ -190,8 +190,8 @@ make_surface(const struct anv_device *dev,
> > >           anv_finishme("Test gen8 multisampled HiZ");
> > >        } else {
> > >           isl_surf_get_hiz_surf(&dev->isl_dev,
> > &image->depth_surface.isl,
> > > -                               &image->hiz_surface.isl);
> > > -         add_surface(image, &image->hiz_surface);
> > > +                               &image->aux_surface.isl);
> > > +         add_surface(image, &image->aux_surface);
> > >        }
> > >     }
> > >
> > > @@ -298,16 +298,16 @@ VkResult anv_BindImageMemory(
> > >        /* The offset and size must be a multiple of 4K or else the
> > >         * anv_gem_mmap call below will return NULL.
> > >         */
> > > -      assert((image->offset + image->hiz_surface.offset) % 4096 == 0);
> > > -      assert(image->hiz_surface.isl.size % 4096 == 0);
> > > +      assert((image->offset + image->aux_surface.offset) % 4096 == 0);
> > > +      assert(image->aux_surface.isl.size % 4096 == 0);
> > >
> > >        /* HiZ surfaces need to have their memory cleared to 0 before they
> > >         * can be used.  If we let it have garbage data, it can cause GPU
> > >         * hangs on some hardware.
> > >         */
> > >        void *map = anv_gem_mmap(device, image->bo->gem_handle,
> > > -                               image->offset +
> > image->hiz_surface.offset,
> > > -                               image->hiz_surface.isl.size,
> > > +                               image->offset +
> > image->aux_surface.offset,
> > > +                               image->aux_surface.isl.size,
> > >                                 device->info.has_llc ? 0 : I915_MMAP_WC);
> > >
> > >        /* If anv_gem_mmap returns NULL, it's likely that the kernel was
> > > @@ -316,9 +316,9 @@ VkResult anv_BindImageMemory(
> > >        if (map == NULL)
> > >           return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> > >
> > > -      memset(map, 0, image->hiz_surface.isl.size);
> > > +      memset(map, 0, image->aux_surface.isl.size);
> > >
> > > -      anv_gem_munmap(map, image->hiz_surface.isl.size);
> > > +      anv_gem_munmap(map, image->aux_surface.isl.size);
> > >     }
> > >
> > >     return VK_SUCCESS;
> > > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_
> > private.h
> > > index b135dc9..f05bf91 100644
> > > --- a/src/intel/vulkan/anv_private.h
> > > +++ b/src/intel/vulkan/anv_private.h
> > > @@ -1528,10 +1528,11 @@ struct anv_image {
> > >
> > >        struct {
> > >           struct anv_surface depth_surface;
> > > -         struct anv_surface hiz_surface;
> > >           struct anv_surface stencil_surface;
> > >        };
> > >     };
> > > +
> > > +   struct anv_surface aux_surface;
> > >  };
> > >
> > >  static inline uint32_t
> > > @@ -1596,7 +1597,7 @@ anv_image_has_hiz(const struct anv_image *image)
> > >      * a union.
> > >      */
> >
> > The comment in this function must also be updated as it's no longer
> > true with this change.
> >
> 
> Yup, thanks for catching that.  I've replaced the above comment with:
> 
>    /* We must check the aspect because anv_image::aux_surface may be used
> for
>     * any type of auxiliary surface, not just HiZ.
>     */
> 
> Sound good?

Yes, that's good. Thanks.

-Nanley

> 
> --Jason
> 
> 
> > -Nanley
> >
> > >     return (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&
> > > -          image->hiz_surface.isl.size > 0;
> > > +          image->aux_surface.isl.size > 0;
> > >  }
> > >
> > >  struct anv_buffer_view {
> > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> > b/src/intel/vulkan/genX_cmd_buffer.c
> > > index a5e4d0e..a87e5a3 100644
> > > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > > @@ -1876,10 +1876,10 @@ cmd_buffer_emit_depth_stencil(struct
> > anv_cmd_buffer *cmd_buffer)
> > >     if (has_hiz) {
> > >        anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_HIER_DEPTH_BUFFER),
> > hdb) {
> > >           hdb.HierarchicalDepthBufferObjectControlState = GENX(MOCS);
> > > -         hdb.SurfacePitch = image->hiz_surface.isl.row_pitch - 1;
> > > +         hdb.SurfacePitch = image->aux_surface.isl.row_pitch - 1;
> > >           hdb.SurfaceBaseAddress = (struct anv_address) {
> > >              .bo = image->bo,
> > > -            .offset = image->offset + image->hiz_surface.offset,
> > > +            .offset = image->offset + image->aux_surface.offset,
> > >           };
> > >  #if GEN_GEN >= 8
> > >           /* From the SKL PRM Vol2a:
> > > @@ -1891,9 +1891,9 @@ cmd_buffer_emit_depth_stencil(struct
> > anv_cmd_buffer *cmd_buffer)
> > >            *    - SURFTYPE_3D: distance in rows between R - slices
> > >            */
> > >           hdb.SurfaceQPitch =
> > > -            image->hiz_surface.isl.dim == ISL_SURF_DIM_1D ?
> > > -               isl_surf_get_array_pitch_el(&image->hiz_surface.isl) >>
> > 2 :
> > > -               isl_surf_get_array_pitch_el_rows(&image->hiz_surface.isl)
> > >> 2;
> > > +            image->aux_surface.isl.dim == ISL_SURF_DIM_1D ?
> > > +               isl_surf_get_array_pitch_el(&image->aux_surface.isl) >>
> > 2 :
> > > +               isl_surf_get_array_pitch_el_rows(&image->aux_surface.isl)
> > >> 2;
> > >  #endif
> > >        }
> > >     } else {
> > > --
> > > 2.5.0.400.gff86faf
> > >
> > > _______________________________________________
> > > mesa-dev mailing list
> > > mesa-dev at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >


More information about the mesa-dev mailing list