From a0e2b99ed37499c68504f837c2b351162e0e1f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mairacanal@riseup.net> Date: Wed, 20 Jul 2022 15:33:28 -0300 Subject: [PATCH] tests/amdgpu: Skip multihead MPO tests on single display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Why] If only one output is connected, all the igt@amdgpu/amd_plane "-multihead" subtests will result in CRASH, such as can be seen in: Starting subtest: mpo-scale-nv12-multihead Received signal SIGSEGV. Stack trace: #0 [fatal_sig_handler+0x163] #1 [__sigaction+0x50] #2 [force_output_mode+0xa] #3 [test_display_mpo+0x20b] #4 [__igt_unique____real_main725+0x106d] #5 [main+0x23] #6 [__libc_start_call_main+0x80] #7 [__libc_start_main+0x89] #8 [_start+0x25] Subtest mpo-scale-nv12-multihead: CRASH (0.009s) In single-display systems, the "-multihead" subtests should SKIP. [How] Count the number of connected outputs on the system and compare it to the ideal number depending on the subtest, using igt_skip_on to assure that multiheaded subtests will SKIP on single display systems. Signed-off-by: MaÃra Canal <mairacanal@riseup.net> Reviewed-by: Alex Hung <alex.hung@amd.com> --- tests/amdgpu/amd_plane.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/amdgpu/amd_plane.c b/tests/amdgpu/amd_plane.c index faaa1b87a..4b2bee492 100644 --- a/tests/amdgpu/amd_plane.c +++ b/tests/amdgpu/amd_plane.c @@ -449,9 +449,11 @@ static void test_display_mpo(data_t *data, enum test test, uint32_t format, int { igt_display_t *display = &data->display; + igt_output_t *output; uint32_t regamma_lut_size; lut_t lut; struct fbc fb[4]; + int valid_outputs = 0; int videos[][2]= { {426, 240}, {640, 360}, @@ -464,6 +466,13 @@ static void test_display_mpo(data_t *data, enum test test, uint32_t format, int test_init(data); + /* Skip if there is less valid outputs than the required. */ + for_each_connected_output(display, output) + valid_outputs++; + + igt_skip_on_f(valid_outputs < display_count, + "Valid outputs (%d) should be equal or greater than %d\n", valid_outputs, display_count); + regamma_lut_size = igt_pipe_obj_get_prop(data->pipe[0], IGT_CRTC_GAMMA_LUT_SIZE); igt_assert_lt(0, regamma_lut_size); lut_init(&lut, regamma_lut_size); @@ -586,9 +595,17 @@ static void test_mpo_swizzle_toggle_multihead(data_t *data) { struct amdgpu_bo_metadata meta = {}; igt_display_t *display = &data->display; + igt_output_t *output; igt_fb_t fb_1280_xr24_tiled, fb_1280_ar24_tiled, fb_1920_xb24_tiled, fb_1920_xb24_linear, fb_1920_xr24_tiled; int w, h; + int valid_outputs = 0; + + /* Skip if only one display is connected. */ + for_each_connected_output(display, output) + valid_outputs++; + + igt_skip_on_f(valid_outputs == 1, "Must have more than one output connected\n"); w = 2400; h = 1350; -- GitLab