Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2] lib/igt_kms: Backup connector modes before sorting
@ 2025-01-03 15:33 Santhosh Reddy Guddati
  2025-01-03 16:37 ` ✓ Xe.CI.BAT: success for lib/igt_kms: Backup connector modes before sorting (rev2) Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Santhosh Reddy Guddati @ 2025-01-03 15:33 UTC (permalink / raw)
  To: igt-dev
  Cc: arun.r.murthy, karthik.b.s, jeevan.b, kunal1.joshi, luca,
	Santhosh Reddy Guddati

Backup connector modes before sorting to ensure the original mode
is not changed if the joiner is not found.This will skip updating
connector->mode[0] if joiner is not available.

v2: Dont sort the modes, instead check for the required modes (Luca Coelho)

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13287
Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
---
 lib/igt_kms.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a67d17c4f..95e3059f7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6418,14 +6418,13 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
 {
 	bool found = false;
 
-	igt_sort_connector_modes(connector, sort_drm_modes_by_res_dsc);
-	found = igt_bigjoiner_possible(drm_fd, &connector->modes[0], max_dotclock);
-	if (!found) {
-		igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
-		found = igt_bigjoiner_possible(drm_fd, &connector->modes[0], max_dotclock);
+	for (int i=0; i< connector->count_modes; i++) {
+		if (igt_bigjoiner_possible(drm_fd, &connector->modes[i], max_dotclock)) {
+			*mode = connector->modes[i];
+			found = true;
+			break;
+		}
 	}
-	if (found)
-		*mode = connector->modes[0];
 	return found;
 }
 
@@ -6462,14 +6461,14 @@ bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
 {
 	bool found = false;
 
-	igt_sort_connector_modes(connector, sort_drm_modes_by_res_dsc);
-	found = igt_ultrajoiner_possible(&connector->modes[0], max_dotclock);
-	if (!found) {
-		igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
-		found = igt_ultrajoiner_possible(&connector->modes[0], max_dotclock);
+	for (int i = 0; i < connector->count_modes; i++) {
+		if (igt_ultrajoiner_possible(&connector->modes[i], max_dotclock)) {
+			*mode = connector->modes[i];
+			found = true;
+			break;
+		}
 	}
-	if (found)
-		*mode = connector->modes[0];
+
 	return found;
 }
 
-- 
2.34.1


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

end of thread, other threads:[~2025-01-07  9:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-03 15:33 [PATCH i-g-t v2] lib/igt_kms: Backup connector modes before sorting Santhosh Reddy Guddati
2025-01-03 16:37 ` ✓ Xe.CI.BAT: success for lib/igt_kms: Backup connector modes before sorting (rev2) Patchwork
2025-01-03 16:39 ` ✓ i915.CI.BAT: " Patchwork
2025-01-03 20:16 ` ✗ i915.CI.Full: failure " Patchwork
2025-01-04  0:39 ` ✗ Xe.CI.Full: " Patchwork
2025-01-07  6:43 ` [PATCH i-g-t v2] lib/igt_kms: Backup connector modes before sorting Luca Coelho
2025-01-07  9:29   ` Luca Coelho
2025-01-07  8:33 ` Karthik B S

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