Re: [PATCH] drm/i915/guc: Use formalized struct definition for ads object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 15, 2017 at 11:19:01AM +0000, Chris Wilson wrote:
> On Wed, Mar 15, 2017 at 12:02:21PM +0100, Michal Wajdeczko wrote:
> > On Tue, Mar 14, 2017 at 08:53:02PM +0000, Chris Wilson wrote:
> > > From: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>
> > > 
> > > Manual pointer manipulation is error prone. Let compiler calculate
> > > right offsets for us in case we need to change ads layout.
> > > 
> > > v2: don't call it object (Chris)
> > > v3: restyle offset assignments (Chris)
> > > v4: stylistic reductions
> > > 
> > > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>
> > > Cc: Oscar Mateo <oscar.mateo@xxxxxxxxx>
> > > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> > > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx>
> > > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > > Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > > ---
> > >  drivers/gpu/drm/i915/i915_guc_submission.c | 51 ++++++++++++++----------------
> > >  1 file changed, 23 insertions(+), 28 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> > > index b4d24cd7639a..3651a1b0d13c 100644
> > > --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> > > +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> > > @@ -806,26 +806,27 @@ static void guc_policies_init(struct guc_policies *policies)
> > >  	policies->is_valid = 1;
> > >  }
> > >  
> > > +#define p_offset(ptr, member) offsetof(typeof(*ptr), member)
> > > +
> > 
> > I would place this helper macro in i915_utils.h ;)
> 
> I wanted to call it ptr_offset, more suitale for i915_utils.h, but
> didn't fit into 80cols :)

You can save few chars by renaming 'offset' into 'base'

	u32 offset;
	...
	base = i915_ggtt_offset(vma);
	...
	blob->ads.reg_state_buffer = base + ptr_offset(blob, reg_state_buffer);

then we are exactly at 80 column.

This will also make the code more cleaner as offset + offset didn't look good.

-Michal
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux