From: Chris Wilson <chris@chris-wilson.co.uk>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/guc: Use formalized struct definition for ads object
Date: Wed, 15 Mar 2017 11:47:26 +0000 [thread overview]
Message-ID: <20170315114726.GW2118@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <20170315114411.GB155100@mwajdecz-MOBL1.ger.corp.intel.com>
On Wed, Mar 15, 2017 at 12:44:11PM +0100, Michal Wajdeczko wrote:
> 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@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@intel.com>
> > > > Cc: Oscar Mateo <oscar.mateo@intel.com>
> > > > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > > > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > > > Reviewed-by: Chris Wilson <chris@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 :)
>
> 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.
base + offset is better. Hmm, went with ptr_offsetof() since I had to
introduce a newline and I thought similarity with the underlying macro
would be sensible for i915_utils.h
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-03-15 11:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 13:33 [PATCH v3] drm/i915/guc: Use formalized struct definition for ads object Michal Wajdeczko
2017-03-14 19:18 ` ✓ Fi.CI.BAT: success for drm/i915/guc: Use formalized struct definition for ads object (rev3) Patchwork
2017-03-14 20:53 ` [PATCH] drm/i915/guc: Use formalized struct definition for ads object Chris Wilson
2017-03-15 11:02 ` Michal Wajdeczko
2017-03-15 11:19 ` Chris Wilson
2017-03-15 11:44 ` Michal Wajdeczko
2017-03-15 11:47 ` Chris Wilson [this message]
2017-03-15 11:49 ` Chris Wilson
2017-03-16 10:53 ` Joonas Lahtinen
2017-03-15 8:33 ` ✗ Fi.CI.BAT: failure for drm/i915/guc: Use formalized struct definition for ads object (rev4) Patchwork
2017-03-15 8:47 ` ✓ Fi.CI.BAT: success " Patchwork
2017-03-15 12:46 ` ✓ Fi.CI.BAT: success for drm/i915/guc: Use formalized struct definition for ads object (rev5) Patchwork
2017-03-15 15:48 ` Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2017-03-07 10:29 [PATCH] drm/i915/guc: Use formalized struct definition for ads object Michal Wajdeczko
2017-03-07 10:39 ` Chris Wilson
2017-03-07 10:44 ` Michal Wajdeczko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170315114726.GW2118@nuc-i3427.alporthouse.com \
--to=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.