[PATCH 12/34] drm: kselftest for drm_mm and alignment

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Thu Dec 15 08:59:10 UTC 2016


On ma, 2016-12-12 at 11:53 +0000, Chris Wilson wrote:
> Check that we can request alignment to any power-of-two or prime using a
> plain drm_mm_node_insert(), and also handle a reasonable selection of
> primes.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

<SNIP>

> +static int igt_align(void *ignored)
> +{
> +	struct drm_mm mm;
> +	struct drm_mm_node *node, *next;
> +	int ret = -EINVAL;
> +	int prime;
> +
> +	drm_mm_init(&mm, 1, U64_MAX - 1);
> +
> +	drm_for_each_prime(prime, 8192) {
> +		u64 size;
> +		int err;
> +
> +		node = kzalloc(sizeof(*node), GFP_KERNEL);
> +		if (!node) {
> +			ret = -ENOMEM;
> +			goto out;
> +		}

If the amount of primes would be predictable (pun intended), we could
malloc the nodes at one go.

Other than that, looks like I reviewed this already;

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

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the dri-devel mailing list