public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v3] tests/kms_setmode: Add HDMI 2.0 clock limit for mode selection
@ 2026-03-31 12:59 Jeevan B
  2026-03-31 15:31 ` ✓ Xe.CI.BAT: success for tests/kms_setmode: Add HDMI 2.0 clock limit for mode selection (rev3) Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jeevan B @ 2026-03-31 12:59 UTC (permalink / raw)
  To: igt-dev; +Cc: ankit.k.nautiyal, jani.nikula, Jeevan B

eDP modes with high clock rates were being forced on HDMI 2.0 displays,
causing kernel to reject with EINVAL. Add clock validation to skip
incompatible eDP modes and fall back to supported modes.

v2: Add HDMI 2.0 clock limit helper, drop crtc_supports_mode(),
    and ensure per-connector compatibility to avoid invalid modes.
v3: Refactor connector compatibility checks into helper for clarity.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 tests/kms_setmode.c | 39 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 1f2849bc2..4d4f980f6 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -79,6 +79,9 @@
 /* restricted pipe count */
 #define CRTC_RESTRICT_CNT 2
 
+/* Clock limit for HDMI 2.0 */
+#define HDMI_2_0_MAX_CLOCK_KHZ 600000
+
 static int drm_fd;
 static drmModeRes *drm_resources;
 static int filter_test_id;
@@ -165,6 +168,35 @@ static bool connector_supports_mode(drmModeConnector *connector,
 	return false;
 }
 
+static bool hdmi_connector_mode_exceeds_hdmi20_limit(drmModeConnector *connector,
+						     drmModeModeInfo *mode)
+{
+	if (connector->connector_type != DRM_MODE_CONNECTOR_HDMIA &&
+	    connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)
+		return false;
+
+	return mode->clock > HDMI_2_0_MAX_CLOCK_KHZ;
+}
+
+static bool mode_compatible_with_connectors(struct crtc_config *crtc,
+					    drmModeModeInfo *mode)
+{
+	int k;
+
+	for (k = 0; k < crtc->connector_count; k++) {
+		drmModeConnector *conn = crtc->cconfs[k].connector;
+
+		/* Check HDMI 2.0 clock + per-connector compatibility */
+		if (hdmi_connector_mode_exceeds_hdmi20_limit(conn, mode))
+			return false;
+
+		if (!connector_supports_mode(conn, mode))
+			return false;
+	}
+
+	return true;
+}
+
 static bool crtc_supports_mode(struct crtc_config *crtc, drmModeModeInfo *mode)
 {
 	int i;
@@ -270,8 +302,11 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
 				if (conn->modes[j].clock < mode->clock)
 					mode = &conn->modes[j];
 			}
-			*mode_ret = *mode;
-			return;
+
+			if (mode_compatible_with_connectors(crtc, mode)) {
+				*mode_ret = *mode;
+				return;
+			}
 		}
 	}
 
-- 
2.43.0


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

end of thread, other threads:[~2026-04-01  6:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 12:59 [PATCH i-g-t v3] tests/kms_setmode: Add HDMI 2.0 clock limit for mode selection Jeevan B
2026-03-31 15:31 ` ✓ Xe.CI.BAT: success for tests/kms_setmode: Add HDMI 2.0 clock limit for mode selection (rev3) Patchwork
2026-03-31 15:38 ` ✓ i915.CI.BAT: " Patchwork
2026-03-31 20:13 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-01  6:10 ` ✓ i915.CI.Full: success " Patchwork

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