[Mesa-dev] [PATCH 4/7] isl: Validate the calculated row pitch

Chad Versace chadversary at chromium.org
Thu Mar 16 23:20:56 UTC 2017


On Wed 15 Mar 2017, Jason Ekstrand wrote:
> On Wed, Mar 15, 2017 at 3:34 PM, Nanley Chery <nanleychery at gmail.com> wrote:
> 
> > On Mon, Mar 13, 2017 at 03:28:01PM -0700, Chad Versace wrote:
> > > Validate that it fits in RENDER_SURFACE_STATE::SurfacePitch or, if it's
> > > an aux surface, AuxiliarySurfacePitch.
> > > ---
> > >  src/intel/isl/isl.c | 35 +++++++++++++++++++++++++++++------
> > >  1 file changed, 29 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
> > > index 784566749b4..405f5b917fe 100644
> > > --- a/src/intel/isl/isl.c
> > > +++ b/src/intel/isl/isl.c
> > > @@ -1089,18 +1089,39 @@ isl_calc_min_row_pitch(const struct isl_device
> > *dev,
> > >     }
> > >  }
> > >
> > > -static uint32_t
> > > +static bool
> > >  isl_calc_row_pitch(const struct isl_device *dev,
> > >                     const struct isl_surf_init_info *surf_info,
> > >                     const struct isl_tile_info *tile_info,
> > >                     enum isl_dim_layout dim_layout,
> > > -                   const struct isl_extent2d *phys_slice0_sa)
> > > +                   const struct isl_extent2d *phys_slice0_sa,
> > > +                   uint32_t *out_row_pitch)
> > >  {
> > >     const uint32_t alignment =
> > >        isl_calc_row_pitch_alignment(surf_info, tile_info);
> > >
> > > -   return isl_calc_min_row_pitch(dev, surf_info, tile_info,
> > phys_slice0_sa,
> > > -                                 alignment);
> > > +   const uint32_t row_pitch =
> > > +      isl_calc_min_row_pitch(dev, surf_info, tile_info, phys_slice0_sa,
> > > +                             alignment);
> > > +
> > > +   const uint32_t row_pitch_tiles = row_pitch /
> > tile_info->phys_extent_B.width;
> > > +
> > > +   /* Check that the pitch fits in RENDER_SURFACE_STATE::SurfacePitch
> > or
> > > +    * AuxiliarySurfacePitch.
> > > +    */
> > > +   if (dim_layout == ISL_DIM_LAYOUT_GEN9_1D) {
> > > +      /* SurfacePitch is ignored for this layout.
> > > +       * FINISHME: How to validate row pitch for ISL_DIM_LAYOUT_GEN9_1D?
> > > +       */
> > > +   } else if (isl_tiling_is_aux(tile_info->tiling)) {
> > > +      if (row_pitch_tiles > (1 << 9))
> > > +         return false;
> > > +   } else if (row_pitch > (1 << 17)) {
> >
> > For SKL at least, shouldn't this be 1 << 18 ?
> >
> 
> I concur

Me too.

Another problem is the max pitch differs for depth buffers.

I'll inspect the genxml more closely, and resend this patch with fixups.
And I'll use the surface usage mask when determining the max pitch.


More information about the mesa-dev mailing list