summaryrefslogtreecommitdiff
path: root/tests/gem_tiled_blits.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-07-02 11:24:57 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-07-02 11:29:26 +0100
commitae452e327aa8dab739ca521e924a9ac9fcc506cf (patch)
tree89c95003b5cd841db64bf422b14ce6fa944cdfe4 /tests/gem_tiled_blits.c
parentfaf2a0223cb8655e7ac826592b50ad4e08ec04ee (diff)
tests/gem_(linear|tiled)_blits: Repeat whilst being interrupted
Since these two tests exercise a working set larger than aperture, they require stalls which are prone to being interrupted - so interrupt them and check that everything still works.
Diffstat (limited to 'tests/gem_tiled_blits.c')
-rw-r--r--tests/gem_tiled_blits.c73
1 files changed, 42 insertions, 31 deletions
diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c
index bb439760..34b96fdc 100644
--- a/tests/gem_tiled_blits.c
+++ b/tests/gem_tiled_blits.c
@@ -117,41 +117,16 @@ check_bo(drm_intel_bo *bo, uint32_t start_val)
drm_intel_bo_unreference(linear_bo);
}
-int main(int argc, char **argv)
+static void run_test(int count)
{
drm_intel_bo **bo;
uint32_t *bo_start_val;
uint32_t start = 0;
- int i, fd, count;
-
- fd = drm_open_any();
-
- count = 0;
- if (argc > 1)
- count = atoi(argv[1]);
- if (count == 0) {
- count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
- count += (count & 1) == 0;
- } else if (count < 2) {
- fprintf(stderr, "count must be >= 2\n");
- return 1;
- }
-
- if (count > intel_get_total_ram_mb() * 9 / 10) {
- count = intel_get_total_ram_mb() * 9 / 10;
- printf("not enough RAM to run test, reducing buffer count\n");
- }
-
- printf("Using %d 1MiB buffers\n", count);
+ int i;
bo = malloc(sizeof(drm_intel_bo *)*count);
bo_start_val = malloc(sizeof(uint32_t)*count);
- bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
- drm_intel_bufmgr_gem_enable_reuse(bufmgr);
- drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 32);
- batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
-
for (i = 0; i < count; i++) {
bo[i] = create_bo(start);
bo_start_val[i] = start;
@@ -200,14 +175,50 @@ int main(int argc, char **argv)
intel_copy_bo(batch, bo[dst], bo[src], width, height);
bo_start_val[dst] = bo_start_val[src];
}
- for (i = 0; i < count; i++)
- check_bo(bo[i], bo_start_val[i]);
-
for (i = 0; i < count; i++) {
+ check_bo(bo[i], bo_start_val[i]);
drm_intel_bo_unreference(bo[i]);
- bo[i] = NULL;
}
+ free(bo);
+}
+
+int main(int argc, char **argv)
+{
+ int fd, count;
+
+ fd = drm_open_any();
+
+ count = 0;
+ if (argc > 1)
+ count = atoi(argv[1]);
+ if (count == 0) {
+ count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
+ count += (count & 1) == 0;
+ } else if (count < 2) {
+ fprintf(stderr, "count must be >= 2\n");
+ return 1;
+ }
+
+ if (count > intel_get_total_ram_mb() * 9 / 10) {
+ count = intel_get_total_ram_mb() * 9 / 10;
+ printf("not enough RAM to run test, reducing buffer count\n");
+ }
+
+ printf("Using %d 1MiB buffers\n", count);
+
+ bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+ drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+ drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 32);
+ batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+
+ run_test(count);
+
+ /* and again whilst being rudely interrupted */
+ drmtest_fork_signal_helper();
+ run_test(count);
+ drmtest_stop_signal_helper();
+
intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr);