[Mesa-dev] [PATCH v2 01/13] intel/blorp: Assert levels and layers are in range

Nanley Chery nanleychery at gmail.com
Tue Jun 27 17:15:09 UTC 2017


On Thu, Jun 22, 2017 at 10:32:42AM -0700, Jason Ekstrand wrote:
> On Thu, Jun 22, 2017 at 10:02 AM, Nanley Chery <nanleychery at gmail.com>
> wrote:
> 
> > On Thu, Jun 22, 2017 at 09:59:44AM -0700, Nanley Chery wrote:
> > > On Thu, Jun 22, 2017 at 09:55:50AM -0700, Nanley Chery wrote:
> > > > On Wed, Jun 21, 2017 at 06:07:29PM -0700, Jason Ekstrand wrote:
> > > > > On Wed, Jun 21, 2017 at 5:15 PM, Nanley Chery <nanleychery at gmail.com>
> > wrote:
> > > > >
> > > > > > v2 (Jason Ekstrand):
> > > > > > - Update commit title
> > > > > > - Check aux level and layer as well
> > > > > >
> > > > > > Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> > > > > > Reviewed-by: Iago Toral Quiroga <itoral at igalia.com> (v1)
> > > > > > ---
> > > > > >  src/intel/blorp/blorp.c       | 7 +++++++
> > > > > >  src/intel/blorp/blorp_clear.c | 4 ----
> > > > > >  2 files changed, 7 insertions(+), 4 deletions(-)
> > > > > >
> > > > > > diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c
> > > > > > index 9c88658e8a..7e30e20a59 100644
> > > > > > --- a/src/intel/blorp/blorp.c
> > > > > > +++ b/src/intel/blorp/blorp.c
> > > > > > @@ -66,6 +66,8 @@ brw_blorp_surface_info_init(struct
> > blorp_context *blorp,
> > > > > >                              unsigned int level, unsigned int
> > layer,
> > > > > >                              enum isl_format format, bool
> > is_render_target)
> > > > > >  {
> > > > > > +   assert(level < surf->surf->levels);
> > > > > > +
> > > > > >     info->enabled = true;
> > > > > >
> > > > > >     if (format == ISL_FORMAT_UNSUPPORTED)
> > > > > > @@ -90,6 +92,9 @@ brw_blorp_surface_info_init(struct
> > blorp_context *blorp,
> > > > > >     if (info->aux_usage != ISL_AUX_USAGE_NONE) {
> > > > > >        info->aux_surf = *surf->aux_surf;
> > > > > >        info->aux_addr = surf->aux_addr;
> > > > > > +      assert(level < info->aux_surf.levels);
> > > > > > +      assert(layer < MAX2(info->aux_surf.logical_level0_px.depth
> > >>
> > > > > > level,
> > > > > > +                          info->aux_surf.logical_level0_
> > px.array_len));
> > > > > >     }
> > > > > >
> > > > > >     info->clear_color = surf->clear_color;
> > > > > > @@ -106,6 +111,8 @@ brw_blorp_surface_info_init(struct
> > blorp_context
> > > > > > *blorp,
> > > > > >     info->view.array_len = MAX2(info->surf.logical_
> > level0_px.depth,
> > > > > >                                 info->surf.logical_level0_px.
> > array_len);
> > > > > >
> > > > > > +   assert(layer < info->view.array_len);
> > > > > >
> > > > >
> > > > > Might be more straightforward to move this assert to the top and
> > make it
> > > > > look like the aux assert.  I don't care too much though.
> > > > >
> > > > >
> > > >
> > > > I agree. Could I apply your rb if I instead put this under the first
> > > > assert in the function?
> > > >
> > > >    assert(layer < MAX2(info->surf.logical_level0_px.depth >> level,
> > > >                        info->surf.logical_level0_px.array_len));
> > > >
> > >
> > > Whoops, info->surf is not yet defined there. It should be:
> > >      assert(layer < MAX2(surf->surf.logical_level0_px.depth >> level,
> > >                          surf->surf.logical_level0_px.array_len));
> >
> > ... and I forgot that surf->surf is a pointer. Sorry,
> >
> > surf->surf->logical[...]
> >
> 
> No worries.  Yes, you can put my RB on it with that assuming you get it to
> compile. :-)
> 
> --Jason
> 
> 

Got it working and pushed.

> > > > > > +
> > > > > >     if (!is_render_target &&
> > > > > >         (info->surf.dim == ISL_SURF_DIM_3D ||
> > > > > >          info->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY)) {
> > > > > > diff --git a/src/intel/blorp/blorp_clear.c
> > b/src/intel/blorp/blorp_clear.c
> > > > > > index efacadfebe..369e18726f 100644
> > > > > > --- a/src/intel/blorp/blorp_clear.c
> > > > > > +++ b/src/intel/blorp/blorp_clear.c
> > > > > > @@ -707,10 +707,6 @@ blorp_ccs_resolve(struct blorp_batch *batch,
> > > > > >     struct blorp_params params;
> > > > > >     blorp_params_init(&params);
> > > > > >
> > > > > > -   /* Layered and mipmapped fast clear is only available from Gen8
> > > > > > onwards. */
> > > > > > -   assert(ISL_DEV_GEN(batch->blorp->isl_dev) >= 8 ||
> > > > > > -          (level == 0 && layer == 0));
> > > > > > -
> > > > > >     brw_blorp_surface_info_init(batch->blorp, &params.dst, surf,
> > > > > >                                 level, layer, format, true);
> > > > > >
> > > > > > --
> > > > > > 2.13.1
> > > > > >
> > > > > > _______________________________________________
> > > > > > 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