igt/gem_exec_big: Increase stress

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@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-11-18 09:45:56 +00:00
parent a315476a6b
commit 1dddf32df9

View File

@ -46,13 +46,12 @@
#include "drm.h" #include "drm.h"
#include "ioctl_wrappers.h" #include "ioctl_wrappers.h"
#include "drmtest.h" #include "drmtest.h"
#include "igt_aux.h"
IGT_TEST_DESCRIPTION("Run a large nop batch to stress test the error capture" IGT_TEST_DESCRIPTION("Run a large nop batch to stress test the error capture"
" code."); " code.");
#define BATCH_SIZE (1024*1024) static void exec(int fd, uint32_t handle, uint32_t reloc_ofs, unsigned flags)
static void exec(int fd, uint32_t handle, uint32_t reloc_ofs)
{ {
struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 gem_exec[1]; struct drm_i915_gem_exec_object2 gem_exec[1];
@ -83,7 +82,7 @@ static void exec(int fd, uint32_t handle, uint32_t reloc_ofs)
execbuf.num_cliprects = 0; execbuf.num_cliprects = 0;
execbuf.DR1 = 0; execbuf.DR1 = 0;
execbuf.DR4 = 0; execbuf.DR4 = 0;
execbuf.flags = 0; execbuf.flags = flags;
i915_execbuffer2_set_context_id(execbuf, 0); i915_execbuffer2_set_context_id(execbuf, 0);
execbuf.rsvd2 = 0; execbuf.rsvd2 = 0;
@ -103,27 +102,34 @@ static void exec(int fd, uint32_t handle, uint32_t reloc_ofs)
igt_simple_main igt_simple_main
{ {
uint32_t batch[2] = {MI_BATCH_BUFFER_END}; uint32_t batch[2] = {MI_BATCH_BUFFER_END};
uint32_t handle;
int fd; int fd;
uint32_t reloc_ofs; uint32_t reloc_ofs;
unsigned batch_size; unsigned batch_size;
int max;
igt_skip_on_simulation();
fd = drm_open_any(); fd = drm_open_any();
max = 3 * gem_aperture_size(fd) / 4;
for (batch_size = BATCH_SIZE/4; batch_size <= BATCH_SIZE; batch_size += 4096) { intel_require_memory(1, max, CHECK_RAM);
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)); gem_write(fd, handle, 0, batch, sizeof(batch));
for (reloc_ofs = 4096; reloc_ofs < batch_size; reloc_ofs += 4096) { for (reloc_ofs = 4096; reloc_ofs < batch_size; reloc_ofs += 4096) {
igt_debug("batch_size %u, reloc_ofs %u\n", igt_debug("batch_size %u, reloc_ofs %u\n",
batch_size, reloc_ofs); 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); close(fd);
} }