[PATCH i-g-t] i915/gem_userptr: Be defensive when testing userptr capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not every device naturally supports snooping and userptr, so be prepared
for the initial probe to fail.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111910
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 tests/i915/gem_userptr_blits.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 2359c13f4..18e806fed 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -78,12 +78,14 @@ static uint32_t linear[WIDTH*HEIGHT];
 
 static bool has_gtt_mmap(int i915)
 {
-	void *ptr, *map;
+	void *ptr, *map = NULL;
 	uint32_t handle;
 
 	igt_assert(posix_memalign(&ptr, PAGE_SIZE, PAGE_SIZE) == 0);
 
-	gem_userptr(i915, ptr, 4096, 0, 0, &handle);
+	if (__gem_userptr(i915, ptr, 4096, 0,
+			  LOCAL_I915_USERPTR_UNSYNCHRONIZED, &handle))
+		goto out_ptr;
 	igt_assert(handle != 0);
 
 	map = __gem_mmap__gtt(i915, handle, 4096, PROT_WRITE);
@@ -91,6 +93,7 @@ static bool has_gtt_mmap(int i915)
 		munmap(map, 4096);
 
 	gem_close(i915, handle);
+out_ptr:
 	free(ptr);
 
 	return map != NULL;
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux