[PATCH i-g-t 2/3] tests: Add intel_cmds_check test
Karolina Stolarek
karolina.stolarek at intel.com
Fri Mar 31 13:41:05 UTC 2023
Introduce a simple test that verifies if XY_FAST_COPY and
XY_BLOCK_COPY entries for the current platform have correct
information.
Signed-off-by: Karolina Stolarek <karolina.stolarek at intel.com>
---
lib/i915/i915_blt.c | 15 +++++++++
lib/i915/i915_blt.h | 1 +
lib/intel_blt_verifier.h | 4 +++
tests/i915/intel_cmds_check.c | 57 +++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +
5 files changed, 78 insertions(+)
create mode 100644 tests/i915/intel_cmds_check.c
diff --git a/lib/i915/i915_blt.c b/lib/i915/i915_blt.c
index ef67fe26..a38fc46b 100644
--- a/lib/i915/i915_blt.c
+++ b/lib/i915/i915_blt.c
@@ -426,6 +426,21 @@ const char *blt_tiling_name(enum blt_tiling_type tiling)
return NULL;
}
+const char *blt_cmd_name(enum blt_cmd_type cmd)
+{
+ switch (cmd) {
+ case SRC_COPY: return "SRC_COPY";
+ case XY_SRC_COPY: return "XY_SRC_COPY";
+ case XY_FAST_COPY: return "XY_FAST_COPY";
+ case XY_BLOCK_COPY: return "XY_BLOCK_COPY";
+ default:
+ break;
+ }
+
+ igt_warn("Unknown blitter command passed: %d\n", cmd);
+ return NULL;
+}
+
static int __block_tiling(enum blt_tiling_type tiling)
{
switch (tiling) {
diff --git a/lib/i915/i915_blt.h b/lib/i915/i915_blt.h
index a5f0edd1..8d9a9af6 100644
--- a/lib/i915/i915_blt.h
+++ b/lib/i915/i915_blt.h
@@ -177,6 +177,7 @@ bool blt_block_copy_supports_compression(int i915);
bool blt_uses_extended_block_copy(int i915);
const char *blt_tiling_name(enum blt_tiling_type tiling);
+const char *blt_cmd_name(enum blt_cmd_type cmd);
uint64_t emit_blt_block_copy(int i915,
uint64_t ahnd,
diff --git a/lib/intel_blt_verifier.h b/lib/intel_blt_verifier.h
index 424a2bc0..03edb107 100644
--- a/lib/intel_blt_verifier.h
+++ b/lib/intel_blt_verifier.h
@@ -9,6 +9,10 @@
#include "i915/i915_blt.h"
#include "intel_bufops.h"
+/* For now, the verifier can only test a subsection of blt commands */
+#define for_each_verifier_blt_command(__cmd) \
+ for (__cmd = XY_FAST_COPY; __cmd <= XY_BLOCK_COPY; __cmd++)
+
struct intel_blt_verifier {
int fd;
const intel_ctx_t *ctx;
diff --git a/tests/i915/intel_cmds_check.c b/tests/i915/intel_cmds_check.c
new file mode 100644
index 00000000..b66e190a
--- /dev/null
+++ b/tests/i915/intel_cmds_check.c
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#include "intel_blt_verifier.h"
+
+IGT_TEST_DESCRIPTION("Check if intel_cmds_info has correct information.");
+
+static const char *results_str(int correct_info)
+{
+ if (correct_info > 0)
+ return "is not supported by the platform";
+ else
+ return "supports a command, but an entry is missing";
+
+ igt_assert_f(0, "Invalid value passed in, no information for %d code\n",
+ correct_info);
+}
+
+static void has_correct_intel_cmds(int fd)
+{
+ struct intel_blt_verifier *verifier;
+ enum blt_tiling_type tiling;
+ enum blt_cmd_type blt_cmd;
+ int mismatch_found;
+
+ verifier = blt_verifier_init(fd);
+
+ for_each_verifier_blt_command(blt_cmd) {
+ for_each_tiling(tiling) {
+ if (!verifier_supports_blt_tiling(tiling))
+ continue;
+
+ mismatch_found = blt_verify_support(verifier, blt_cmd, tiling);
+ igt_assert_f(mismatch_found == 0,
+ "intel_cmds_info library has incorrect "
+ "information. %s command with tiling %s %s.\n",
+ blt_cmd_name(blt_cmd),
+ blt_tiling_name(tiling),
+ results_str(mismatch_found));
+ }
+ }
+
+ blt_verifier_destroy(verifier);
+
+ igt_info("Check successful: intel_cmds_info entries are up-to-date.\n");
+}
+
+igt_simple_main
+{
+ int fd = drm_open_driver(DRIVER_INTEL);
+
+ has_correct_intel_cmds(fd);
+
+ close(fd);
+}
diff --git a/tests/meson.build b/tests/meson.build
index 7d2168be..9c776b2f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -217,6 +217,7 @@ i915_progs = [
'i915_query',
'i915_selftest',
'i915_suspend',
+ 'intel_cmds_check',
'kms_big_fb',
'kms_big_joiner' ,
'kms_busy',
--
2.25.1
More information about the Intel-gfx-trybot
mailing list