summaryrefslogtreecommitdiff
path: root/tests/eviction_common.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/eviction_common.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/eviction_common.c')
-rw-r--r--tests/eviction_common.c11
1 files changed, 6 insertions, 5 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++)