public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>,
	Mohammed Thasleem <mohammed.thasleem@intel.com>,
	Suraj Kandpal <suraj.kandpal@intel.com>
Subject: [PATCH i-g-t 3/6] lib/igt_kms: Fix max_non_joiner_mode_found
Date: Wed,  1 Apr 2026 17:25:39 +0530	[thread overview]
Message-ID: <20260401115542.1074290-4-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20260401115542.1074290-1-kunal1.joshi@intel.com>

Previously the function, instead of giving the highest possible mode the
connector could support, started the check by looking if the mode was
equal to max_pipe_hdisplay. There may be corner cases where a connector never supports the highest mode our source can
drive (e.g. a 4K mode on a 5K-capable platform).

Fix this by iterating all modes and tracking the best one (highest
hdisplay, then highest clock as a tiebreaker) that does not require a
big joiner, as determined by igt_bigjoiner_possible(). This correctly
handles connectors with any max resolution.

v2: Reword commit message (Suraj)

Fixes: 3830ca6a5068 ("lib/igt_kms: Add support to check joiner mode limit")
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
Reviewed-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 lib/igt_kms.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 04b1f3972..dbd419a9b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6979,21 +6979,26 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
  * false otherwise.
  */
 bool max_non_joiner_mode_found(int drm_fd, drmModeConnector *connector,
-			   int max_dotclock, drmModeModeInfo *mode)
+			       int max_dotclock, drmModeModeInfo *mode)
 {
-	int max_hdisplay = get_max_pipe_hdisplay(drm_fd);
+	bool found = false;
 
 	for (int i = 0; i < connector->count_modes; i++) {
 		drmModeModeInfo *current_mode = &connector->modes[i];
 
-		if (current_mode->hdisplay == max_hdisplay &&
-		    current_mode->clock < max_dotclock) {
+		if (igt_bigjoiner_possible(drm_fd, current_mode, max_dotclock))
+			continue;
+
+		if (!found ||
+		    current_mode->hdisplay > mode->hdisplay ||
+		    (current_mode->hdisplay == mode->hdisplay &&
+		     current_mode->clock > mode->clock)) {
 			*mode = *current_mode;
-			return true;
+			found = true;
 		}
 	}
 
-	return false;
+	return found;
 }
 
 /* TODO: Move these lib functions to the joiner-specific library file
-- 
2.48.1


  parent reply	other threads:[~2026-04-01 11:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 11:55 [PATCH i-g-t 0/6] tests/kms_pipe_crc_basic: add mst suspend-resume test Kunal Joshi
2026-04-01 11:55 ` [PATCH i-g-t 1/6] tests/intel/kms_mst_helper: Add kernel-doc for existing function Kunal Joshi
2026-04-01 11:55 ` [PATCH i-g-t 2/6] tests/intel/kms_mst_helper: Add helper to check for MST outputs Kunal Joshi
2026-04-01 11:55 ` Kunal Joshi [this message]
2026-04-01 11:44   ` [PATCH i-g-t 3/6] lib/igt_kms: Fix max_non_joiner_mode_found Jani Nikula
2026-04-01 11:57     ` Joshi, Kunal1
2026-04-01 11:55 ` [PATCH i-g-t 4/6] lib/igt_kms: Export get_max_pipe_hdisplay as public helper Kunal Joshi
2026-04-01 11:47   ` Jani Nikula
2026-04-01 14:46     ` Joshi, Kunal1
2026-04-01 11:55 ` [PATCH i-g-t 5/6] tests/intel/kms_joiner: Require boundary mode for basic-max-non-joiner Kunal Joshi
2026-04-01 11:55 ` [PATCH i-g-t 6/6] tests/kms_pipe_crc_basic: Add MST suspend-resume test Kunal Joshi
2026-04-01 11:52   ` Jani Nikula
2026-04-01 11:59     ` Joshi, Kunal1
2026-04-01 12:06     ` Ville Syrjälä
2026-04-01 12:17       ` Joshi, Kunal1

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=20260401115542.1074290-4-kunal1.joshi@intel.com \
    --to=kunal1.joshi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mohammed.thasleem@intel.com \
    --cc=suraj.kandpal@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