From 173a4cf1da300af4dc3c7c0f2ea085d19e1ce90b Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Wed, 16 Oct 2013 22:49:24 +0200 Subject: [PATCH] tests/debugfs_pipe_crc: fall back to PIPE source With PLANE1 and PIPE CRC sources the test will work on all currently shipping (and planed fwiw) platforms. Also add all the other new sources for non-ivb/hsw chips. Signed-off-by: Daniel Vetter --- lib/igt_debugfs.c | 12 +++++++++++- lib/igt_debugfs.h | 7 ++++++- tests/debugfs_pipe_crc.c | 8 +++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 371f583..f903454 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -207,6 +207,11 @@ static const char *pipe_crc_sources[] = { "plane1", "plane2", "pf", + "pipe", + "TV", + "DP-B", + "DP-C", + "DP-D" }; static const char *pipe_crc_source_name(enum intel_pipe_crc_source source) @@ -214,7 +219,7 @@ static const char *pipe_crc_source_name(enum intel_pipe_crc_source source) return pipe_crc_sources[source]; } -void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc) +bool igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc) { char buf[64]; igt_crc_t *crcs = NULL; @@ -223,7 +228,10 @@ void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc) sprintf(buf, "pipe %c %s", pipe_name(pipe_crc->pipe), pipe_crc_source_name(pipe_crc->source)); + errno = 0; write(pipe_crc->ctl_fd, buf, strlen(buf)); + if (errno != 0) + return false; /* * For some no yet identified reason, the first CRC is bonkers. So @@ -231,6 +239,8 @@ void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc) */ igt_pipe_crc_get_crcs(pipe_crc, 1, &crcs); free(crcs); + + return true; } void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc) diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index 7c280e7..f2873e0 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -50,6 +50,11 @@ enum intel_pipe_crc_source { INTEL_PIPE_CRC_SOURCE_PLANE1, INTEL_PIPE_CRC_SOURCE_PLANE2, INTEL_PIPE_CRC_SOURCE_PF, + INTEL_PIPE_CRC_SOURCE_PIPE, + INTEL_PIPE_CRC_SOURCE_TV, + INTEL_PIPE_CRC_SOURCE_DP_B, + INTEL_PIPE_CRC_SOURCE_DP_C, + INTEL_PIPE_CRC_SOURCE_DP_D, INTEL_PIPE_CRC_SOURCE_MAX, }; @@ -69,7 +74,7 @@ igt_pipe_crc_new(igt_debugfs_t *debugfs, int drm_fd, enum pipe pipe, enum intel_pipe_crc_source source); void igt_pipe_crc_reset(void); void igt_pipe_crc_free(igt_pipe_crc_t *pipe_crc); -void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc); +bool igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc); void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc); void igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs, igt_crc_t **out_crcs); diff --git a/tests/debugfs_pipe_crc.c b/tests/debugfs_pipe_crc.c index 9884fd7..f9ebac9 100644 --- a/tests/debugfs_pipe_crc.c +++ b/tests/debugfs_pipe_crc.c @@ -172,7 +172,13 @@ static void test_read_crc(data_t *data) connector_set_mode(data, connector, &connector->config.default_mode); - igt_pipe_crc_start(pipe_crc); + if (!igt_pipe_crc_start(pipe_crc)) { + igt_pipe_crc_free(pipe_crc); + pipe_crc = igt_pipe_crc_new(&data->debugfs, data->drm_fd, + connector->config.pipe, + INTEL_PIPE_CRC_SOURCE_PIPE); + igt_assert(igt_pipe_crc_start(pipe_crc)); + } /* wait for 3 vblanks and the corresponding 3 CRCs */ igt_pipe_crc_get_crcs(pipe_crc, 3, &crcs); -- 2.7.4