Re: [PATCH 5/9] drm: kselftest for drm_mm and alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On pe, 2016-12-09 at 13:08 +0000, Chris Wilson wrote:
> Check that we can request alignment to any power-of-two or prime using a
> plain drm_mm_node_insert().
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

<SNIP>

> +static int igt_align(void *ignored)
> +{
> +	struct drm_mm mm;
> +	struct drm_mm_node *node, *next;
> +	int ret = -EINVAL;
> +	int n;
> +
> +	drm_mm_init(&mm, 1, -2);

U64_MAX - 1?

> +	if (!drm_mm_clean(&mm)) {
> +		pr_err("mm not empty on creation\n");
> +		goto out;
> +	}
> +

Can be dropped.

> +	for_each_prime(n, 8192) {

This is one more spot, how about DRM_SELFTEST_MAX_PRIME or so?

> +		int err;
> +
> +		node = kzalloc(sizeof(*node), GFP_KERNEL);
> +		if (!node) {
> +			ret = -ENOMEM;
> +			goto out;
> +		}
> +
> +		err = drm_mm_insert_node_generic(&mm, node,
> +						 next_prime_number(n),/* size */
> +						 n, /* alignment */

<rant>If there just was a way of naming variables so this comments was
not needed.</rant> Maybe the variable could be "align".

> +static int igt_align_pot(int max)
> +{
> +	struct drm_mm mm;
> +	struct drm_mm_node *node, *next;
> +	int bit;
> +	int ret = -EINVAL;
> +
> +	drm_mm_init(&mm, 1, -2);
> +	if (!drm_mm_clean(&mm)) {
> +		pr_err("mm not empty on creation\n");
> +		goto out;
> +	}
> +
> +	for (bit = max - 1; bit; bit--) {
> +		int err;
> +
> +		node = kzalloc(sizeof(*node), GFP_KERNEL);
> +		if (!node) {
> +			ret = -ENOMEM;
> +			goto out;
> +		}
> +
> +		err = drm_mm_insert_node_generic(&mm, node, 1,
> +						 BIT_ULL(bit), bit,

The color is not used, so just set it to 0.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux