On 20-02-2026 08:52 pm, Kunal Joshi wrote:
The function previously required hdisplay == max_pipe_hdisplay (5120 on
pre-Gen30), which means it returned false for any connector whose maximum
resolution is below the pipe limit (e.g. a 4K MST output 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.

Fixes: 3830ca6a5068 ("lib/igt_kms: Add support to check joiner mode limit")
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>

 LGTM:

Reviewed-by: Mohammed Thasleem <mohammed.thasleem@intel.com>


---
 lib/igt_kms.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5c4879604..c6678b02b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6904,19 +6904,24 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
 bool max_non_joiner_mode_found(int drm_fd, drmModeConnector *connector,
 			   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