[Mesa-dev] [PATCH 15/22] anv/cmd_buffer: Adjust the image view reloc function

Nanley Chery nanleychery at gmail.com
Wed May 10 18:13:46 UTC 2017


On Tue, May 02, 2017 at 05:15:46PM -0700, Jason Ekstrand wrote:
> On Thu, Apr 27, 2017 at 11:32 AM, Nanley Chery <nanleychery at gmail.com>
> wrote:
> 
> > Make the function take in an image instead of an image view. This
> > enables us to record relocations for surfaces states created outside of
> > the anv_CreateImageView path.
> >
> > Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> > ---
> >  src/intel/vulkan/genX_cmd_buffer.c | 45 +++++++++++++++++++++---------
> > --------
> >  1 file changed, 25 insertions(+), 20 deletions(-)
> >
> > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> > b/src/intel/vulkan/genX_cmd_buffer.c
> > index 4698270abb..d5cc358aec 100644
> > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > @@ -167,17 +167,20 @@ add_surface_state_reloc(struct anv_cmd_buffer
> > *cmd_buffer,
> >  }
> >
> >  static void
> > -add_image_view_relocs(struct anv_cmd_buffer *cmd_buffer,
> > -                      const struct anv_image_view *iview,
> > -                      enum isl_aux_usage aux_usage,
> > -                      struct anv_state state)
> > +add_image_relocs(struct anv_cmd_buffer * const cmd_buffer,
> > +                 const struct anv_image * const image,
> > +                 const VkImageAspectFlags aspect_mask,
> > +                 const enum isl_aux_usage aux_usage,
> > +                 const struct anv_state state)
> >  {
> >     const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
> > +   const uint32_t surf_offset = image->offset +
> > +      anv_image_get_surface_for_aspect_mask(image, aspect_mask)->offset;
> >
> > -   add_surface_state_reloc(cmd_buffer, state, iview->bo, iview->offset);
> > +   add_surface_state_reloc(cmd_buffer, state, image->bo, surf_offset);
> >
> >     if (aux_usage != ISL_AUX_USAGE_NONE) {
> > -      uint32_t aux_offset = iview->offset + iview->image->aux_surface.
> > offset;
> > +      uint32_t aux_offset = surf_offset + image->aux_surface.offset;
> >
> 
> Ugh... This is not quite the calculation we want (and neither was the old
> one!)  surf_offset is image->offset plus the offset of the main color
> surface so adding that to aux_surface.offset isn't right.  I think you just
> want image->offset + image->aux_surface.offset. That said, it's always safe
> because every surface that has aux (color and depth) has surface->offset ==
> 0.  We should fix it while we're here anyway.
> 
> Other than that, this patch seems perfectly reasonable.
> 
> 

Fixed in v2.


More information about the mesa-dev mailing list