[PATCH i-g-t] tests/kms_setmode: Find compatible mode for eDP before selecting default mode

Jeevan B jeevan.b at intel.com
Fri Jun 13 05:48:48 UTC 2025


This change finds a common mode for eDP before falling back to default mode.
It avoids unnecessary failures by not selecting an unsupported mode for eDP.

Signed-off-by: Jeevan B <jeevan.b at intel.com>
---
 tests/kms_setmode.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 484c3a95f..6e7e5942a 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -252,6 +252,21 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
 			goto found;
 	}
 
+	/*
+	 * If eDP is present, try its modes to find a compatible one.
+	 */
+	for (int c = 0; c < crtc->connector_count; c++) {
+		drmModeConnector *conn = crtc->cconfs[c].connector;
+		if (conn->connector_type == DRM_MODE_CONNECTOR_eDP) {
+			for (i = 0; i < conn->count_modes; i++) {
+				mode = &conn->modes[i];
+				if (crtc_supports_mode(crtc, mode))
+					goto found;
+			}
+		break;
+		}
+	}
+
 	/*
 	 * If none is found then just pick the default mode from all connectors
 	 * with the smallest clock, hope the other connectors can support it by
-- 
2.25.1



More information about the igt-dev mailing list