[igt-dev] [PATCH i-g-t v2 16/16] tests/api-intel-allocator: Adopt to exercise allocator to Xe
Karolina Stolarek
karolina.stolarek at intel.com
Fri Jul 7 10:11:54 UTC 2023
On 6.07.2023 08:05, Zbigniew Kempczyński wrote:
> Xe vm binding requires some cooperation from allocator side (tracking
> alloc()/free()) operations. This diverges the path internally inside
> the allocator so it is necessary to check if allocator supports
> properly both drivers.
Reviewed-by: Karolina Stolarek <karolina.stolarek at intel.com>
>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> ---
> tests/i915/api_intel_allocator.c | 25 +++++++++++++++++--------
> 1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allocator.c
> index 238e76c9fd..e70de0e1d0 100644
> --- a/tests/i915/api_intel_allocator.c
> +++ b/tests/i915/api_intel_allocator.c
> @@ -9,6 +9,9 @@
> #include "igt.h"
> #include "igt_aux.h"
> #include "intel_allocator.h"
> +#include "xe/xe_ioctl.h"
> +#include "xe/xe_query.h"
> +
> /**
> * TEST: api intel allocator
> * Category: Infrastructure
> @@ -454,6 +457,7 @@ static void __simple_allocs(int fd)
> uint32_t handles[SIMPLE_GROUP_ALLOCS];
> uint64_t ahnd;
> uint32_t ctx;
> + bool is_xe = is_xe_device(fd);
> int i;
>
> ctx = rand() % 2;
> @@ -463,7 +467,12 @@ static void __simple_allocs(int fd)
> uint32_t size;
>
> size = (rand() % 4 + 1) * 0x1000;
> - handles[i] = gem_create(fd, size);
> + if (is_xe)
> + handles[i] = xe_bo_create_flags(fd, 0, size,
> + system_memory(fd));
> + else
> + handles[i] = gem_create(fd, size);
> +
> intel_allocator_alloc(ahnd, handles[i], size, 0x1000);
> }
>
> @@ -573,8 +582,6 @@ static void reopen(int fd)
> {
> int fd2;
>
> - igt_require_gem(fd);
> -
> fd2 = drm_reopen_driver(fd);
>
> __reopen_allocs(fd, fd2, true);
> @@ -587,8 +594,6 @@ static void reopen_fork(int fd)
> {
> int fd2;
>
> - igt_require_gem(fd);
> -
> intel_allocator_multiprocess_start();
>
> fd2 = drm_reopen_driver(fd);
> @@ -838,7 +843,7 @@ igt_main
> struct allocators *a;
>
> igt_fixture {
> - fd = drm_open_driver(DRIVER_INTEL);
> + fd = drm_open_driver(DRIVER_INTEL | DRIVER_XE);
> atomic_init(&next_handle, 1);
> srandom(0xdeadbeef);
> }
> @@ -911,12 +916,16 @@ igt_main
> igt_subtest_f("open-vm")
> open_vm(fd);
>
> - igt_subtest_f("execbuf-with-allocator")
> + igt_subtest_f("execbuf-with-allocator") {
> + igt_require(is_i915_device(fd));
> execbuf_with_allocator(fd);
> + }
>
> igt_describe("Verifies creating and executing bb from gem pool");
> - igt_subtest_f("gem-pool")
> + igt_subtest_f("gem-pool") {
> + igt_require(is_i915_device(fd));
> gem_pool(fd);
> + }
>
> igt_fixture
> drm_close_driver(fd);
More information about the igt-dev
mailing list