summaryrefslogtreecommitdiff
path: root/tests/gem_tiled_swapping.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-12-12 13:56:09 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-12-12 14:33:59 +0000
commitb1ee03c540af86708a8dd1674032712cba7aa1f1 (patch)
tree87d042e6d769cabc83adfb189f9ca0b9d208cc4f /tests/gem_tiled_swapping.c
parent4cd21795d2ba882a4197769e516b021a5a4c806d (diff)
tests/gem_tiled_swapping: Don't needless crash on 32-bit systems
Only 32-bit of mmap address space, but with PAE we may be trying to allocate more than 4 GiB of memory. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_tiled_swapping.c')
-rw-r--r--tests/gem_tiled_swapping.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c
index c04a3bca..14f5f401 100644
--- a/tests/gem_tiled_swapping.c
+++ b/tests/gem_tiled_swapping.c
@@ -79,6 +79,9 @@ create_bo_and_fill(int fd)
/* Fill the BO with dwords starting at start_val */
data = gem_mmap(fd, handle, LINEAR_DWORDS, PROT_READ | PROT_WRITE);
+ if (data == NULL && errno == ENOSPC)
+ return 0;
+
for (i = 0; i < WIDTH*HEIGHT; i++)
data[i] = i;
munmap(data, LINEAR_DWORDS);
@@ -117,8 +120,13 @@ main(int argc, char **argv)
return 77;
}
- for (i = 0; i < count; i++)
+ for (i = 0; i < count; i++) {
bo_handles[i] = create_bo_and_fill(fd);
+ if (bo_handles[i] == 0) {
+ printf("insufficient address space\n");
+ return 77;
+ }
+ }
for (i = 0; i < count; i++)
idx_arr[i] = i;