[Intel-gfx] [PATCH i-g-t 1/7] s/gem_mmap/gem_mmap__gtt/

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Fri Oct 9 09:19:10 PDT 2015


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Get rid of the gem_mmap() alias of gem_mmap__gtt(). I don't see any
point in having it.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 demos/intel_sprite_on.c            |  4 ++--
 lib/igt_fb.c                       |  2 +-
 lib/ioctl_wrappers.h               | 16 ----------------
 tests/drv_suspend.c                |  6 +++---
 tests/gem_exec_faulting_reloc.c    |  2 +-
 tests/gem_fence_thrash.c           |  2 +-
 tests/gem_fence_upload.c           |  6 +++---
 tests/gem_gtt_cpu_tlb.c            |  4 ++--
 tests/gem_gtt_hog.c                |  4 ++--
 tests/gem_gtt_speed.c              | 12 ++++++------
 tests/gem_madvise.c                |  4 ++--
 tests/gem_mmap_gtt.c               | 10 +++++-----
 tests/gem_mmap_offset_exhaustion.c |  2 +-
 tests/gem_persistent_relocs.c      |  2 +-
 tests/gem_reloc_overflow.c         |  2 +-
 tests/gem_reloc_vs_gpu.c           |  2 +-
 tests/gem_set_tiling_vs_gtt.c      |  2 +-
 tests/gem_set_tiling_vs_pwrite.c   |  2 +-
 tests/gem_tiled_pread_basic.c      |  2 +-
 tests/gem_tiled_pread_pwrite.c     |  4 ++--
 tests/gem_tiled_swapping.c         |  6 +++---
 tests/gem_tiling_max_stride.c      |  2 +-
 tests/gem_userptr_blits.c          |  2 +-
 tests/gen3_mixed_blits.c           |  4 ++--
 tests/gen3_render_mixed_blits.c    |  4 ++--
 tests/gen3_render_tiledx_blits.c   |  4 ++--
 tests/gen3_render_tiledy_blits.c   |  4 ++--
 tests/gen7_forcewake_mt.c          |  2 +-
 tests/prime_self_import.c          |  4 ++--
 tests/testdisplay.c                |  2 +-
 30 files changed, 54 insertions(+), 70 deletions(-)

diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
index 23fc56c..4083070 100644
--- a/demos/intel_sprite_on.c
+++ b/demos/intel_sprite_on.c
@@ -359,7 +359,7 @@ static int prepare_primary_surface(int fd, int prim_width, int prim_height,
 	if (tiled)
 		gem_set_tiling(fd, *prim_handle, I915_TILING_X, *prim_stride);
 
-	prim_fb_ptr = gem_mmap(fd, *prim_handle, *prim_size, PROT_READ | PROT_WRITE);
+	prim_fb_ptr = gem_mmap__gtt(fd, *prim_handle, *prim_size, PROT_READ | PROT_WRITE);
 
 	if (prim_fb_ptr != NULL) {
 		// Write primary surface with gray background
@@ -454,7 +454,7 @@ static int prepare_sprite_surfaces(int fd, int sprite_width, int sprite_height,
 			gem_set_tiling(fd, sprite_handles[i], I915_TILING_X, *sprite_stride);
 
 		// Get pointer to the surface
-		sprite_fb_ptr = gem_mmap(fd,
+		sprite_fb_ptr = gem_mmap__gtt(fd,
 				sprite_handles[i], *sprite_size,
 				PROT_READ | PROT_WRITE);
 
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index d04f02c..713bd50 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -775,7 +775,7 @@ static void destroy_cairo_surface__gtt(void *arg)
 static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 {
 	fb->cairo_surface =
-		cairo_image_surface_create_for_data(gem_mmap(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE),
+		cairo_image_surface_create_for_data(gem_mmap__gtt(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE),
 						    drm_format_to_cairo(fb->drm_format),
 						    fb->width, fb->height, fb->stride);
 
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index f4deca6..7c607a2 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -76,22 +76,6 @@ void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsi
  */
 #define gem_require_mmap_wc(fd) igt_require(gem_mmap__has_wc(fd))
 
-/**
- * gem_mmap:
- * @fd: open i915 drm file descriptor
- * @handle: gem buffer object handle
- * @size: size of the gem buffer
- * @prot: memory protection bits as used by mmap()
- *
- * This functions wraps up procedure to establish a memory mapping through the
- * GTT.
- *
- * This is a simple convenience alias to gem_mmap__gtt()
- *
- * Returns: A pointer to the created memory mapping.
- */
-#define gem_mmap(fd, handle, size, prot) gem_mmap__gtt(fd, handle, size, prot)
-
 int gem_madvise(int fd, uint32_t handle, int state);
 
 uint32_t gem_context_create(int fd);
diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c
index c8af46b..4014241 100644
--- a/tests/drv_suspend.c
+++ b/tests/drv_suspend.c
@@ -56,19 +56,19 @@ test_fence_restore(int fd, bool tiled2untiled, bool hibernate)
 	handle_tiled = gem_create(fd, OBJECT_SIZE);
 
 	/* Access the buffer objects in the order we want to have the laid out. */
-	ptr1 = gem_mmap(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr1 = gem_mmap__gtt(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr1 != MAP_FAILED);
 	for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
 		ptr1[i] = i;
 
-	ptr_tiled = gem_mmap(fd, handle_tiled, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr_tiled = gem_mmap__gtt(fd, handle_tiled, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr_tiled != MAP_FAILED);
 	if (tiled2untiled)
 		gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048);
 	for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
 		ptr_tiled[i] = i;
 
-	ptr2 = gem_mmap(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr2 = gem_mmap__gtt(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr2 != MAP_FAILED);
 	for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
 		ptr2[i] = i;
diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c
index 623b7e5..e16b580 100644
--- a/tests/gem_exec_faulting_reloc.c
+++ b/tests/gem_exec_faulting_reloc.c
@@ -200,7 +200,7 @@ static void run(int object_size)
 
 	handle_relocs = gem_create(fd, 4096);
 	gem_write(fd, handle_relocs, 0, reloc, sizeof(reloc));
-	gtt_relocs = gem_mmap(fd, handle_relocs, 4096,
+	gtt_relocs = gem_mmap__gtt(fd, handle_relocs, 4096,
 			      PROT_READ | PROT_WRITE);
 	igt_assert(gtt_relocs);
 
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 6f3d768..1b828b8 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -74,7 +74,7 @@ bo_create (int fd, int tiling)
 
 	gem_set_tiling(fd, handle, tiling, 1024);
 
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr);
 
 	gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
diff --git a/tests/gem_fence_upload.c b/tests/gem_fence_upload.c
index ab13925..047b783 100644
--- a/tests/gem_fence_upload.c
+++ b/tests/gem_fence_upload.c
@@ -68,7 +68,7 @@ static void performance(void)
 
 		for (n = 0; n < count; n++) {
 			handle[n] = gem_create(fd, OBJECT_SIZE);
-			ptr[n] = gem_mmap(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE);
+			ptr[n] = gem_mmap__gtt(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE);
 			igt_assert(ptr[n]);
 		}
 
@@ -176,7 +176,7 @@ static void thread_performance(unsigned mask)
 
 		for (n = 0; n < count; n++) {
 			handle[n] = gem_create(fd, OBJECT_SIZE);
-			ptr[n] = gem_mmap(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE);
+			ptr[n] = gem_mmap__gtt(fd, handle[n], OBJECT_SIZE, PROT_READ | PROT_WRITE);
 			igt_assert(ptr[n]);
 
 			if (mask & READ) {
@@ -257,7 +257,7 @@ static void *no_contention(void *closure)
 	int n;
 
 	for (n = 0; n < t->loops; n++) {
-		uint32_t *ptr = gem_mmap(t->fd, t->handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+		uint32_t *ptr = gem_mmap__gtt(t->fd, t->handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 		igt_assert(ptr);
 		memset(ptr + (rand() % 256) * 4096 / 4, 0, 4096);
 		munmap(ptr, OBJECT_SIZE);
diff --git a/tests/gem_gtt_cpu_tlb.c b/tests/gem_gtt_cpu_tlb.c
index 027d5cf..8ceef44 100644
--- a/tests/gem_gtt_cpu_tlb.c
+++ b/tests/gem_gtt_cpu_tlb.c
@@ -59,7 +59,7 @@ create_bo(int fd)
 	handle = gem_create(fd, OBJ_SIZE);
 
 	/* Fill the BO with dwords starting at start_val */
-	data = gem_mmap(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE);
+	data = gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE);
 	for (i = 0; i < OBJ_SIZE/4; i++)
 		data[i] = i;
 	munmap(data, OBJ_SIZE);
@@ -82,7 +82,7 @@ igt_simple_main
 	handle = gem_create(fd, OBJ_SIZE);
 
 	/* touch one page */
-	ptr = gem_mmap(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE);
 	*ptr = 0xdeadbeef;
 	munmap(ptr, OBJ_SIZE);
 
diff --git a/tests/gem_gtt_hog.c b/tests/gem_gtt_hog.c
index 43cb0fb..b0673a4 100644
--- a/tests/gem_gtt_hog.c
+++ b/tests/gem_gtt_hog.c
@@ -140,10 +140,10 @@ static void run(data_t *data, int child)
 	 * set-to-gtt-domain within the fault handler.
 	 */
 	if (write) {
-		ptr = gem_mmap(data->fd, handle, size, PROT_READ | PROT_WRITE);
+		ptr = gem_mmap__gtt(data->fd, handle, size, PROT_READ | PROT_WRITE);
 		ptr[rand() % (size / 4)] = canary;
 	} else
-		ptr = gem_mmap(data->fd, handle, size, PROT_READ);
+		ptr = gem_mmap__gtt(data->fd, handle, size, PROT_READ);
 	x = ptr[rand() % (size / 4)];
 	munmap(ptr, size);
 
diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c
index e71da84..bcca1f4 100644
--- a/tests/gem_gtt_speed.c
+++ b/tests/gem_gtt_speed.c
@@ -174,7 +174,7 @@ int main(int argc, char **argv)
 
 		/* prefault into gtt */
 		{
-			uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+			uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE);
 			volatile uint32_t *ptr = base;
 			int x = 0;
 
@@ -189,7 +189,7 @@ int main(int argc, char **argv)
 		/* mmap read */
 		gettimeofday(&start, NULL);
 		for (loop = 0; loop < 1000; loop++) {
-			uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+			uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE);
 			volatile uint32_t *ptr = base;
 			int x = 0;
 
@@ -229,7 +229,7 @@ int main(int argc, char **argv)
 		/* mmap write */
 		gettimeofday(&start, NULL);
 		for (loop = 0; loop < 1000; loop++) {
-			uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+			uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE);
 			volatile uint32_t *ptr = base;
 
 			for (i = 0; i < size/sizeof(*ptr); i++)
@@ -261,7 +261,7 @@ int main(int argc, char **argv)
 		/* mmap clear */
 		gettimeofday(&start, NULL);
 		for (loop = 0; loop < 1000; loop++) {
-			uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+			uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE);
 			memset(base, 0, size);
 			munmap(base, size);
 		}
@@ -283,7 +283,7 @@ int main(int argc, char **argv)
 		}
 
 		gettimeofday(&start, NULL);{
-			uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+			uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE);
 			for (loop = 0; loop < 1000; loop++)
 				memset(base, 0, size);
 			munmap(base, size);
@@ -305,7 +305,7 @@ int main(int argc, char **argv)
 		/* mmap read */
 		gettimeofday(&start, NULL);
 		for (loop = 0; loop < 1000; loop++) {
-			uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+			uint32_t *base = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE);
 			volatile uint32_t *ptr = base;
 			int x = 0;
 
diff --git a/tests/gem_madvise.c b/tests/gem_madvise.c
index a991ea3..359f490 100644
--- a/tests/gem_madvise.c
+++ b/tests/gem_madvise.c
@@ -63,7 +63,7 @@ dontneed_before_mmap(void)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 	gem_madvise(fd, handle, I915_MADV_DONTNEED);
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr == NULL);
 	igt_assert(errno == EFAULT);
 	close(fd);
@@ -77,7 +77,7 @@ dontneed_after_mmap(void)
 	char *ptr;
 
 	handle = gem_create(fd, OBJECT_SIZE);
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr != NULL);
 	gem_madvise(fd, handle, I915_MADV_DONTNEED);
 	close(fd);
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index 8c26c22..1624a6b 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -56,7 +56,7 @@ mmap_bo(int fd, uint32_t handle)
 {
 	void *ptr;
 
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr != MAP_FAILED);
 
 	return ptr;
@@ -179,7 +179,7 @@ test_read_write(int fd, enum test_read_write order)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr != MAP_FAILED);
 
 	if (order == READ_BEFORE_WRITE) {
@@ -203,10 +203,10 @@ test_read_write2(int fd, enum test_read_write order)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
-	r = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ);
+	r = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ);
 	igt_assert(r != MAP_FAILED);
 
-	w = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	w = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(w != MAP_FAILED);
 
 	if (order == READ_BEFORE_WRITE) {
@@ -440,7 +440,7 @@ test_write_cpu_read_gtt(int fd)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
-	dst = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ);
+	dst = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ);
 	igt_assert(dst != (uint32_t *)MAP_FAILED);
 
 	src = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
diff --git a/tests/gem_mmap_offset_exhaustion.c b/tests/gem_mmap_offset_exhaustion.c
index 6c51762..3ce60f3 100644
--- a/tests/gem_mmap_offset_exhaustion.c
+++ b/tests/gem_mmap_offset_exhaustion.c
@@ -60,7 +60,7 @@ create_and_map_bo(int fd)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr);
 
 	/* touch it to force it into the gtt */
diff --git a/tests/gem_persistent_relocs.c b/tests/gem_persistent_relocs.c
index 9867652..57024fc 100644
--- a/tests/gem_persistent_relocs.c
+++ b/tests/gem_persistent_relocs.c
@@ -225,7 +225,7 @@ static void do_test(int fd, bool faulting_reloc)
 
 		relocs_bo_handle[i] = gem_create(fd, 4096);
 		gem_write(fd, relocs_bo_handle[i], 0, reloc, sizeof(reloc));
-		gtt_relocs_ptr[i] = gem_mmap(fd, relocs_bo_handle[i], 4096,
+		gtt_relocs_ptr[i] = gem_mmap__gtt(fd, relocs_bo_handle[i], 4096,
 				      PROT_READ | PROT_WRITE);
 		igt_assert(gtt_relocs_ptr[i]);
 
diff --git a/tests/gem_reloc_overflow.c b/tests/gem_reloc_overflow.c
index 304e3d8..5d794cd 100644
--- a/tests/gem_reloc_overflow.c
+++ b/tests/gem_reloc_overflow.c
@@ -85,7 +85,7 @@ static void source_offset_tests(int devid, bool reloc_gtt)
 		execbuf.buffer_count = 2;
 
 		if (reloc_gtt) {
-			dst_gtt = gem_mmap(fd, handle, 8192, PROT_READ | PROT_WRITE);
+			dst_gtt = gem_mmap__gtt(fd, handle, 8192, PROT_READ | PROT_WRITE);
 			igt_assert(dst_gtt != MAP_FAILED);
 			gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 			memset(dst_gtt, 0, 8192);
diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c
index bfd9367..e31928e 100644
--- a/tests/gem_reloc_vs_gpu.c
+++ b/tests/gem_reloc_vs_gpu.c
@@ -162,7 +162,7 @@ static void reloc_and_emit(int fd, drm_intel_bo *target_bo, bool faulting_reloc)
 
 	handle_relocs = gem_create(fd, 4096);
 	gem_write(fd, handle_relocs, 0, reloc, sizeof(reloc));
-	gtt_relocs = gem_mmap(fd, handle_relocs, 4096,
+	gtt_relocs = gem_mmap__gtt(fd, handle_relocs, 4096,
 			      PROT_READ | PROT_WRITE);
 	igt_assert(gtt_relocs);
 
diff --git a/tests/gem_set_tiling_vs_gtt.c b/tests/gem_set_tiling_vs_gtt.c
index 487556a..619bd1d 100644
--- a/tests/gem_set_tiling_vs_gtt.c
+++ b/tests/gem_set_tiling_vs_gtt.c
@@ -66,7 +66,7 @@ igt_simple_main
 		tile_height = 8;
 
 	handle = gem_create(fd, OBJECT_SIZE);
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr);
 
 	/* gtt coherency is done with set_domain in libdrm, don't break that */
diff --git a/tests/gem_set_tiling_vs_pwrite.c b/tests/gem_set_tiling_vs_pwrite.c
index 9b2263a..ed6d763 100644
--- a/tests/gem_set_tiling_vs_pwrite.c
+++ b/tests/gem_set_tiling_vs_pwrite.c
@@ -62,7 +62,7 @@ igt_simple_main
 		data[i] = i;
 
 	handle = gem_create(fd, OBJECT_SIZE);
-	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
 	igt_assert(ptr);
 
 	gem_set_tiling(fd, handle, I915_TILING_X, TEST_STRIDE);
diff --git a/tests/gem_tiled_pread_basic.c b/tests/gem_tiled_pread_basic.c
index 421e35e..407808b 100644
--- a/tests/gem_tiled_pread_basic.c
+++ b/tests/gem_tiled_pread_basic.c
@@ -72,7 +72,7 @@ create_bo(int fd)
 	gem_set_tiling(fd, handle, I915_TILING_X, WIDTH * sizeof(uint32_t));
 
 	/* Fill the BO with dwords starting at start_val */
-	data = gem_mmap(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE);
+	data = gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE);
 	for (i = 0; i < WIDTH*HEIGHT; i++)
 		data[i] = i;
 	munmap(data, sizeof(linear));
diff --git a/tests/gem_tiled_pread_pwrite.c b/tests/gem_tiled_pread_pwrite.c
index ff27e04..c952ce7 100644
--- a/tests/gem_tiled_pread_pwrite.c
+++ b/tests/gem_tiled_pread_pwrite.c
@@ -79,7 +79,7 @@ create_bo_and_fill(int fd)
 	gem_set_tiling(fd, handle, current_tiling_mode, WIDTH * sizeof(uint32_t));
 
 	/* Fill the BO with dwords starting at start_val */
-	data = gem_mmap(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE);
+	data = gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE);
 	for (i = 0; i < WIDTH*HEIGHT; i++)
 		data[i] = i;
 	munmap(data, sizeof(linear));
@@ -122,7 +122,7 @@ igt_simple_main
 		gem_write(fd, handle_target, 0, linear, sizeof(linear));
 
 		/* Check the target bo's contents. */
-		data = gem_mmap(fd, handle_target, sizeof(linear), PROT_READ | PROT_WRITE);
+		data = gem_mmap__gtt(fd, handle_target, sizeof(linear), PROT_READ | PROT_WRITE);
 		for (j = 0; j < WIDTH*HEIGHT; j++)
 			igt_assert_f(data[j] == j,
 				     "mismatch at %i: %i\n",
diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c
index d232aee..b50fa7f 100644
--- a/tests/gem_tiled_swapping.c
+++ b/tests/gem_tiled_swapping.c
@@ -78,7 +78,7 @@ create_bo(int fd)
 	handle = gem_create(fd, LINEAR_DWORDS);
 	gem_set_tiling(fd, handle, current_tiling_mode, WIDTH * sizeof(uint32_t));
 
-	data = gem_mmap(fd, handle, LINEAR_DWORDS, PROT_READ | PROT_WRITE);
+	data = gem_mmap__gtt(fd, handle, LINEAR_DWORDS, PROT_READ | PROT_WRITE);
 	if (data == NULL) {
 		gem_close(fd, handle);
 		return 0;
@@ -94,7 +94,7 @@ fill_bo(int fd, uint32_t handle)
 	uint32_t *data;
 	int i;
 
-	data = gem_mmap(fd, handle, LINEAR_DWORDS, PROT_READ | PROT_WRITE);
+	data = gem_mmap__gtt(fd, handle, LINEAR_DWORDS, PROT_READ | PROT_WRITE);
 	igt_assert(data);
 
 	gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
@@ -109,7 +109,7 @@ check_bo(int fd, uint32_t handle)
 	uint32_t *data;
 	int j;
 
-	data = gem_mmap(fd, handle, LINEAR_DWORDS, PROT_READ);
+	data = gem_mmap__gtt(fd, handle, LINEAR_DWORDS, PROT_READ);
 	gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, 0);
 	j = rand() % (WIDTH * HEIGHT);
 	igt_assert_f(data[j] == j, "mismatch at %i: %i\n", j, data[j]);
diff --git a/tests/gem_tiling_max_stride.c b/tests/gem_tiling_max_stride.c
index 62fa4fe..02c4ed2 100644
--- a/tests/gem_tiling_max_stride.c
+++ b/tests/gem_tiling_max_stride.c
@@ -97,7 +97,7 @@ igt_simple_main
 
 	handle = gem_create(fd, size);
 
-	ptr = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE);
+	ptr = gem_mmap__gtt(fd, handle, size, PROT_READ | PROT_WRITE);
 	igt_assert(ptr);
 
 	test_invalid_tiling(fd, handle, 0);
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index c9e35ed..d161b6c 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -688,7 +688,7 @@ static void *umap(int fd, uint32_t handle)
 	void *ptr;
 
 	if (gem_has_llc(fd)) {
-		ptr = gem_mmap(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE);
+		ptr = gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE);
 	} else {
 		uint32_t tmp = gem_create(fd, sizeof(linear));
 		copy(fd, tmp, handle, 0);
diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c
index 40a1f0a..40b8e1e 100644
--- a/tests/gen3_mixed_blits.c
+++ b/tests/gen3_mixed_blits.c
@@ -426,7 +426,7 @@ create_bo(int fd, uint32_t val, int tiling)
 	gem_set_tiling(fd, handle, tiling, WIDTH*4);
 
 	/* Fill the BO with dwords starting at val */
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++)
 		v[i] = val++;
@@ -441,7 +441,7 @@ check_bo(int fd, uint32_t handle, uint32_t val)
 	uint32_t *v;
 	int i;
 
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++) {
 		igt_assert_f(v[i] == val,
diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c
index c03cb3b..cc2757b 100644
--- a/tests/gen3_render_mixed_blits.c
+++ b/tests/gen3_render_mixed_blits.c
@@ -314,7 +314,7 @@ create_bo(int fd, uint32_t val, int tiling)
 	gem_set_tiling(fd, handle, tiling, WIDTH*4);
 
 	/* Fill the BO with dwords starting at val */
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++)
 		v[i] = val++;
@@ -329,7 +329,7 @@ check_bo(int fd, uint32_t handle, uint32_t val)
 	uint32_t *v;
 	int i;
 
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++) {
 		igt_assert_f(v[i] == val,
diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c
index eb6c4ea..9a243d8 100644
--- a/tests/gen3_render_tiledx_blits.c
+++ b/tests/gen3_render_tiledx_blits.c
@@ -301,7 +301,7 @@ create_bo(int fd, uint32_t val)
 	gem_set_tiling(fd, handle, I915_TILING_X, WIDTH*4);
 
 	/* Fill the BO with dwords starting at val */
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++)
 		v[i] = val++;
@@ -316,7 +316,7 @@ check_bo(int fd, uint32_t handle, uint32_t val)
 	uint32_t *v;
 	int i;
 
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++) {
 		igt_assert_f(v[i] == val,
diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c
index e3e0abf..11fb002 100644
--- a/tests/gen3_render_tiledy_blits.c
+++ b/tests/gen3_render_tiledy_blits.c
@@ -301,7 +301,7 @@ create_bo(int fd, uint32_t val)
 	gem_set_tiling(fd, handle, I915_TILING_Y, WIDTH*4);
 
 	/* Fill the BO with dwords starting at val */
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++)
 		v[i] = val++;
@@ -316,7 +316,7 @@ check_bo(int fd, uint32_t handle, uint32_t val)
 	uint32_t *v;
 	int i;
 
-	v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
+	v = gem_mmap__gtt(fd, handle, WIDTH*HEIGHT*4, PROT_READ);
 	igt_assert(v);
 	for (i = 0; i < WIDTH*HEIGHT; i++) {
 		igt_assert_f(v[i] == val,
diff --git a/tests/gen7_forcewake_mt.c b/tests/gen7_forcewake_mt.c
index 4cf0902..dea1e8a 100644
--- a/tests/gen7_forcewake_mt.c
+++ b/tests/gen7_forcewake_mt.c
@@ -190,7 +190,7 @@ igt_simple_main
 		gem_execbuf(t[0].fd, &execbuf);
 		gem_sync(t[0].fd, exec[1].handle);
 
-		p = gem_mmap(t[0].fd, exec[0].handle, 4096, PROT_READ);
+		p = gem_mmap__gtt(t[0].fd, exec[0].handle, 4096, PROT_READ);
 
 		igt_info("[%d]={ %08x %08x }\n", i, p[0], p[1]);
 		igt_assert(p[0] & 2);
diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
index 6c09cb0..eb9ab06 100644
--- a/tests/prime_self_import.c
+++ b/tests/prime_self_import.c
@@ -60,8 +60,8 @@ check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2)
 	char *ptr1, *ptr2;
 	int i;
 
-	ptr1 = gem_mmap(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE);
-	ptr2 = gem_mmap(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE);
+	ptr1 = gem_mmap__gtt(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE);
+	ptr2 = gem_mmap__gtt(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE);
 
 	igt_assert(ptr1);
 
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 5f7ab1d..af2c5b5 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -221,7 +221,7 @@ paint_color_key(struct igt_fb *fb_info)
 	int i, j;
 	uint32_t *fb_ptr;
 
-	fb_ptr = gem_mmap(drm_fd, fb_info->gem_handle,
+	fb_ptr = gem_mmap__gtt(drm_fd, fb_info->gem_handle,
 			  fb_info->size, PROT_READ | PROT_WRITE);
 	igt_assert(fb_ptr);
 
-- 
2.4.9



More information about the Intel-gfx mailing list