[igt-dev] [PATCH i-g-t 2/2] tests/gem_exec_basic: Add gem create fallback

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Dec 8 17:24:16 UTC 2021


If we're on stable kernels which still don't have local memory turned on
provide a fallback to generic gem_create() call when requested region is
the system memory.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
 tests/i915/gem_exec_basic.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_exec_basic.c b/tests/i915/gem_exec_basic.c
index 008a35d0a..6307e929c 100644
--- a/tests/i915/gem_exec_basic.c
+++ b/tests/i915/gem_exec_basic.c
@@ -28,12 +28,15 @@
 
 IGT_TEST_DESCRIPTION("Basic sanity check of execbuf-ioctl rings.");
 
-static uint32_t batch_create(int fd, uint32_t batch_size, uint32_t region)
+static uint32_t batch_create(int fd, uint64_t batch_size, uint32_t region)
 {
 	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	uint32_t handle;
+	int ret;
 
-	handle = gem_create_in_memory_regions(fd, batch_size, region);
+	ret = __gem_create_in_memory_regions(fd, &handle, &batch_size, region);
+	if (ret == -ENODEV && IS_SYSTEM_MEMORY_REGION(region))
+		handle = gem_create(fd, batch_size);
 	gem_write(fd, handle, 0, &bbe, sizeof(bbe));
 
 	return handle;
-- 
2.26.0



More information about the igt-dev mailing list