diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2011-10-15 13:09:36 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2011-10-15 13:23:03 +0200 |
commit | b75451838a0b4315fa9494691c1615bce178d424 (patch) | |
tree | 8ef0cb422b1ae47d575c2f3c93cae3d06e876d4e /tests | |
parent | 62c542fd4e7f47d5216785e9a13054ce56973f28 (diff) |
tests/gem_*_blits: reduce buffer count to not trash swap
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gem_linear_blits.c | 7 | ||||
-rw-r--r-- | tests/gem_tiled_blits.c | 7 | ||||
-rw-r--r-- | tests/gem_tiled_fence_blits.c | 5 |
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c index ae188ff8..14cf4f4b 100644 --- a/tests/gem_linear_blits.c +++ b/tests/gem_linear_blits.c @@ -248,6 +248,13 @@ int main(int argc, char **argv) count = atoi(argv[1]); if (count == 0) count = 3 * gem_aperture_size(fd) / (1024*1024) / 2; + + if (count > intel_get_total_ram_mb() * 9 / 10) { + count = intel_get_total_ram_mb() * 9 / 10; + fprintf(stderr, "not enough RAM to run test, reducing buffer count\n"); + return 77; + } + printf("Using %d 1MiB buffers\n", count); handle = malloc(sizeof(uint32_t)*count*2); diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c index 54b2d400..8c48b760 100644 --- a/tests/gem_tiled_blits.c +++ b/tests/gem_tiled_blits.c @@ -144,6 +144,13 @@ int main(int argc, char **argv) count = 3 * gem_aperture_size(fd) / (1024*1024) / 2; count += (count & 1) == 0; } + + if (count > intel_get_total_ram_mb() * 9 / 10) { + count = intel_get_total_ram_mb() * 9 / 10; + fprintf(stderr, "not enough RAM to run test, reducing buffer count\n"); + return 77; + } + printf("Using %d 1MiB buffers\n", count); bo = malloc(sizeof(drm_intel_bo *)*count); diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c index 9f41f7be..6d53bcd1 100644 --- a/tests/gem_tiled_fence_blits.c +++ b/tests/gem_tiled_fence_blits.c @@ -148,6 +148,11 @@ int main(int argc, char **argv) fd = drm_open_any(); count = 3 * gem_aperture_size(fd) / (1024*1024) / 2; + if (count > intel_get_total_ram_mb() * 9 / 10) { + count = intel_get_total_ram_mb() * 9 / 10; + fprintf(stderr, "not enough RAM to run test, reducing buffer count\n"); + return 77; + } count |= 1; printf("Using %d 1MiB buffers\n", count); |