[Intel-gfx] [PATCH 09/11] drm/i915: Refactor instdone loops on new subslice functions

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 21 22:56:33 UTC 2019


Quoting Stuart Summers (2019-08-21 00:05:42)
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> index a82cea95c2f2..99bee06cdbdb 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> @@ -576,20 +576,19 @@ intel_engine_is_virtual(const struct intel_engine_cs *engine)
>         return engine->flags & I915_ENGINE_IS_VIRTUAL;
>  }
>  
> -#define instdone_slice_mask(dev_priv__) \
> -       (IS_GEN(dev_priv__, 7) ? \
> -        1 : RUNTIME_INFO(dev_priv__)->sseu.slice_mask)
> -
> -#define instdone_subslice_mask(dev_priv__) \
> -       (IS_GEN(dev_priv__, 7) ? \
> -        1 : RUNTIME_INFO(dev_priv__)->sseu.subslice_mask[0])
> -
> -#define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
> -       for ((slice__) = 0, (subslice__) = 0; \
> -            (slice__) < I915_MAX_SLICES; \
> -            (subslice__) = ((subslice__) + 1) < I915_MAX_SUBSLICES ? (subslice__) + 1 : 0, \
> -              (slice__) += ((subslice__) == 0)) \
> -               for_each_if((BIT(slice__) & instdone_slice_mask(dev_priv__)) && \
> -                           (BIT(subslice__) & instdone_subslice_mask(dev_priv__)))
> -
> +#define instdone_has_slice(dev_priv___, sseu___, slice___) \
> +       ((IS_GEN(dev_priv___, 7) ? 1 : ((sseu___)->slice_mask)) & \
> +       BIT(slice___))

       ((IS_GEN(dev_priv___, 7) ? 1 : \
       ((sseu___)->slice_mask)) & BIT(slice___))

That split is marginally easier to read

So much for hoping the gen7 special case just disappears.

> +#define instdone_has_subslice(dev_priv__, sseu__, slice__, subslice__) \
> +       (IS_GEN(dev_priv__, 7) ? (1 & BIT(subslice__)) : \
> +        intel_sseu_has_subslice(sseu__, 0, subslice__))
> +
> +#define for_each_instdone_slice_subslice(dev_priv_, sseu_, slice_, subslice_) \
> +       for ((slice_) = 0, (subslice_) = 0; (slice_) < I915_MAX_SLICES; \
> +            (subslice_) = ((subslice_) + 1) % I915_MAX_SUBSLICES, \
> +            (slice_) += ((subslice_) == 0)) \
> +               for_each_if((instdone_has_slice(dev_priv_, sseu_, slice_)) && \
> +                           (instdone_has_subslice(dev_priv_, sseu_, slice_, \
> +                                                   subslice_)))

That was less convoluted than I was expecting from previous skims.
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list