[Intel-gfx] [PATCH igt v2] igt/gem_linear_blits: Compute GTT size using 4G limit

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 13 10:39:14 UTC 2017


Both gem_linear_blits and gem_tiled_blit do not request the full 48b
GTT layout for their objects, restricting themselves to 4G. The
underlying test that they trigger eviction is unaffected by this
restriction, so we can simply reduce their memory requirements to fill
the low 4G GTT space and so allow them to run on 48b machines.

v2: gem_tiled_fenced_blits as well

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/gem_linear_blits.c      | 18 ++++++++++++++----
 tests/gem_tiled_blits.c       | 16 ++++++++++++----
 tests/gem_tiled_fence_blits.c | 11 +++++++++--
 3 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c
index eccfbcdd..8297416c 100644
--- a/tests/gem_linear_blits.c
+++ b/tests/gem_linear_blits.c
@@ -215,6 +215,8 @@ static void run_test(int fd, int count)
 	free(handle);
 }
 
+#define MAX_32b ((1ull << 32) - 4096)
+
 int main(int argc, char **argv)
 {
 	int fd = 0;
@@ -230,20 +232,28 @@ int main(int argc, char **argv)
 		run_test(fd, 2);
 
 	igt_subtest("normal") {
-		int count;
+		uint64_t count;
 
-		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
+		count = gem_aperture_size(fd);
+		if (count >> 32)
+			count = MAX_32b;
+		count = 3 * count / (1024*1024) / 2;
 		igt_require(count > 1);
 		intel_require_memory(count, sizeof(linear), CHECK_RAM);
+
 		run_test(fd, count);
 	}
 
 	igt_subtest("interruptible") {
-		int count;
+		uint64_t count;
 
-		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
+		count = gem_aperture_size(fd);
+		if (count >> 32)
+			count = MAX_32b;
+		count = 3 * count / (1024*1024) / 2;
 		igt_require(count > 1);
 		intel_require_memory(count, sizeof(linear), CHECK_RAM);
+
 		igt_fork_signal_helper();
 		run_test(fd, count);
 		igt_stop_signal_helper();
diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c
index 7dcfc962..a81226a1 100644
--- a/tests/gem_tiled_blits.c
+++ b/tests/gem_tiled_blits.c
@@ -192,6 +192,8 @@ static void run_test(int count)
 	free(bo);
 }
 
+#define MAX_32b ((1ull << 32) - 4096)
+
 int fd;
 
 int main(int argc, char **argv)
@@ -212,9 +214,12 @@ int main(int argc, char **argv)
 		run_test(2);
 
 	igt_subtest("normal") {
-		int count;
+		uint64_t count;
 
-		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
+		count = gem_aperture_size(fd);
+		if (count >> 32)
+			count = MAX_32b;
+		count = 3 * count / (1024*1024) / 2;
 		count += (count & 1) == 0;
 		intel_require_memory(count, 1024*1024, CHECK_RAM);
 
@@ -222,9 +227,12 @@ int main(int argc, char **argv)
 	}
 
 	igt_subtest("interruptible") {
-		int count;
+		uint64_t count;
 
-		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
+		count = gem_aperture_size(fd);
+		if (count >> 32)
+			count = MAX_32b;
+		count = 3 * count / (1024*1024) / 2;
 		count += (count & 1) == 0;
 		intel_require_memory(count, 1024*1024, CHECK_RAM);
 
diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c
index eb6473bc..51f672fd 100644
--- a/tests/gem_tiled_fence_blits.c
+++ b/tests/gem_tiled_fence_blits.c
@@ -160,9 +160,11 @@ static void run_test (int fd, int count)
 	drm_intel_bufmgr_destroy(bufmgr);
 }
 
+#define MAX_32b ((1ull << 32) - 4096)
+
 igt_main
 {
-	int fd, count;
+	int fd;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
@@ -177,7 +179,12 @@ igt_main
 	igt_skip_on_simulation();
 
 	igt_subtest("normal") {
-		count = 3 * gem_aperture_size(fd) / (bo_size) / 2;
+		uint64_t count;
+
+		count = gem_aperture_size(fd);
+		if (count >> 32)
+			count = MAX_32b;
+		count = 3 * count / bo_size / 2;
 		intel_require_memory(count, bo_size, CHECK_RAM);
 		run_test(fd, count);
 	}
-- 
2.14.1



More information about the Intel-gfx mailing list