drm/i915: Small compaction of the engine init code
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 23 Jun 2016 13:52:41 +0000 (14:52 +0100)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 24 Jun 2016 11:09:00 +0000 (12:09 +0100)
commita19d6ff29a825418f1407dfb1c909648db057924
tree80ff87af4204f0c140d89fae7c15eddcd718371a
parent10bb667223f3d4e9c4eb53595f9d7f67a1018952
drm/i915: Small compaction of the engine init code

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)

v4: Chris Wilson suggested a nicer engine init loop.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1466689961-23232-1-git-send-email-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_lrc.c