summaryrefslogtreecommitdiff
path: root/tests/gem_read_read_speed.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-12-13 12:46:47 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-12-13 15:20:18 +0000
commit14f70a861b66f8a62a53911cf587fadeebca5957 (patch)
tree3d400b7c0d98f4ee0926806cbdb46c0414c01c7d /tests/gem_read_read_speed.c
parent866a6f2c41da8505cf868a9d83301cddd41cc9fb (diff)
igt/gem_read_read_speed: Tweak to show comparison against write-write
Since we hold an exclusive write lock we expect 2 writes to happen serially, but we expect 2 reads to happen in parallel. Expand the testing to demonstrate this effect (i.e. we expect read-read to be roughly 2x faster than write-write for small copies on big core.) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_read_read_speed.c')
-rw-r--r--tests/gem_read_read_speed.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/tests/gem_read_read_speed.c b/tests/gem_read_read_speed.c
index 0e291787c495..c01e4c255669 100644
--- a/tests/gem_read_read_speed.c
+++ b/tests/gem_read_read_speed.c
@@ -154,7 +154,8 @@ static drm_intel_bo *create_bo(drm_intel_bufmgr *bufmgr,
&tiling_mode, &pitch, 0);
}
-static void run(drm_intel_bufmgr *bufmgr, int _width, int _height)
+static void run(drm_intel_bufmgr *bufmgr, int _width, int _height,
+ bool write_bcs, bool write_rcs)
{
drm_intel_bo *src = NULL, *bcs = NULL, *rcs = NULL;
drm_intel_bo *bcs_batch, *rcs_batch;
@@ -170,8 +171,16 @@ static void run(drm_intel_bufmgr *bufmgr, int _width, int _height)
set_bo(src, 0xdeadbeef);
- rcs_batch = rcs_copy_bo(rcs, src);
- bcs_batch = bcs_copy_bo(bcs, src);
+ if (write_bcs) {
+ bcs_batch = bcs_copy_bo(src, bcs);
+ } else {
+ bcs_batch = bcs_copy_bo(bcs, src);
+ }
+ if (write_rcs) {
+ rcs_batch = rcs_copy_bo(src, rcs);
+ } else {
+ rcs_batch = rcs_copy_bo(rcs, src);
+ }
drm_intel_bo_unreference(rcs);
drm_intel_bo_unreference(bcs);
@@ -185,7 +194,9 @@ static void run(drm_intel_bufmgr *bufmgr, int _width, int _height)
drm_intel_gem_bo_start_gtt_access(src, true);
clock_gettime(CLOCK_MONOTONIC, &end);
- igt_info("Time to read-read %dx%d [%dk]: %7.3fµs\n",
+ igt_info("Time to %s-%s %dx%d [%dk]: %7.3fµs\n",
+ write_bcs ? "write" : "read",
+ write_rcs ? "write" : "read",
width, height, 4*width*height/1024,
elapsed(&start, &end, loops));
@@ -222,7 +233,14 @@ igt_main
igt_info("Semaphores: %d\n", semaphores_enabled(fd));
}
- for (i = 0; sizes[i] != 0; i++)
+ for (i = 0; sizes[i] != 0; i++) {
igt_subtest_f("read-read-%dx%d", sizes[i], sizes[i])
- run(bufmgr, sizes[i], sizes[i]);
+ run(bufmgr, sizes[i], sizes[i], false, false);
+ igt_subtest_f("read-write-%dx%d", sizes[i], sizes[i])
+ run(bufmgr, sizes[i], sizes[i], false, true);
+ igt_subtest_f("write-read-%dx%d", sizes[i], sizes[i])
+ run(bufmgr, sizes[i], sizes[i], true, false);
+ igt_subtest_f("write-write-%dx%d", sizes[i], sizes[i])
+ run(bufmgr, sizes[i], sizes[i], true, true);
+ }
}