[Intel-gfx] [PATCH v3] drm/i915: Small compaction of the engine init code

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 23 11:25:13 UTC 2016


On Thu, Jun 23, 2016 at 12:12:29PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at 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 :)

> +	for (i = 0;
> +		i < I915_NUM_ENGINES && i < ARRAY_SIZE(logical_rings); i++) {

HAS_ENGINE() == false if i >= I915_NUM_ENGINES
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list