[Intel-gfx] [PATCH i-g-t 03/17] lib/ioctl: gem_ prefix for igt_require_mmap_wc

Daniel Vetter daniel.vetter at ffwll.ch
Tue Feb 10 10:05:46 PST 2015


We stick to the overall prefix even for magic require functions.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 lib/ioctl_wrappers.h        | 11 ++++++++++-
 tests/gem_concurrent_blit.c |  4 ++--
 tests/gem_fence_upload.c    |  2 +-
 tests/gem_mmap_wc.c         | 16 ++++++++--------
 tests/gem_tiled_wc.c        |  2 +-
 5 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index a1017ecd3767..8d8fa46d1942 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -65,7 +65,16 @@ void *gem_mmap__cpu(int fd, uint32_t handle, int offset, int size, int prot);
 
 bool gem_mmap__has_wc(int fd);
 void *gem_mmap__wc(int fd, uint32_t handle, int offset, int size, int prot);
-#define igt_require_mmap_wc(x) igt_require(gem_mmap__has_wc(x))
+
+/**
+ * gem_require_mmap_wc:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether direct (i.e. cpu access path, bypassing
+ * the gtt) write-combine memory mappings are available. Automatically skips
+ * through igt_require() if not.
+ */
+#define gem_require_mmap_wc(x) igt_require(gem_mmap__has_wc(x))
 
 /**
  * gem_mmap:
diff --git a/tests/gem_concurrent_blit.c b/tests/gem_concurrent_blit.c
index 245ad4581783..cec6ea49f95c 100644
--- a/tests/gem_concurrent_blit.c
+++ b/tests/gem_concurrent_blit.c
@@ -174,7 +174,7 @@ wc_create_bo(drm_intel_bufmgr *bufmgr, int width, int height)
 {
 	drm_intel_bo *bo;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	bo = unmapped_create_bo(bufmgr, width, height);
 	bo->virtual = gem_mmap__wc(fd, bo->handle, 0, bo->size, PROT_READ | PROT_WRITE);
@@ -696,7 +696,7 @@ static void gtt_require(void)
 static void wc_require(void)
 {
 	bit17_require();
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 }
 
 static void bcs_require(void)
diff --git a/tests/gem_fence_upload.c b/tests/gem_fence_upload.c
index 81f797b4ba86..9595bc822e59 100644
--- a/tests/gem_fence_upload.c
+++ b/tests/gem_fence_upload.c
@@ -345,7 +345,7 @@ static void wc_contention(void)
 	double linear[2], tiled[2];
 
 	fd = drm_open_any();
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	num_fences = gem_available_fences(fd);
 	igt_require(num_fences > 0);
diff --git a/tests/gem_mmap_wc.c b/tests/gem_mmap_wc.c
index 87916b6e81c0..73a97d556927 100644
--- a/tests/gem_mmap_wc.c
+++ b/tests/gem_mmap_wc.c
@@ -130,7 +130,7 @@ test_copy(int fd)
 {
 	void *src, *dst;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	/* copy from a fresh src to fresh dst to force pagefault on both */
 	src = create_pointer(fd);
@@ -180,7 +180,7 @@ test_read_write2(int fd, enum test_read_write order)
 	void *r, *w;
 	volatile uint32_t val = 0;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	handle = gem_create(fd, OBJECT_SIZE);
 	set_domain(fd, handle);
@@ -210,7 +210,7 @@ test_write(int fd)
 	void *src;
 	uint32_t dst;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	/* copy from a fresh src to fresh dst to force pagefault on both */
 	src = create_pointer(fd);
@@ -229,7 +229,7 @@ test_write_gtt(int fd)
 	char *dst_gtt;
 	void *src;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	dst = gem_create(fd, OBJECT_SIZE);
 	set_domain(fd, dst);
@@ -253,7 +253,7 @@ test_read(int fd)
 	void *dst;
 	uint32_t src;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	/* copy from a fresh src to fresh dst to force pagefault on both */
 	dst = create_pointer(fd);
@@ -271,7 +271,7 @@ test_write_cpu_read_wc(int fd)
 	uint32_t handle;
 	uint32_t *src, *dst;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
@@ -296,7 +296,7 @@ test_write_gtt_read_wc(int fd)
 	uint32_t handle;
 	uint32_t *src, *dst;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	handle = gem_create(fd, OBJECT_SIZE);
 	set_domain(fd, handle);
@@ -390,7 +390,7 @@ test_fault_concurrent(int fd)
 	struct thread_fault_concurrent thread[64];
 	int n;
 
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	for (n = 0; n < 32; n++) {
 		ptr[n] = create_pointer(fd);
diff --git a/tests/gem_tiled_wc.c b/tests/gem_tiled_wc.c
index f705378173d7..b0f7a655a17a 100644
--- a/tests/gem_tiled_wc.c
+++ b/tests/gem_tiled_wc.c
@@ -136,7 +136,7 @@ igt_simple_main
 	uint32_t handle;
 
 	fd = drm_open_any();
-	igt_require_mmap_wc(fd);
+	gem_require_mmap_wc(fd);
 
 	handle = create_bo(fd);
 	get_tiling(fd, handle, &tiling, &swizzle);
-- 
2.1.4



More information about the Intel-gfx mailing list