[igt-dev] [PATCH 2/2] i915/gem_exec_blt: Add tests that do a single copy using blitter
Vanshidhar Konda
vanshidhar.r.konda at intel.com
Fri Nov 1 17:44:13 UTC 2019
Add a basic test that does a single copy of data using the blitter
engine. The intention is to verify if blitter engine is copying data
as expected.
Signed-off-by: Vanshidhar Konda <vanshidhar.r.konda at intel.com>
---
tests/i915/gem_exec_blt.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/tests/i915/gem_exec_blt.c b/tests/i915/gem_exec_blt.c
index 6be73f53..e229c615 100644
--- a/tests/i915/gem_exec_blt.c
+++ b/tests/i915/gem_exec_blt.c
@@ -194,7 +194,10 @@ static void init_buffer_data(void *addr, int object_size, uint32_t base_dword)
#define verify_data(src__, dst__, size) \
igt_assert_eq(memcmp(src__, dst__, size), 0)
-static void run(int fd, int object_size, bool dumb)
+#define RUN_DUMB_BUF BIT(0)
+#define RUN_SINGLE_ITER BIT(1)
+
+static void run(int fd, int object_size, unsigned int flags)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 exec[3];
@@ -205,7 +208,7 @@ static void run(int fd, int object_size, bool dumb)
int ring;
void *src_buffer, *dst_buffer;
- if (dumb)
+ if (flags & RUN_DUMB_BUF)
handle = kmstest_dumb_create(fd, 32, 32, 32, NULL, NULL);
else
handle = gem_create(fd, 4096);
@@ -256,6 +259,9 @@ static void run(int fd, int object_size, bool dumb)
verify_data(src_buffer, dst_buffer, object_size);
+ if (flags & RUN_SINGLE_ITER)
+ goto done;
+
for (count = 1; count <= 1<<12; count <<= 1) {
struct timeval start, end;
const int reps = 9;
@@ -283,6 +289,7 @@ static void run(int fd, int object_size, bool dumb)
fflush(stdout);
}
+done:
munmap(src_buffer, object_size);
munmap(dst_buffer, object_size);
@@ -348,6 +355,15 @@ igt_main
max = igt_sysfs_get_u32(sysfs, "gt_max_freq_mhz");
}
+ igt_describe("Run a single copy operation using the blitter engine");
+ igt_subtest("basic-normal")
+ run(fd, OBJECT_SIZE, RUN_SINGLE_ITER);
+
+ igt_describe("Run a single copy operation using the blitter engine"
+ " with one object as a dumb buffer");
+ igt_subtest("basic-dumb-buf")
+ run(fd, OBJECT_SIZE, RUN_SINGLE_ITER | RUN_DUMB_BUF);
+
for (r = rps; r->suffix; r++) {
igt_fixture r->func(sysfs);
@@ -355,10 +371,10 @@ igt_main
run(fd, OBJECT_SIZE, false);
igt_subtest_f("normal%s", r->suffix)
- run(fd, OBJECT_SIZE, false);
+ run(fd, OBJECT_SIZE, 0);
igt_subtest_f("dumb-buf%s", r->suffix)
- run(fd, OBJECT_SIZE, true);
+ run(fd, OBJECT_SIZE, RUN_DUMB_BUF);
}
igt_fixture {
--
2.23.0
More information about the igt-dev
mailing list