Quoting Daniele Ceraolo Spurio (2018-03-08 23:46:27)
> The mmio bases we're currently storing in the intel_engines array are
> only valid for a subset of gens, so we need to ignore them and use
> different values in some cases. Instead of doing that, we can have a
> table of [starting gen, mmio base] pairs for each engine in
> intel_engines and select the correct one based on the gen we're running
> on in a consistent way.
>
> v2: document that the list goes in reverse order, update starting gen
> for render (Chris)
>
> Cc: Chris Wilson <[email protected]>
> Cc: Mika Kuoppala <[email protected]>
> Cc: Tvrtko Ursulin <[email protected]>
> Signed-off-by: Daniele Ceraolo Spurio <[email protected]>
> ---
> +static u32 __engine_mmio_base(struct drm_i915_private *i915,
> + const struct engine_mmio_base* bases)
> +{
> + int i;
> +
> + for (i = 0; i < MAX_MMIO_BASES; i++)
> + if (INTEL_GEN(i915) >= bases[i].gen)
> + break;
> +
> + GEM_BUG_ON(i == MAX_MMIO_BASES);
> + GEM_BUG_ON(!bases[i].base);
Idly contemplating
do {
if (INTEL_GEN(i915) >= bases->gen)
return bases->base;
bases++;
} while(1);
given the selftest for validating adding new gen.
Reviewed-by: Chris Wilson <[email protected]>
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx