[Mesa-dev] [PATCH 08/23] anv/copy: Use the color_surf from the image to get the block size

Jason Ekstrand jason at jlekstrand.net
Tue May 17 17:32:30 UTC 2016


On Mon, May 16, 2016 at 5:45 PM, Nanley Chery <nanleychery at gmail.com> wrote:

> On Mon, May 16, 2016 at 12:08:13PM -0700, Jason Ekstrand wrote:
> > ---
> >  src/intel/vulkan/anv_meta_copy.c | 29 ++++++++++++++++++++---------
> >  1 file changed, 20 insertions(+), 9 deletions(-)
> >
> > diff --git a/src/intel/vulkan/anv_meta_copy.c
> b/src/intel/vulkan/anv_meta_copy.c
> > index 372333e..df2cc2f 100644
> > --- a/src/intel/vulkan/anv_meta_copy.c
> > +++ b/src/intel/vulkan/anv_meta_copy.c
> > @@ -23,6 +23,18 @@
> >
> >  #include "anv_meta.h"
> >
> > +static VkExtent3D
> > +meta_image_block_size(const struct anv_image *image)
>
> Please replace all uses of block_size with block_dim or similar
> (including the commit message). Block size (bs for short) is currently
> used in the driver to indicate the size of a single compressed-block or
> pixel in bytes.
>

right.  Fixed locally.


>
> With that change,
> Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
>
> > +{
> > +   if (image->aspects == VK_IMAGE_ASPECT_COLOR_BIT) {
> > +      const struct isl_format_layout *isl_layout =
> > +         isl_format_get_layout(image->color_surface.isl.format);
> > +      return (VkExtent3D) { isl_layout->bw, isl_layout->bh,
> isl_layout->bd };
> > +   } else {
> > +      return (VkExtent3D) { 1, 1, 1 };
> > +   }
> > +}
> > +
> >  /* Returns the user-provided VkBufferImageCopy::imageExtent in units of
> >   * elements rather than texels. One element equals one texel or one
> block
> >   * if Image is uncompressed or compressed, respectively.
> > @@ -31,12 +43,11 @@ static struct VkExtent3D
> >  meta_region_extent_el(const struct anv_image *image,
> >                        const struct VkExtent3D *extent)
> >  {
> > -   const struct isl_format_layout *isl_layout =
> > -      anv_format_for_vk_format(image->vk_format)->isl_layout;
> > +   const VkExtent3D block = meta_image_block_size(image);
> >     return anv_sanitize_image_extent(image->type, (VkExtent3D) {
> > -      .width  = DIV_ROUND_UP(extent->width , isl_layout->bw),
> > -      .height = DIV_ROUND_UP(extent->height, isl_layout->bh),
> > -      .depth  = DIV_ROUND_UP(extent->depth , isl_layout->bd),
> > +      .width  = DIV_ROUND_UP(extent->width , block.width),
> > +      .height = DIV_ROUND_UP(extent->height, block.height),
> > +      .depth  = DIV_ROUND_UP(extent->depth , block.depth),
> >     });
> >  }
> >
> > @@ -48,11 +59,11 @@ static struct VkOffset3D
> >  meta_region_offset_el(const struct anv_image *image,
> >                        const struct VkOffset3D *offset)
> >  {
> > -   const struct isl_format_layout *isl_layout =
> image->format->isl_layout;
> > +   const VkExtent3D block = meta_image_block_size(image);
> >     return anv_sanitize_image_offset(image->type, (VkOffset3D) {
> > -      .x = offset->x / isl_layout->bw,
> > -      .y = offset->y / isl_layout->bh,
> > -      .z = offset->z / isl_layout->bd,
> > +      .x = offset->x / block.width,
> > +      .y = offset->y / block.height,
> > +      .z = offset->z / block.depth,
> >     });
> >  }
> >
> > --
> > 2.5.0.400.gff86faf
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160517/f0f979fc/attachment-0001.html>


More information about the mesa-dev mailing list