Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Daniel Vetter <daniel@ffwll.ch>, Ben Widawsky <ben@bwidawsk.net>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/4] drm/i915: Use eb for more stuff
Date: Thu, 13 Oct 2011 13:00:02 +0100	[thread overview]
Message-ID: <e0d58a$1ru7mp@orsmga002.jf.intel.com> (raw)
In-Reply-To: <20111013085825.GF2938@phenom.ffwll.local>

On Thu, 13 Oct 2011 10:58:25 +0200, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Wed, Oct 12, 2011 at 03:56:22PM -0700, Ben Widawsky wrote:
> > This refactor is useful for some future work I'll be doing on the
> > execbuffer path. In addition to being a pretty easy prerequisite, it
> > also helped me track down the bug uncovered in the first patch.
> > 
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_execbuffer.c |  102 ++++++++++++++--------------
> >  1 files changed, 51 insertions(+), 51 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > index 182a2b9..b3beaae 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > @@ -40,6 +40,16 @@ struct change_domains {
> >  	uint32_t flips;
> >  };
> >  
> > +struct eb_objects {
> > +	struct drm_i915_gem_object *batch_obj;
> > +	struct list_head objects;
> > +	int buffer_count;
> > +	int mode;
> > +	int and;
> 
> While you whack this code, can you do an s/and/end, I think that's just a
> typo ...

It was meant to be 'and' since it was the value of the mask I was anding
with. I'm sorry I appear to have spent too much time inside the Xserver,
end = and + 1.
> 
> > +	struct hlist_head buckets[0];
> > +	/* DO NOT PUT ANYTHING HERE */
> 
> When you drop the array size, the compiler will enforce that for you (for
> $compiler = gcc at least).

I wanted to say that surely the comment was obvious from the '[0]' ;-)

> 
> > +};
> > +
> >  /*
> >   * Set the next domain for the specified object. This
> >   * may not actually perform the necessary flushing/invaliding though,
> > @@ -207,11 +217,6 @@ i915_gem_object_set_to_gpu_domain(struct drm_i915_gem_object *obj,
> >  		cd->flush_rings |= ring->id;
> >  }
> >  
> > -struct eb_objects {
> > -	int and;
> > -	struct hlist_head buckets[0];
> > -};
> > -
> >  static struct eb_objects *
> >  eb_create(int size)
> >  {
> > @@ -225,6 +230,8 @@ eb_create(int size)
> >  	if (eb == NULL)
> >  		return eb;
> >  
> > +	INIT_LIST_HEAD(&eb->objects);
> > +
> >  	eb->and = count - 1;
> >  	return eb;
> >  }
> > @@ -232,12 +239,22 @@ eb_create(int size)
> >  static void
> >  eb_reset(struct eb_objects *eb)
> >  {
> > +	while (!list_empty(&eb->objects)) {
> 
> list_for_each_entry_safe

No, the while (!empty) is the more common and much simpler idiom to use
here when clearing a list.

> > -	mode = args->flags & I915_EXEC_CONSTANTS_MASK;
> > -	ret = i915_gem_set_constant_offset(ring, mode);
> > +	eb->mode = args->flags & I915_EXEC_CONSTANTS_MASK;
> > +	ret = i915_gem_set_constant_offset(ring, eb->mode);
> 
> The eb->mode refactor here otoh looks a bit superflous. Is this needed for
> a future patch of yours?

I'm waiting to see how this pans out as well... ;-)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

  reply	other threads:[~2011-10-13 12:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12  4:43 [PATCH 0/5] execbuffer cleanups + fixes Ben Widawsky
2011-10-12  4:43 ` [PATCH 1/5] drm/i915: execbuffer simplification Ben Widawsky
2011-10-12  4:43 ` [PATCH 2/5] drm/i915: extract constant offset setting Ben Widawsky
2011-10-12 16:46   ` Ben Widawsky
2011-10-12  4:43 ` [PATCH 3/5] drm/i915: make eb structure do more Ben Widawsky
2011-10-12  4:43 ` [PATCH 4/5] drm/i915: relative_constants_mode race fix Ben Widawsky
2011-10-12  4:43 ` [PATCH 5/5] drm/i915: Force sync command ordering (Gen6+) Ben Widawsky
2011-10-12  8:01   ` Ben Widawsky
2011-10-12  9:51   ` Daniel Vetter
2011-10-12 16:59 ` [PATCH 0/5] execbuffer cleanups + fixes Ben Widawsky
2011-10-12 22:56 ` [PATCH 0/4] pre-v2 series Ben Widawsky
2011-10-12 22:56   ` [PATCH 1/4] drm/i915: relative_constants_mode race fix Ben Widawsky
2011-10-13  8:35     ` Daniel Vetter
2011-10-13 17:25       ` Ben Widawsky
2011-10-12 22:56   ` [PATCH 2/4] drm/i915: Force sync command ordering (Gen6+) Ben Widawsky
2011-10-13  8:44     ` Daniel Vetter
2011-10-12 22:56   ` [PATCH 3/4] drm/i915: extract constant offset setting Ben Widawsky
2011-10-13  8:46     ` Daniel Vetter
2011-10-13 17:14       ` Ben Widawsky
2011-10-12 22:56   ` [PATCH 4/4] drm/i915: Use eb for more stuff Ben Widawsky
2011-10-13  8:58     ` Daniel Vetter
2011-10-13 12:00       ` Chris Wilson [this message]
2011-10-13 12:49         ` Daniel Vetter
2011-10-13 17:31         ` Ben Widawsky

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='e0d58a$1ru7mp@orsmga002.jf.intel.com' \
    --to=chris@chris-wilson.co.uk \
    --cc=ben@bwidawsk.net \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox