Skip to contentSkip to conversation

tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode

PATCH New Jeevan B 1 participant 1 message Sep 16, 2025

lore
Share & tools
lore

Jeevan B

author
#0 lore raw

PATCH 1/1 tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode

If an eDP connector is present, prefer selecting its default mode for cloning. Some eDP panels support only high refresh rate (HRR) modes, which may not be compatible with external displays. To avoid invalid clone configurations and test failures, we choose the default mode from the eDP connector when available.

v2: Fix 'goto' when fitting mode is found.

---
 tests/kms_setmode.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
tests/kms_setmode.c +15 -0
index 484c3a95f..62cb8c453 100644
@@ -252,6 +252,21 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
 			goto found;
 	}
 
+	/* If an eDP connector is present, prefer selecting its default mode
+	 * for cloning, since internal panels typically dictate the clone mode
+	 * and may have HRR support, making them incompatible with modes
+	 * supported by external displays.
+	 */
+	for (i = 1; i < crtc->connector_count; i++) {
+		drmModeConnector *conn = crtc->cconfs[i].connector;
+
+		if (conn->connector_type == DRM_MODE_CONNECTOR_eDP) {
+			if (crtc->cconfs[i].default_mode.clock < mode->clock)
+				mode = &crtc->cconfs[i].default_mode;
+				goto found;
+		}
+	}
+
 	/*
 	 * 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
Signature · 1 line
2.43.0