[igt-dev] [PATCH i-g-t 2/2] tests/kms_pipe_crc_basic: Handle absent pipes for disable-crc-after-crtc
Chris Wilson
chris at chris-wilson.co.uk
Thu Nov 19 09:43:18 UTC 2020
Check that the output exists prior to use, and in doing so prevent the
test from exploding (without leaving an intelligible trace) when the
connector is randomly lost.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
tests/kms_pipe_crc_basic.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index e584dca9b..b65649d3e 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -71,6 +71,7 @@ static void test_read_crc(data_t *data, enum pipe pipe, unsigned flags)
igt_crc_t *crcs = NULL;
int c, j;
+ igt_require_pipe(display, pipe);
igt_display_require_output_on_pipe(display, pipe);
output = igt_get_single_output_for_pipe(display, pipe);
@@ -224,14 +225,21 @@ static void test_compare_crc(data_t *data, enum pipe pipe)
static void test_disable_crc_after_crtc(data_t *data, enum pipe pipe)
{
igt_display_t *display = &data->display;
- igt_output_t *output = igt_get_single_output_for_pipe(&data->display, pipe);
- igt_pipe_crc_t *pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, "auto");
- drmModeModeInfo *mode = igt_output_get_mode(output);
+ igt_pipe_crc_t *pipe_crc;
+ drmModeModeInfo *mode;
+ igt_output_t *output;
igt_crc_t crc[2];
+ igt_require_pipe(display, pipe);
+ igt_display_require_output_on_pipe(display, pipe);
+ output = igt_get_single_output_for_pipe(display, pipe);
+
+ pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, "auto");
+
igt_display_reset(display);
igt_output_set_pipe(output, pipe);
+ mode = igt_output_get_mode(output);
igt_create_color_fb(data->drm_fd,
mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
@@ -290,8 +298,6 @@ igt_main
test_read_crc(&data, pipe, TEST_SEQUENCE | TEST_NONBLOCK);
igt_subtest_f("suspend-read-crc-pipe-%s", kmstest_pipe_name(pipe)) {
- igt_require_pipe(&data.display, pipe);
-
test_read_crc(&data, pipe, 0);
igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
--
2.29.2
More information about the igt-dev
mailing list