test/gem_cpu_concurrent_blit: Limit memory usage to half aperture
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 10 Apr 2012 18:41:43 +0000 (19:41 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 10 Apr 2012 18:41:43 +0000 (19:41 +0100)
So that we don't cause needless thrashing on older devices and spoil the
test.

tests/gem_cpu_concurrent_blit.c

index e1ff831..ff18f15 100644 (file)
@@ -92,7 +92,7 @@ main(int argc, char **argv)
 {
        drm_intel_bufmgr *bufmgr;
        struct intel_batchbuffer *batch;
-       int num_buffers = 128;
+       int num_buffers = 128, max;
        drm_intel_bo *src[128], *dst[128];
        int width = 512, height = 512;
        int fd;
@@ -100,6 +100,10 @@ main(int argc, char **argv)
 
        fd = drm_open_any();
 
+       max = gem_aperture_size (fd) / (1024 * 1024) / 2;
+       if (num_buffers > max)
+               num_buffers = max;
+
        bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
        drm_intel_bufmgr_gem_enable_reuse(bufmgr);
        batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));