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

Grzelak, Michal michal.grzelak at intel.com
Mon Jun 16 18:35:26 UTC 2025


Hi Jeevan,

>From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Jeevan B
>Sent: Friday, June 13, 2025 7:49 AM
>To: igt-dev at lists.freedesktop.org
>Cc: B, Jeevan <jeevan.b at intel.com>
>Subject: [PATCH i-g-t] tests/kms_setmode: Find compatible mode for eDP before selecting default mode
>
>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

This patch looks good to me.
Reviewed-by: Michał Grzelak <michal.grzelak at intel.com>

Best regards,
Michał


More information about the igt-dev mailing list