summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/eviction_common.c11
-rw-r--r--tests/gem_userptr_blits.c28
2 files changed, 11 insertions, 28 deletions
diff --git a/tests/eviction_common.c b/tests/eviction_common.c
index f029530b..c8bfe8eb 100644
--- a/tests/eviction_common.c
+++ b/tests/eviction_common.c
@@ -133,7 +133,7 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
uint64_t surface_size,
uint64_t surface_count)
{
- size_t sz, pin;
+ uint64_t sz, pin;
void *locked;
intel_require_memory(surface_count, surface_size, CHECK_RAM);
@@ -142,10 +142,11 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
pin = intel_get_avail_ram_mb();
pin *= 1024 * 1024;
igt_require(pin > sz);
- pin -= 3*sz/2;
+ pin -= sz;
- igt_debug("Pinning [%ld, %ld] MiB\n",
- (long)pin/(1024*1024), (long)(pin + sz)/(1024*1024));
+ igt_debug("Pinning [%'lld, %'lld] MiB\n",
+ (long long)pin/(1024*1024),
+ (long long)(pin + sz)/(1024*1024));
locked = malloc(pin + sz);
if (locked != NULL && mlock(locked, pin + sz)) {
@@ -185,7 +186,7 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
locked = malloc(surface_size);
if (locked == NULL || mlock(locked, surface_size))
- exit(ENOSPC);
+ free(locked);
}
for (n = 0; n < surface_count; n++)
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();
}