All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/i915: Small compaction of the engine init code
Date: Thu, 23 Jun 2016 14:25:05 +0100	[thread overview]
Message-ID: <20160623132505.GD28219@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <576BE147.9060305@linux.intel.com>

On Thu, Jun 23, 2016 at 02:16:55PM +0100, Tvrtko Ursulin wrote:
> 
> On 23/06/16 13:11, Chris Wilson wrote:
> >On Thu, Jun 23, 2016 at 12:46:42PM +0100, Tvrtko Ursulin wrote:
> >>
> >>On 23/06/16 12:25, Chris Wilson wrote:
> >>>On Thu, Jun 23, 2016 at 12:12:29PM +0100, Tvrtko Ursulin wrote:
> >>>>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >>>>
> >>>>Effectively removes one layer of indirection between the mask of
> >>>>possible engines and the engine constructors. Instead of spelling
> >>>>out in code the mapping of HAS_<engine> to constructors, makes
> >>>>more use of the recently added data driven approach by putting
> >>>>engine constructor vfuncs into the table as well.
> >>>>
> >>>>Effect is fewer lines of source and smaller binary.
> >>>>
> >>>>At the same time simplify the error handling since engine
> >>>>destructors can run on unitialized engines anyway.
> >>>>
> >>>>Similar approach could be done for legacy submission is wanted.
> >>>>
> >>>>v2: Removed ugly BUILD_BUG_ONs in favour of newly introduced
> >>>>     ENGINE_MASK and HAS_ENGINE macros.
> >>>>     Also removed the forward declarations by shuffling functions
> >>>>     around.
> >>>>
> >>>>v3: Warn when logical_rings table does not contain enough data
> >>>>     and disable the engines which could not be initialized.
> >>>>     (Chris Wilson)
> >>>
> >>>I was happy with the BUILD_BUG suggestion :)
> >>
> >>I've changed my mind later. :)
> >>
> >>>>+	for (i = 0;
> >>>>+		i < I915_NUM_ENGINES && i < ARRAY_SIZE(logical_rings); i++) {
> >>>
> >>>HAS_ENGINE() == false if i >= I915_NUM_ENGINES
> >>
> >>Don't follow. :) Why is v3 not good enough?
> >
> >Both (all three) is overkill.
> >
> >I feel like HAS_ENGINE() should encompass i < I915_NUM_ENGINES quite
> >succinctly. For belt and braces,
> >
> >WARN_ON(dev_priv->intel_info.rings_mask & -(1 << I915_NUM_ENGINES)));
> 
> I don't think this works - you meant testing that bits higher than
> BIT(I915_NUM_ENGINES) were not set in ring_mask?

Yes. Higher than BIT(NUM_ENGINES-1), just to make sure we don't end up
setting garbage at some point.
 
> And it probably belongs somewhere else, in common code which
> initializes intel_device_info I think.

Possibly. I think the engine initialisation path is a good choice
though, since that has the knowlege of what will be setup.

Either here (with the goal of using this as the basis for future
unification), or in the caller.
-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

  reply	other threads:[~2016-06-23 13:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 15:55 [PATCH] drm/i915: Small compaction of the engine init code Tvrtko Ursulin
2016-06-22 16:10 ` Chris Wilson
2016-06-22 16:21   ` Tvrtko Ursulin
2016-06-22 16:28     ` Chris Wilson
2016-06-22 16:35     ` [PATCH v2] " Tvrtko Ursulin
2016-06-22 16:59       ` Chris Wilson
2016-06-23 10:26         ` Tvrtko Ursulin
2016-06-23 10:47           ` Chris Wilson
2016-06-23 11:12             ` [PATCH v3] " Tvrtko Ursulin
2016-06-23 11:25               ` Chris Wilson
2016-06-23 11:46                 ` Tvrtko Ursulin
2016-06-23 12:11                   ` Chris Wilson
2016-06-23 13:16                     ` Tvrtko Ursulin
2016-06-23 13:25                       ` Chris Wilson [this message]
2016-06-23 13:52                         ` [PATCH v4] " Tvrtko Ursulin
2016-06-23 14:03                           ` Chris Wilson
2016-06-22 16:18 ` ✓ Ro.CI.BAT: success for " Patchwork
2016-06-22 17:09 ` ✗ Ro.CI.BAT: warning for drm/i915: Small compaction of the engine init code (rev2) Patchwork
2016-06-24 10:10 ` ✗ Ro.CI.BAT: failure for drm/i915: Small compaction of the engine init code (rev3) Patchwork
2016-06-24 10:11 ` ✗ Ro.CI.BAT: failure for drm/i915: Small compaction of the engine init code (rev4) Patchwork
2016-06-24 11:09   ` Tvrtko Ursulin

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=20160623132505.GD28219@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.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.