[PATCH i-g-t v2 01/11] tests/amdgpu/amd_multidisplay_modeset: Prepare for returning NULL from igt_crtc_for_pipe()

Jani Nikula
2026-03-20T10:39:50Z

AMD should always have enough CRTCs for the test. Assert this is the
case by checking the CRTC returned from igt_crtc_for_pipe() is valid.

This prepares for returning NULL for invalid pipes from
igt_crtc_for_pipe() by ensuring the test logic is sound. The follow-up
can change the check from crtc->valid to crtc != NULL with no functional
change here.

Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tests/amdgpu/amd_multidisplay_modeset.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tests/amdgpu/amd_multidisplay_modeset.c b/tests/amdgpu/amd_multidisplay_modeset.c
index 40d1e5d7f42b..ebcfea8ee35f 100644
--- a/tests/amdgpu/amd_multidisplay_modeset.c
+++ b/tests/amdgpu/amd_multidisplay_modeset.c
@@ -327,6 +327,8 @@ static void multiple_display_test(struct data_t *data, enum sub_test test_mode)

crtc = igt_crtc_for_pipe(display, j);

+ igt_assert_f(crtc->valid, "There is no pipe %s\n", kmstest_pipe_name(j));
+
igt_create_pattern_fb(data->fd, kmode->hdisplay,
kmode->vdisplay, DRM_FORMAT_XRGB8888,
0, (buf + j));
--
2.47.3