public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/gem_mmap_gtt: Use PAGE_SIZE instead of hard coded value
@ 2015-04-24  7:38 Joonas Lahtinen
  2015-04-27 17:35 ` Thomas Wood
  0 siblings, 1 reply; 7+ messages in thread
From: Joonas Lahtinen @ 2015-04-24  7:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: Thomas Wood

Now that there is PAGE_SIZE define, use it.

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 tests/gem_mmap_gtt.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index e80f52e..92fa644 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -148,24 +148,25 @@ test_short(int fd)
 	igt_assert(drmIoctl(fd,
 			    DRM_IOCTL_I915_GEM_MMAP_GTT,
 			    &mmap_arg) == 0);
-	for (pages = 1; pages <= OBJECT_SIZE / 4096; pages <<= 1) {
+	for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) {
 		uint8_t *r, *w;
 
-		w = mmap64(0, pages * 4096, PROT_READ | PROT_WRITE,
+		w = mmap64(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(w != MAP_FAILED);
 
-		r = mmap64(0, pages * 4096, PROT_READ,
+		r = mmap64(0, pages * PAGE_SIZE, PROT_READ,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(r != MAP_FAILED);
 
 		for (p = 0; p < pages; p++) {
-			w[4096*p] = r[4096*p];
-			w[4096*p+4095] = r[4096*p+4095];
+			w[p*PAGE_SIZE] = r[p*PAGE_SIZE];
+			w[p*PAGE_SIZE+(PAGE_SIZE-1)] =
+				r[p*PAGE_SIZE+(PAGE_SIZE-1)];
 		}
 
-		munmap(r, pages * 4096);
-		munmap(w, pages * 4096);
+		munmap(r, pages * PAGE_SIZE);
+		munmap(w, pages * PAGE_SIZE);
 	}
 	gem_close(fd, mmap_arg.handle);
 }
-- 
1.9.3



_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-21 18:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24  7:38 [PATCH i-g-t] tests/gem_mmap_gtt: Use PAGE_SIZE instead of hard coded value Joonas Lahtinen
2015-04-27 17:35 ` Thomas Wood
2015-04-27 19:43   ` Chris Wilson
2015-04-30 10:28     ` Joonas Lahtinen
2015-04-30 11:22       ` Chris Wilson
2015-05-04 14:16         ` Daniel Vetter
2015-05-21 18:46           ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox