[PATCH 5/7] tests/i915/gem_exec_capture: Exercise device memory backed objects

Thomas Hellström thomas.hellstrom at linux.intel.com
Tue Oct 19 06:30:42 UTC 2021


From: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>

EXEC_OBJECT_CAPTURE should allow reading buffers during error capture
regardless of their type.  Currently only system memory backed GEM
objects are examined, as well as userptr as an alternate buffer type.
Add a subtest that performs the exercise on an object allocated in
device memory as another alternative.

v2:
- Rebase on gem_create_in_region() removal (Zbigniew)
v3:
- Rebase on intel_ctx_t and softpinning work (Thomas)
- Require mmap_device_coherent rather than mmap_wc (Thomas)

Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom at intel.com>
---
 tests/i915/gem_exec_capture.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
index 0bd41fcf..c6d76354 100644
--- a/tests/i915/gem_exec_capture.c
+++ b/tests/i915/gem_exec_capture.c
@@ -652,6 +652,21 @@ static void userptr(int fd, int dir)
 	free(ptr);
 }
 
+static void lmem(int fd, int dir)
+{
+	const intel_ctx_t *ctx = intel_ctx_0(fd);
+	uint32_t handle;
+	uint64_t ahnd;
+
+	handle = gem_create_in_memory_regions(fd, 4096, REGION_LMEM(0));
+	ahnd = get_reloc_ahnd(fd, ctx->id);
+
+	__capture1(fd, dir, ahnd, ctx, 0, handle, 4096);
+
+	gem_close(fd, handle);
+	put_ahnd(ahnd);
+}
+
 static bool has_capture(int fd)
 {
 	drm_i915_getparam_t gp;
@@ -692,7 +707,7 @@ igt_main
 			igt_device_set_master(fd);
 
 		igt_require_gem(fd);
-		gem_require_mmap_wc(fd);
+		gem_require_mmap_device_coherent(fd);
 		igt_require(has_capture(fd));
 		ctx = intel_ctx_create_all_physical(fd);
 		igt_allow_hang(fd, ctx->id, HANG_ALLOW_CAPTURE);
@@ -732,6 +747,12 @@ igt_main
 		userptr(fd, dir);
 	}
 
+	igt_subtest_f("lmem") {
+		igt_require(gem_has_lmem(fd));
+		igt_require(gem_can_store_dword(fd, 0));
+		lmem(fd, dir);
+	}
+
 	test_each_engine("pi", fd, ctx, e)
 		prioinv(fd, dir, ctx, e->flags, e->name);
 
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list