From: Robert Bragg <robert@sixbynine.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH igt v3 10/11] igt/gem_exec_parse: update registers test for v >= 8
Date: Wed, 9 Nov 2016 16:16:01 +0000 [thread overview]
Message-ID: <20161109161602.2402-11-robert@sixbynine.org> (raw)
In-Reply-To: <20161109161602.2402-1-robert@sixbynine.org>
This combines some parts of the recently added store_lri test with the
registers test to be able to first load a distinguishable value before
the LRI and explicitly read back the register to determine if the
command succeeded or was a NOOP.
For now though we won't look at OACONTROL without checking for version 9
of the command parser.
This updates the 'bad' test to check the OASTATUS2 register so that we
can explicitly read back from the register to check it becomes a NOOP.
This adds a struct test_lri for associating a mask with the init/test
values so we ignore things like hw status bits that might interfere
with the result.
Signed-off-by: Robert Bragg <robert@sixbynine.org>
---
tests/gem_exec_parse.c | 86 ++++++++++++++++++++++++++------------------------
1 file changed, 45 insertions(+), 41 deletions(-)
diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
index f241ab7..0fa3af8 100644
--- a/tests/gem_exec_parse.c
+++ b/tests/gem_exec_parse.c
@@ -37,6 +37,7 @@
#define ARRAY_LEN(A) (sizeof(A) / sizeof(A[0]))
#define DERRMR 0x44050
+#define OASTATUS2 0x2368
#define OACONTROL 0x2360
#define SO_WRITE_OFFSET_0 0x5280
@@ -250,27 +251,35 @@ static void exec_batch_chained(int fd, uint32_t cmd_bo, uint32_t *cmds,
gem_close(fd, target_bo);
}
-static void stray_lri(int fd, uint32_t handle)
+/* Be careful to take into account what register bits we can store and read
+ * from...
+ */
+struct test_lri {
+ uint32_t reg, read_mask, init_val, test_val;
+};
+
+static void
+test_lri(int fd, uint32_t handle,
+ struct test_lri *test, int expected_errno, uint32_t expect)
{
- /* Ideally this would test all once whitelisted registers */
uint32_t lri[] = {
MI_LOAD_REGISTER_IMM,
- OACONTROL,
- 0x31337000,
+ test->reg,
+ test->test_val,
MI_BATCH_BUFFER_END,
};
- int err;
-
- igt_assert_eq_u32(intel_register_read(OACONTROL), 0xdeadbeef);
- err = __exec_batch(fd, handle, lri, sizeof(lri), I915_EXEC_RENDER);
- if (err == -EINVAL)
- return;
+ intel_register_write(test->reg, test->init_val);
- igt_assert_eq(err, 0);
+ exec_batch(fd, handle,
+ lri, sizeof(lri),
+ I915_EXEC_RENDER,
+ expected_errno);
gem_sync(fd, handle);
- igt_assert_eq_u32(intel_register_read(OACONTROL), 0xdeadbeef);
+ igt_assert_eq_u32((intel_register_read(test->reg) &
+ test->read_mask),
+ expect);
}
static void hsw_load_register_reg(void)
@@ -441,43 +450,38 @@ igt_main
igt_subtest_group {
igt_fixture {
intel_register_access_init(intel_get_pci_device(), 0);
-
- intel_register_write(OACONTROL, 0xdeadbeef);
- igt_assert_eq_u32(intel_register_read(OACONTROL), 0xdeadbeef);
}
- igt_subtest("basic-stray-lri")
- stray_lri(fd, handle);
+ igt_subtest("registers") {
+ struct test_lri bad_lris[] = {
+ /* dummy head pointer */
+ { OASTATUS2, 0xffffff80, 0xdeadf000, 0xbeeff000 }
+ };
+ struct test_lri ok_lris[] = {
+ /* NB: [1:0] MBZ */
+ { SO_WRITE_OFFSET_0, 0xfffffffc,
+ 0xabcdabc0, 0xbeefbee0 }
+ };
+ int bad_lri_errno = parser_version >= 8 ? 0 : -EINVAL;
+
+ for (int i = 0; i < ARRAY_LEN(ok_lris); i++) {
+ test_lri(fd, handle,
+ ok_lris + i, 0,
+ ok_lris[i].test_val);
+ }
+
+ for (int i = 0; i < ARRAY_LEN(bad_lris); i++) {
+ test_lri(fd, handle,
+ bad_lris + i, bad_lri_errno,
+ bad_lris[i].init_val);
+ }
+ }
igt_fixture {
- intel_register_write(OACONTROL, 0);
intel_register_access_fini();
}
}
- igt_subtest("registers") {
- uint32_t lri_bad[] = {
- MI_LOAD_REGISTER_IMM,
- 0, /* disallowed register address */
- 0x12000000,
- MI_BATCH_BUFFER_END,
- };
- uint32_t lri_ok[] = {
- MI_LOAD_REGISTER_IMM,
- 0x5280, /* allowed register address (SO_WRITE_OFFSET[0]) */
- 0x1,
- MI_BATCH_BUFFER_END,
- };
- exec_batch(fd, handle,
- lri_bad, sizeof(lri_bad),
- I915_EXEC_RENDER,
- -EINVAL);
- exec_batch(fd, handle,
- lri_ok, sizeof(lri_ok),
- I915_EXEC_RENDER,
- 0);
- }
-
igt_subtest("bitmasks") {
uint32_t pc[] = {
GFX_OP_PIPE_CONTROL,
--
2.10.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-11-09 16:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 16:15 [PATCH igt v3 00/11] corresponding changes for i915-perf interface Robert Bragg
2016-11-09 16:15 ` [PATCH igt v3 01/11] igt/perf: add i915 perf stream tests for Haswell Robert Bragg
2016-11-09 16:33 ` Chris Wilson
2016-11-10 23:03 ` Matthew Auld
2016-11-14 15:52 ` Robert Bragg
2016-11-09 16:15 ` [PATCH igt v3 02/11] igt/gem_exec_parse: some minor cleanups Robert Bragg
2016-11-11 21:49 ` Matthew Auld
2016-11-09 16:15 ` [PATCH igt v3 03/11] igt/gem_exec_parse: move hsw_load_register_reg down Robert Bragg
2016-11-11 21:51 ` Matthew Auld
2016-11-09 16:15 ` [PATCH igt v3 04/11] igt/gem_exec_parse: update hsw_load_register_reg Robert Bragg
2016-11-11 22:01 ` Matthew Auld
2016-11-09 16:15 ` [PATCH igt v3 05/11] igt/gem_exec_parse: req. v < 9 for oacontrol tracking test Robert Bragg
2016-11-11 22:07 ` Matthew Auld
2016-11-09 16:15 ` [PATCH igt v3 06/11] igt/gem_exec_parse: make basic-rejected version agnostic Robert Bragg
2016-11-14 18:57 ` Matthew Auld
2016-11-09 16:15 ` [PATCH igt v3 07/11] igt/gem_exec_parse: update bitmasks test for v >=8 Robert Bragg
2016-11-11 22:08 ` Matthew Auld
2016-11-09 16:15 ` [PATCH igt v3 08/11] igt/gem_exec_parse: update cmd-crossing-page for >= v8 Robert Bragg
2016-11-11 22:10 ` Matthew Auld
2016-11-09 16:16 ` [PATCH igt v3 09/11] igt/gem_exec_parse: update hsw_load_register_reg for v >= 8 Robert Bragg
2016-11-11 22:14 ` Matthew Auld
2016-11-09 16:16 ` Robert Bragg [this message]
2016-11-11 22:28 ` [PATCH igt v3 10/11] igt/gem_exec_parse: update registers test " Matthew Auld
2016-11-09 16:16 ` [PATCH igt v3 11/11] igt/gem_exec_parse: check oacontrol lri bad for >= v9 Robert Bragg
2016-11-11 22:36 ` Matthew Auld
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=20161109161602.2402-11-robert@sixbynine.org \
--to=robert@sixbynine.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.