Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: arun.r.murthy@intel.com, karthik.b.s@intel.com,
	jeevan.b@intel.com, kunal1.joshi@intel.com, luca@coelho.fi,
	Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
Subject: [PATCH i-g-t v2] lib/igt_kms: Backup connector modes before sorting
Date: Fri,  3 Jan 2025 21:03:33 +0530	[thread overview]
Message-ID: <20250103153333.4253-1-santhosh.reddy.guddati@intel.com> (raw)

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


             reply	other threads:[~2025-01-03 15:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03 15:33 Santhosh Reddy Guddati [this message]
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

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=20250103153333.4253-1-santhosh.reddy.guddati@intel.com \
    --to=santhosh.reddy.guddati@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@intel.com \
    --cc=karthik.b.s@intel.com \
    --cc=kunal1.joshi@intel.com \
    --cc=luca@coelho.fi \
    /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