Re: [PATCH] drm/i915: Small compaction of the engine init code

Chris Wilson
2016-06-22T16:28:43Z

On Wed, Jun 22, 2016 at 05:21:01PM +0100, Tvrtko Ursulin wrote:
>
> On 22/06/16 17:10, Chris Wilson wrote:
> >On Wed, Jun 22, 2016 at 04:55:51PM +0100, Tvrtko Ursulin wrote:
> >>+ BUILD_BUG_ON((1 << RCS) != RENDER_RING);
> >>+ BUILD_BUG_ON((1 << BCS) != BLT_RING);
> >>+ BUILD_BUG_ON((1 << VCS) != BSD_RING);
> >>+ BUILD_BUG_ON((1 << VCS2) != BSD2_RING);
> >>+ BUILD_BUG_ON((1 << VECS) != VEBOX_RING);
> >
> >Heh, isn't that the very definition of those in the header.
> >Planning for some array compaction?
>
> No I was trying to protect against someone changing the definitions
> of RENDER_RING & co since the loop below this depends on that. Maybe
> it was too paranoid. Or maybe better, I could add HAS_ENGINE(id) and
> cement that in one place instead of this many BUILD_BUG_ONs.

Hmm, the logical_rings[] table is ordered by id, so it should be in
the same order as the mask. It is probably going to be safer to remove
the RENDER_RING et al and replace them with BIT(RCS) when making the
masks.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre