[Intel-gfx] [PATCH] drm/i915/selftests: Exercise rc6 handling
Chris Wilson
chris at chris-wilson.co.uk
Thu Nov 14 09:13:09 UTC 2019
Quoting Chris Wilson (2019-11-14 08:54:43)
> +static struct intel_engine_cs **
> +randomised_engines(struct intel_gt *gt,
> + struct rnd_state *prng,
> + unsigned int *count)
> +{
> + struct intel_engine_cs *engine, **engines;
> + enum intel_engine_id id;
> + int n;
> +
> + n = 0;
> + for_each_engine(engine, gt, id)
> + n++;
> + if (!n)
> + return NULL;
> +
> + engines = kmalloc_array(n, sizeof(*engines), GFP_KERNEL);
> + if (!engines)
> + return NULL;
> +
> + n = 0;
> + for_each_engine(engine, gt, id)
> + engines[n++] = engine;
> +
> + i915_prandom_shuffle(engines, sizeof(*engines), n, prng);
> +
*count = n;
> + return engines;
> +}
More information about the Intel-gfx
mailing list