[Intel-gfx] [PATCH 2/2] drmtest: assert operations inside gem_mmap__cpu

Paulo Zanoni przanoni at gmail.com
Fri Nov 8 21:50:23 CET 2013


From: Paulo Zanoni <paulo.r.zanoni at intel.com>

All the callers seem to rely on the correct behavior of gem_mmap__cpu,
so add some assertions to catch the unexpected cases. This way we
won't need to worry about adding assertions to all the callers.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
 lib/drmtest.c            | 4 ++--
 tests/gem_fence_thrash.c | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 636ba26..6ac9354 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -564,8 +564,8 @@ void *gem_mmap__cpu(int fd, uint32_t handle, int size)
 	mmap_arg.handle = handle;
 	mmap_arg.offset = 0;
 	mmap_arg.size = size;
-	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg))
-		return NULL;
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg);
+	igt_assert(mmap_arg.addr_ptr);
 
 	return (void *)(uintptr_t)mmap_arg.addr_ptr;
 }
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 8e16f21..ced9b13 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -69,7 +69,6 @@ bo_create (int fd, int tiling)
 
 	/* dirty cpu caches a bit ... */
 	ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE);
-	igt_assert(ptr);
 	memset(ptr, 0, OBJECT_SIZE);
 	munmap(ptr, OBJECT_SIZE);
 
-- 
1.8.3.1




More information about the Intel-gfx mailing list