[Mesa-dev] [PATCH 15/57] i965/fs: Handle fixed HW GRF subnr in reg_offset().

Iago Toral itoral at igalia.com
Mon Sep 12 06:20:07 UTC 2016


On Fri, 2016-09-09 at 13:04 -0700, Francisco Jerez wrote:
> Iago Toral <itoral at igalia.com> writes:
> 
> > 
> > On Wed, 2016-09-07 at 18:48 -0700, Francisco Jerez wrote:
> > > 
> > > This will be useful later on when we start using reg_offset() on
> > > fixed
> > > hardware registers.
> > > ---
> > >  src/mesa/drivers/dri/i965/brw_ir_fs.h | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h
> > > b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> > > index 2e5c8e5..4ac9baa 100644
> > > --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
> > > +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> > > @@ -187,7 +187,8 @@ static inline unsigned
> > >  reg_offset(const fs_reg &r)
> > >  {
> > >     return (r.file == VGRF || r.file == IMM ? 0 : r.nr) *
> > > -          (r.file == UNIFORM ? 4 : REG_SIZE) + r.offset;
> > > +          (r.file == UNIFORM ? 4 : REG_SIZE) + r.offset +
> > > +          (r.file == ARF || r.file == FIXED_GRF ? r.subnr : 0);
> > I guess that for ARF and FIXED_GRF r.offset is expected to be 0,
> > right?
> It doesn't really matter as far as this function is concerned: If
> it's
> zero it won't affect the result of the function, if it's non-zero it
> will be taken into account correctly.  Some other back-end code may
> break though if a fixed grf register has non-zero offset, but I'd
> call
> that code responsible for asserting "offset == 0" if it's unable to
> deal
> with it.

Ok, that sounds reasonable.

> > 
> > In that case, should we make it more explicit here by adding an
> > assert,
> > and/or maybe separating the offset calculation
> > for these register types
> > (so it only uses nr and subnr) from the others?
> > 
> > Iago
> > 
> > > 
> > >  }
> > >  
> > >  /**


More information about the mesa-dev mailing list