[igt-dev] [PATCH i-g-t v2] tests/gem_create: Test unaligned BO size update
Chris Wilson
chris at chris-wilson.co.uk
Tue Mar 26 18:05:47 UTC 2019
Quoting Michał Winiarski (2019-03-26 17:39:25)
> The driver is supposed to update the size when it's trying to outsmart
> userspace. Let's test it.
>
> v2: Rework to use local ioctl wrapper (Chris)
>
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Janusz Krzysztofik <janusz.krzysztofik at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> ---
> +static void size_update(int fd)
> +{
> + int size_initial_nonaligned = 16;
16 is the size of one xmm register. It might be valid one year ;)
I would pick a !power-of-two to be sure it will never be a valid size.
15?
> + struct drm_i915_gem_create create = {
> + .size = size_initial_nonaligned,
> + };
> +
> + igt_assert_eq(create_ioctl(fd, &create), 0);
> + igt_assert_neq(create.size, size_initial_nonaligned);
> +}
But yes, that seems reasonable avoidance of saying precisely what
the alignment might be since PAGE_SIZE is pure accident, although
commonplace throughout the ABI.
> @@ -233,4 +260,7 @@ igt_main
>
> igt_subtest("create-clear")
> always_clear(fd, 30);
> +
> + igt_subtest("create-size-update")
> + size_update(fd);
I'd place it earlier since it is a basic test. But whatever works.
With s/16/15/
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the igt-dev
mailing list