diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-07 08:35:39 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-07 20:50:47 +0100 |
commit | 0147a3777dc73ac2138905d0aef33c0fdb3dde5e (patch) | |
tree | d4cc46e59503e086cadb3544bee60c86a22a5dfc /tests/i915/gem_userptr_blits.c | |
parent | 998e29e137444db6e0ec2c65611a7eab3e0b6a21 (diff) |
i915/gem_userptr: Be defensive when testing userptr capabilities
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@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests/i915/gem_userptr_blits.c')
-rw-r--r-- | tests/i915/gem_userptr_blits.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c index 2359c13f..18e806fe 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; |