From: Ben Widawsky <benjamin.widawsky@intel.com>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Cc: Ben Widawsky <ben@bwidawsk.net>,
Ben Widawsky <benjamin.widawsky@intel.com>
Subject: [PATCH] gem_render_copy: Provide an all pixels check
Date: Tue, 27 Jan 2015 17:59:06 -0800 [thread overview]
Message-ID: <1422410346-10524-1-git-send-email-benjamin.widawsky@intel.com> (raw)
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
tests/gem_render_copy.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index 006b6f5..6348eee 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -69,6 +69,7 @@ typedef struct {
uint32_t linear[WIDTH * HEIGHT];
} data_t;
static int opt_dump_png = false;
+static int check_all_pixels = false;
static void scratch_buf_write_to_png(struct igt_buf *buf, const char *filename)
{
@@ -125,6 +126,10 @@ static int opt_handler(int opt, int opt_index)
opt_dump_png = true;
}
+ if (opt == 'a') {
+ check_all_pixels = true;
+ }
+
return 0;
}
@@ -136,7 +141,7 @@ int main(int argc, char **argv)
igt_render_copyfunc_t render_copy = NULL;
int opt_dump_aub = igt_aub_dump_enabled();
- igt_simple_init_parse_opts(argc, argv, "d", NULL, NULL, opt_handler);
+ igt_simple_init_parse_opts(argc, argv, "da", NULL, NULL, opt_handler);
igt_fixture {
data.drm_fd = drm_open_any_render();
@@ -170,6 +175,14 @@ int main(int argc, char **argv)
drm_intel_bufmgr_gem_set_aub_dump(data.bufmgr, true);
}
+ /* This will copy the src to the mid point of the dst buffer. Presumably
+ * the out of bounds accesses will get clipped.
+ * Resulting buffer should look like:
+ * _______
+ * |dst|dst|
+ * |dst|src|
+ * -------
+ */
render_copy(batch, NULL,
&src, 0, 0, WIDTH, HEIGHT,
&dst, WIDTH / 2, HEIGHT / 2);
@@ -183,6 +196,23 @@ int main(int argc, char **argv)
AUB_DUMP_BMP_FORMAT_ARGB_8888,
STRIDE, 0);
drm_intel_bufmgr_gem_set_aub_dump(data.bufmgr, false);
+ } else if (check_all_pixels) {
+ uint32_t val;
+ int i, j;
+ gem_read(data.drm_fd, dst.bo->handle, 0,
+ data.linear, sizeof(data.linear));
+ for (i = 0; i < WIDTH; i++) {
+ for (j = 0; j < HEIGHT; j++) {
+ uint32_t color = DST_COLOR;
+ val = data.linear[j * WIDTH + i];
+ if (j >= HEIGHT/2 && i >= WIDTH/2)
+ color = SRC_COLOR;
+
+ igt_assert_f(val == color,
+ "Expected 0x%08x, found 0x%08x at (%d,%d)\n",
+ color, val, i, j);
+ }
+ }
} else {
scratch_buf_check(&data, &dst, 10, 10, DST_COLOR);
scratch_buf_check(&data, &dst, WIDTH - 10, HEIGHT - 10, SRC_COLOR);
--
2.2.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
reply other threads:[~2015-01-28 1:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1422410346-10524-1-git-send-email-benjamin.widawsky@intel.com \
--to=benjamin.widawsky@intel.com \
--cc=ben@bwidawsk.net \
--cc=intel-gfx@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