summaryrefslogtreecommitdiff
path: root/tests/eviction_common.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-05 13:19:39 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-05 13:34:02 +0100
commita1a8aa16fb4e27a267f4ac12883419114a020dd7 (patch)
treece996f3836ccdeb0f6986099f260cecb0dbb012c /tests/eviction_common.c
parent5141b21f915ce7e857bcacbd1eb4ec9eebf3fe93 (diff)
igt/gem_evict_everything: Compute number of surfaces to saturate the aperture
The goal is to only fill the aperture, not all of memory, so fine-tune the computed number of surfaces, hopefully avoiding an integer overflow in the process. References: https://bugs.freedesktop.org/show_bug.cgi?id=79573 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/eviction_common.c')
-rw-r--r--tests/eviction_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/eviction_common.c b/tests/eviction_common.c
index f02326b0..6c6eab46 100644
--- a/tests/eviction_common.c
+++ b/tests/eviction_common.c
@@ -74,9 +74,9 @@ static int minor_evictions(int fd, struct igt_eviction_test_ops *ops,
nr_surfaces *= 7;
nr_surfaces += 3;
- total_surfaces = (uint64_t)intel_get_total_ram_mb() * 9 /10 * 1024 *1024 / surface_size;
+ total_surfaces = gem_aperture_size(fd) / surface_size + 1;
igt_require(nr_surfaces < total_surfaces);
- igt_require(total_surfaces * surface_size > gem_aperture_size(fd));
+ igt_require(intel_check_memory(total_surfaces, surface_size, CHECK_RAM));
bo = malloc((nr_surfaces + total_surfaces)*sizeof(*bo));
igt_assert(bo);