Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, Jeevan B <jeevan.b@intel.com>
Subject: [PATCH i-g-t 2/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode
Date: Mon, 22 Sep 2025 09:31:51 +0530	[thread overview]
Message-ID: <20250922040151.1374078-3-jeevan.b@intel.com> (raw)
In-Reply-To: <20250922040151.1374078-1-jeevan.b@intel.com>

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

v2: Fix logic for eDP fallback.
v3: Fix comment to say ‘lowest clock mode selected’ instead of
    ‘default mode’.
v4: Update commit message.

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

diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 48d0c3e1e..135918007 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -256,6 +256,25 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
 		}
 	}
 
+	/* If an eDP connector is present, iterate through its modes and
+	 * pick a mode with lowest clock, since internal panels typically
+	 * dictate the clone mode and may have HRR support, making them
+	 * incompatible with modes supported by external displays.
+	 */
+	for (i = 0; i < crtc->connector_count; i++) {
+		drmModeConnector *conn = crtc->cconfs[i].connector;
+
+		if (conn->connector_type == DRM_MODE_CONNECTOR_eDP) {
+			mode = &conn->modes[0];
+			for (int j = 1; j < conn->count_modes; j++) {
+				if (conn->modes[j].clock < mode->clock)
+					mode = &conn->modes[j];
+			}
+			*mode_ret = *mode;
+			return;
+		}
+	}
+
 	/*
 	 * 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.43.0


  parent reply	other threads:[~2025-09-22  4:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22  4:01 [PATCH i-g-t 0/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode Jeevan B
2025-09-22  4:01 ` [PATCH i-g-t 1/2] tests/kms_setmode: simplify mode selection by removing goto Jeevan B
2025-09-22  4:01 ` Jeevan B [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-09-22  4:42 [PATCH i-g-t 0/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode Jeevan B
2025-09-22  4:42 ` [PATCH i-g-t 2/2] " Jeevan B
2025-09-26  4:32   ` Karthik B S
2025-09-19  3:17 [PATCH i-g-t 0/2] " Jeevan B
2025-09-19  3:17 ` [PATCH i-g-t 2/2] " Jeevan B
2025-09-19  6:20   ` Karthik B S
2025-09-17 14:43 [PATCH i-g-t 0/2] " Jeevan B
2025-09-17 14:43 ` [PATCH i-g-t 2/2] " Jeevan B
2025-09-18 15:41   ` Kamil Konieczny
2025-09-18 15:51     ` B, Jeevan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250922040151.1374078-3-jeevan.b@intel.com \
    --to=jeevan.b@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox