[Intel-gfx] [PATCH] drm/i915/guc: Use formalized struct definition for ads object

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 15 11:19:01 UTC 2017


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 at intel.com>
> > 
> > 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 at intel.com>
> > Cc: Oscar Mateo <oscar.mateo at intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> > Cc: Chris Wilson <chris at chris-wilson.co.uk>
> > Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  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 :)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list