From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2FE5110E562 for ; Fri, 7 Jul 2023 10:12:12 +0000 (UTC) Message-ID: <416d0a52-816a-127d-4b9f-4361965360a9@intel.com> Date: Fri, 7 Jul 2023 12:11:54 +0200 Content-Language: en-US To: =?UTF-8?Q?Zbigniew_Kempczy=c5=84ski?= References: <20230706060555.282757-1-zbigniew.kempczynski@intel.com> <20230706060555.282757-17-zbigniew.kempczynski@intel.com> From: Karolina Stolarek In-Reply-To: <20230706060555.282757-17-zbigniew.kempczynski@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Subject: Re: [igt-dev] [PATCH i-g-t v2 16/16] tests/api-intel-allocator: Adopt to exercise allocator to Xe List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: 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 > > Signed-off-by: Zbigniew Kempczyński > --- > 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);