summaryrefslogtreecommitdiff
path: root/tests/kms_pipe_crc_basic.c
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.com>2016-09-08 09:31:09 +0200
committerTomeu Vizoso <tomeu.vizoso@collabora.com>2016-12-14 11:47:05 +0100
commita56a1f6e30ca49a50d4e8c896608ba605ee1f2fd (patch)
treef5d3077dbe8b02abff19d74e0b1310b2ae65107f /tests/kms_pipe_crc_basic.c
parent40769d7925d9b28cc7e71564e2378aebf20efbf8 (diff)
lib/debugfs: Support new generic ABI for CRC capture
The kernel has now a new debugfs ABI that can also allow capturing frame CRCs for drivers other than i915. Add alternative codepaths so the new ABI is used if the kernel is recent enough, and fall back to the legacy ABI if not. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
Diffstat (limited to 'tests/kms_pipe_crc_basic.c')
-rw-r--r--tests/kms_pipe_crc_basic.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 04d5a134..b106f9bd 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -49,6 +49,8 @@ static void test_bad_command(data_t *data, const char *cmd)
size_t written;
ctl = igt_debugfs_fopen("i915_display_crc_ctl", "r+");
+ igt_require(ctl);
+
written = fwrite(cmd, 1, strlen(cmd), ctl);
fflush(ctl);
igt_assert_eq(written, strlen(cmd));
@@ -58,6 +60,30 @@ static void test_bad_command(data_t *data, const char *cmd)
fclose(ctl);
}
+static void test_bad_source(data_t *data)
+{
+ FILE *f;
+ size_t written;
+ const char *source = "foo";
+
+ f = igt_debugfs_fopen("crtc-0/crc/control", "w");
+ if (!f) {
+ test_bad_command(data, "pipe A foo");
+ return;
+ }
+
+ written = fwrite(source, 1, strlen(source), f);
+ fflush(f);
+ igt_assert_eq(written, strlen(source));
+ igt_assert(!ferror(f));
+ igt_assert(!errno);
+ fclose(f);
+
+ f = igt_debugfs_fopen("crtc-0/crc/data", "w");
+ igt_assert(!f);
+ igt_assert_eq(errno, EINVAL);
+}
+
#define N_CRCS 3
#define TEST_SEQUENCE (1<<0)
@@ -185,7 +211,7 @@ igt_main
igt_skip_on_simulation();
igt_fixture {
- data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+ data.drm_fd = drm_open_driver_master(DRIVER_ANY);
igt_enable_connectors();
@@ -200,7 +226,7 @@ igt_main
test_bad_command(&data, "pipe D none");
igt_subtest("bad-source")
- test_bad_command(&data, "pipe A foo");
+ test_bad_source(&data);
igt_subtest("bad-nb-words-1")
test_bad_command(&data, "pipe foo");