summaryrefslogtreecommitdiff
path: root/tests/gem_linear_blits.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gem_linear_blits.c')
-rw-r--r--tests/gem_linear_blits.c7
1 files changed, 7 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);