On 07/10/2019 08:37, Chris Wilson wrote:
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 <[email protected]>
---
  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;


Reviewed-by: Tvrtko Ursulin <[email protected]>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to