summaryrefslogtreecommitdiff
path: root/tests/gem_userptr_blits.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-02-04 17:41:05 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-02-04 17:48:16 +0000
commit0e96238bf35959f933b545d2ec85ada6b769cf8b (patch)
treef51cca5291b632212a53fd902e4f2eb76aca2ec3 /tests/gem_userptr_blits.c
parent7b5a81858193d775c08892b5072019488d7cdb0f (diff)
igt/gem_userptr_blits: Limit amount of mlocked surfaces
When testing surface eviction we don't need that many surfaces as we mlock surplus memory. Reducing the number of surfaces speeds up the test and prevents a couple of integer overflow bugs. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94004 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_userptr_blits.c')
-rw-r--r--tests/gem_userptr_blits.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index 0972ac9f..a6946d0d 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -173,8 +173,8 @@ copy(int fd, uint32_t dst, uint32_t src, unsigned int error)
reloc[1].read_domains = I915_GEM_DOMAIN_RENDER;
reloc[1].write_domain = 0;
+ memset(&exec, 0, sizeof(exec));
memset(obj, 0, sizeof(obj));
- exec.buffer_count = 0;
obj[exec.buffer_count++].handle = dst;
if (src != dst)
obj[exec.buffer_count++].handle = src;
@@ -183,19 +183,9 @@ copy(int fd, uint32_t dst, uint32_t src, unsigned int error)
obj[exec.buffer_count].relocs_ptr = (uintptr_t)reloc;
exec.buffer_count++;
exec.buffers_ptr = (uintptr_t)obj;
-
- exec.batch_start_offset = 0;
- exec.batch_len = i * 4;
- exec.DR1 = exec.DR4 = 0;
- exec.num_cliprects = 0;
- exec.cliprects_ptr = 0;
exec.flags = HAS_BLT_RING(intel_get_drm_devid(fd)) ? I915_EXEC_BLT : 0;
- i915_execbuffer2_set_context_id(exec, 0);
- exec.rsvd2 = 0;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
- if (ret)
- ret = errno;
+ ret = __gem_execbuf(fd, &exec);
if (error == ~0)
igt_assert_neq(ret, 0);
@@ -257,6 +247,7 @@ blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo)
reloc[1].read_domains = I915_GEM_DOMAIN_RENDER;
reloc[1].write_domain = 0;
+ memset(&exec, 0, sizeof(exec));
obj = calloc(n_bo + 1, sizeof(*obj));
for (n = 0; n < n_bo; n++)
obj[n].handle = all_bo[n];
@@ -266,19 +257,9 @@ blit(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo)
exec.buffers_ptr = (uintptr_t)obj;
exec.buffer_count = n_bo + 1;
- exec.batch_start_offset = 0;
- exec.batch_len = i * 4;
- exec.DR1 = exec.DR4 = 0;
- exec.num_cliprects = 0;
- exec.cliprects_ptr = 0;
exec.flags = HAS_BLT_RING(intel_get_drm_devid(fd)) ? I915_EXEC_BLT : 0;
- i915_execbuffer2_set_context_id(exec, 0);
- exec.rsvd2 = 0;
-
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
- if (ret)
- ret = errno;
+ ret = __gem_execbuf(fd, &exec);
gem_close(fd, handle);
free(obj);
@@ -1067,6 +1048,7 @@ static void test_forking_evictions(int fd, int size, int count,
static void test_mlocked_evictions(int fd, int size, int count)
{
+ count = min(256, count/2);
mlocked_evictions(fd, &fault_ops, size, count);
reset_handle_ptr();
}