public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/kms_bw: Skip tests when outputs don't support the mode
@ 2026-02-25 16:03 Jason-JH Lin
  2026-02-26  0:48 ` ✗ Xe.CI.BAT: failure for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Jason-JH Lin @ 2026-02-25 16:03 UTC (permalink / raw)
  To: igt-dev, Karthik B S, Swati Sharma, Kamil Konieczny,
	Juha-Pekka Heikkila, Bhanuprakash Modem, Fei Shao
  Cc: Jani, Jason-JH Lin, Paul-PL Chen, Nancy Lin, Singo Chang,
	Gil Dekel, Yacoub, Project_Global_Chrome_Upstream_Group

The kms_bw test uses hardcoded display timings that may not match
what connected panels support. This causes test failures when forcing
unsupported modes on fixed-mode panels like DSI.

Add output_mode_supported() to check if a mode exists in the
connector's mode list before using it. Skip outputs that don't
support the requested mode during buffer creation, CRC collection,
and cleanup.

For multi-output tests, proceed if at least one output supports
the mode. Skip only if all outputs reject it.

Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
---
 tests/kms_bw.c | 39 +++++++++++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/tests/kms_bw.c b/tests/kms_bw.c
index 778900d8c9f1..dc79ccc001f1 100644
--- a/tests/kms_bw.c
+++ b/tests/kms_bw.c
@@ -187,6 +187,35 @@ static void force_output_mode(data_t *d, igt_output_t *output,
 	igt_output_override_mode(output, mode);
 }
 
+static bool output_mode_supported(igt_output_t *output, const drmModeModeInfo *mode)
+{
+	drmModeConnector *connector = output->config.connector;
+	int i;
+
+	/* Virtual/forced sinks support all modes */
+	if (!igt_output_is_connected(output))
+		return true;
+
+	for (i = 0; i < connector->count_modes; i++) {
+		drmModeModeInfo *conn_mode = &connector->modes[i];
+
+		if (conn_mode->hdisplay == mode->hdisplay &&
+		    conn_mode->vdisplay == mode->vdisplay &&
+		    conn_mode->vrefresh == mode->vrefresh) {
+			igt_info("Found matching mode for %dx%d@%dHz on %s\n",
+				 mode->hdisplay, mode->vdisplay, mode->vrefresh,
+				 igt_output_name(output));
+			return true;
+		}
+	}
+
+	igt_info("Mode %dx%d@%dHz not supported by %s (has %d modes)\n",
+		 mode->hdisplay, mode->vdisplay, mode->vrefresh,
+		 igt_output_name(output), connector->count_modes);
+
+	return false;
+}
+
 static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo *mode, bool physical) {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
@@ -194,7 +223,7 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 	igt_crc_t zero, captured[IGT_MAX_PIPES];
 	int i = 0, num_pipes = 0;
 	igt_crtc_t *crtc;
-	int ret;
+	int ret = -EINVAL;
 
 	/* Cannot use igt_display_n_crtcs() due to fused pipes on i915 where they do
 	 * not give the numver of valid crtcs and always return IGT_MAX_PIPES */
@@ -211,7 +240,7 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 	/* create buffers */
 	for (i = 0; i <= pipe; i++) {
 		output = physical ? data->connected_output[i] : data->output[i];
-		if (!output) {
+		if (!output || !output_mode_supported(output, mode)) {
 			continue;
 		}
 
@@ -228,7 +257,9 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 		igt_plane_set_fb(data->primary[i], &buffer[i]);
 		igt_info("Assigning pipe %s to output %s with mode %s\n",
 			 kmstest_pipe_name(i), igt_output_name(output), mode->name);
+		ret = 0;
 	}
+	igt_skip_on_f(ret != 0, "Unsupported mode for all pipes\n");
 
 	ret = igt_display_try_commit_atomic(display,
 					    DRM_MODE_ATOMIC_ALLOW_MODESET |
@@ -240,7 +271,7 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 
 	for (i = 0; i <= pipe; i++) {
 		output = physical ? data->connected_output[i] : data->output[i];
-		if (!output) {
+		if (!output || !output_mode_supported(output, mode)) {
 			continue;
 		}
 
@@ -251,7 +282,7 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 
 	for (i = pipe; i >= 0; i--) {
 		output = physical ? data->connected_output[i] : data->output[i];
-		if (!output)
+		if (!output || !output_mode_supported(output, mode))
 			continue;
 
 		igt_remove_fb(display->drm_fd, &buffer[i]);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-03-10  7:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 16:03 [PATCH i-g-t] tests/kms_bw: Skip tests when outputs don't support the mode Jason-JH Lin
2026-02-26  0:48 ` ✗ Xe.CI.BAT: failure for " Patchwork
2026-02-26  1:15 ` ✓ i915.CI.BAT: success " Patchwork
2026-02-26  3:58 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-26  5:40 ` ✗ i915.CI.Full: " Patchwork
2026-03-06  7:44 ` [PATCH i-g-t] " Fei Shao
2026-03-09  3:16   ` Jason-JH Lin (林睿祥)
2026-03-09 10:31 ` Louis Chauvet
2026-03-10  7:20   ` Jason-JH Lin (林睿祥)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox