[Intel-gfx] [PATCH] drm/i915: Check for a second VCS engine more carefully

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Fri Aug 9 08:57:15 UTC 2019


Quoting Chris Wilson (2019-08-09 08:13:54)
> To use the legacy BSD selector, you must have a second VCS engine, or
> else the ABI simply maps the request for another engine onto VCS0.
> However, we only checked a single VCS1 location and overlooking the
> possibility of a sparse VCS set being mapped to the dense ABI.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 566e8a4844cf..a43a9bd48bc5 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -2200,7 +2200,10 @@ eb_select_legacy_ring(struct i915_execbuffer *eb,
>                 return -1;
>         }
>  
> -       if (user_ring_id == I915_EXEC_BSD && HAS_ENGINE(i915, VCS1)) {
> +       BUILD_BUG_ON(I915_MAX_VCS > 8); /* see hweight8() below */
> +       if (user_ring_id == I915_EXEC_BSD &&
> +           hweight8((INTEL_INFO(i915)->engine_mask >> VCS0) &
> +                    (BIT(I915_MAX_VCS) - 1)) > 1) { /* silly abi is abi */

This is definitely not a hot path, so how about something like:

	hweight64(INTEL_INFO(i915)->engine_mask &
		  GENMASK_ULL(VCS0 + I915_MAX_VCS, VCS0))

Reads better to me. Regardless, this is;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas


More information about the Intel-gfx mailing list