From: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH 1/2] i915/gem_exec_blt: Verify data after blitter copy
Date: Fri, 1 Nov 2019 10:44:12 -0700 [thread overview]
Message-ID: <20191101174413.1495370-2-vanshidhar.r.konda@intel.com> (raw)
In-Reply-To: <20191101174413.1495370-1-vanshidhar.r.konda@intel.com>
Verify the data after the blitter engine has copied data from source to
destination.
Signed-off-by: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
---
tests/i915/gem_exec_blt.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tests/i915/gem_exec_blt.c b/tests/i915/gem_exec_blt.c
index ffb60d0c..6be73f53 100644
--- a/tests/i915/gem_exec_blt.c
+++ b/tests/i915/gem_exec_blt.c
@@ -182,6 +182,18 @@ static int dcmp(const void *A, const void *B)
return 0;
}
+static void init_buffer_data(void *addr, int object_size, uint32_t base_dword)
+{
+ uint32_t *base_addr = (uint32_t *)addr;
+ int num_itr = object_size/sizeof(uint32_t);
+
+ for (int i = 0; i < num_itr; i++)
+ base_addr[i] = base_dword + i;
+}
+
+#define verify_data(src__, dst__, size) \
+ igt_assert_eq(memcmp(src__, dst__, size), 0)
+
static void run(int fd, int object_size, bool dumb)
{
struct drm_i915_gem_execbuffer2 execbuf;
@@ -191,6 +203,7 @@ static void run(int fd, int object_size, bool dumb)
uint32_t handle, src, dst;
int len, count;
int ring;
+ void *src_buffer, *dst_buffer;
if (dumb)
handle = kmstest_dumb_create(fd, 32, 32, 32, NULL, NULL);
@@ -200,6 +213,12 @@ static void run(int fd, int object_size, bool dumb)
src = gem_create(fd, object_size);
dst = gem_create(fd, object_size);
+ src_buffer = gem_mmap__wc(fd, src, 0, object_size, PROT_WRITE);
+ dst_buffer = gem_mmap__wc(fd, src, 0, object_size,
+ PROT_READ | PROT_WRITE);
+
+ init_buffer_data(src_buffer, object_size, 0xcafe);
+
len = gem_linear_blt(fd, buf, 0, 1, object_size, reloc);
gem_write(fd, handle, 0, buf, len);
@@ -235,6 +254,8 @@ static void run(int fd, int object_size, bool dumb)
}
gem_sync(fd, handle);
+ verify_data(src_buffer, dst_buffer, object_size);
+
for (count = 1; count <= 1<<12; count <<= 1) {
struct timeval start, end;
const int reps = 9;
@@ -242,11 +263,13 @@ static void run(int fd, int object_size, bool dumb)
int n;
for (n = 0; n < reps; n++) {
+ memset(dst_buffer, 0, object_size);
gettimeofday(&start, NULL);
for (int loop = 0; loop < count; loop++)
gem_execbuf(fd, &execbuf);
gem_sync(fd, handle);
gettimeofday(&end, NULL);
+ verify_data(src_buffer, dst_buffer, object_size);
t[n] = elapsed(&start, &end, count);
}
qsort(t, n, sizeof(double), dcmp);
@@ -259,6 +282,10 @@ static void run(int fd, int object_size, bool dumb)
bytes_per_sec((char *)buf, object_size/sum*1e6));
fflush(stdout);
}
+
+ munmap(src_buffer, object_size);
+ munmap(dst_buffer, object_size);
+
gem_close(fd, handle);
}
--
2.23.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next parent reply other threads:[~2019-11-01 17:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191101174413.1495370-1-vanshidhar.r.konda@intel.com>
2019-11-01 17:44 ` Vanshidhar Konda [this message]
[not found] ` <20191101174413.1495370-3-vanshidhar.r.konda@intel.com>
2019-11-01 17:53 ` [igt-dev] [PATCH 2/2] i915/gem_exec_blt: Add tests that do a single copy using blitter Chris Wilson
2019-11-01 18:36 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_exec_blt: Add basic tests and verify data Patchwork
2019-11-03 4:42 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191101174413.1495370-2-vanshidhar.r.konda@intel.com \
--to=vanshidhar.r.konda@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox