[Intel-gfx] [PATCH] igt/gem_exec_big: Increase stress

Chris Wilson chris at chris-wilson.co.uk
Tue Nov 18 10:50:23 CET 2014


We should be able to execute batches up to the full GTT size (give or
take fragmentation), so let's try!

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/gem_exec_big.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/tests/gem_exec_big.c b/tests/gem_exec_big.c
index b82774f..b5ec71c 100644
--- a/tests/gem_exec_big.c
+++ b/tests/gem_exec_big.c
@@ -46,10 +46,9 @@
 #include "drm.h"
 #include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "igt_aux.h"
 
-#define BATCH_SIZE		(1024*1024)
-
-static void exec(int fd, uint32_t handle, uint32_t reloc_ofs)
+static void exec(int fd, uint32_t handle, uint32_t reloc_ofs, unsigned flags)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 gem_exec[1];
@@ -80,7 +79,7 @@ static void exec(int fd, uint32_t handle, uint32_t reloc_ofs)
 	execbuf.num_cliprects = 0;
 	execbuf.DR1 = 0;
 	execbuf.DR4 = 0;
-	execbuf.flags = 0;
+	execbuf.flags = flags;
 	i915_execbuffer2_set_context_id(execbuf, 0);
 	execbuf.rsvd2 = 0;
 
@@ -100,27 +99,36 @@ static void exec(int fd, uint32_t handle, uint32_t reloc_ofs)
 igt_simple_main
 {
 	uint32_t batch[2] = {MI_BATCH_BUFFER_END};
-	uint32_t handle;
 	int fd;
 	uint32_t reloc_ofs;
 	unsigned batch_size;
+	int max;
 
 	igt_skip_on_simulation();
 
 	fd = drm_open_any();
+	max = 3 * gem_aperture_size(fd) / 4;
+
+	igt_require(intel_check_memory(1, max, CHECK_RAM));
 
-	for (batch_size = BATCH_SIZE/4; batch_size <= BATCH_SIZE; batch_size += 4096) {
-		handle = gem_create(fd, batch_size);
+	for (batch_size = 4096; batch_size <= max; ) {
+		uint32_t handle = gem_create(fd, batch_size);
 		gem_write(fd, handle, 0, batch, sizeof(batch));
 
 		for (reloc_ofs = 4096; reloc_ofs < batch_size; reloc_ofs += 4096) {
 			igt_debug("batch_size %u, reloc_ofs %u\n",
 				  batch_size, reloc_ofs);
-			exec(fd, handle, reloc_ofs);
+			exec(fd, handle, reloc_ofs, 0);
+			exec(fd, handle, reloc_ofs, I915_EXEC_SECURE);
 		}
-	}
 
-	gem_close(fd, handle);
+		gem_madvise(fd, handle, I915_MADV_DONTNEED);
+
+		if (batch_size < max && 2*batch_size > max)
+			batch_size = max;
+		else
+			batch_size *= 2;
+	}
 
 	close(fd);
 }
-- 
2.1.3




More information about the Intel-gfx mailing list