Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Karthik B S <karthik.b.s@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: santhosh.reddy.guddati@intel.com, jeevan.b@intel.com,
	Karthik B S <karthik.b.s@intel.com>
Subject: [PATCH i-g-t] lib/igt_kms: Use get_max_pipe_hdisplay in joiner_possible fucntions
Date: Wed, 19 Mar 2025 11:42:44 +0530	[thread overview]
Message-ID: <20250319061244.769947-1-karthik.b.s@intel.com> (raw)

Update 'joiner_possible' helper functions to use the existing
get_max_pipe_hdisplay helper.

Signed-off-by: Karthik B S <karthik.b.s@intel.com>
---
 lib/igt_kms.c | 45 ++++++++++++++++++++-------------------------
 lib/igt_kms.h |  2 +-
 2 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index cc3bb3ae7..99c8707c7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6428,6 +6428,20 @@ int igt_get_current_cdclk(int fd)
 	return read_and_parse_cdclk_debugfs(fd, "Current CD clock frequency:");
 }
 
+/**
+ * get_max_hdisplay:
+ * @drm_fd: drm file descriptor
+ *
+ * Returns: The maximum hdisplay supported per pipe.
+ */
+static int get_max_pipe_hdisplay(int drm_fd)
+{
+	int dev_id = intel_get_drm_devid(drm_fd);
+
+	return (intel_display_ver(dev_id) >= 30) ? HDISPLAY_6K_PER_PIPE :
+						   HDISPLAY_5K_PER_PIPE;
+}
+
 /**
  * igt_bigjoiner_possible:
  * @drm_fd: drm file descriptor
@@ -6441,13 +6455,8 @@ int igt_get_current_cdclk(int fd)
  */
 bool igt_bigjoiner_possible(int drm_fd, drmModeModeInfo *mode, int max_dotclock)
 {
-	int max_hdisplay, dev_id;
-
-	dev_id = intel_get_drm_devid(drm_fd);
-	max_hdisplay = (intel_display_ver(dev_id) >= 30) ? HDISPLAY_6K_PER_PIPE :
-			HDISPLAY_5K_PER_PIPE;
-
-	return (mode->hdisplay > max_hdisplay || mode->clock > max_dotclock);
+	return (mode->hdisplay > get_max_pipe_hdisplay(drm_fd) ||
+		mode->clock > max_dotclock);
 }
 
 /**
@@ -6469,7 +6478,7 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
 
 	for (int i=0; i< connector->count_modes; i++) {
 		if (igt_bigjoiner_possible(drm_fd, &connector->modes[i], max_dotclock) &&
-		    !igt_ultrajoiner_possible(&connector->modes[i], max_dotclock)) {
+		    !igt_ultrajoiner_possible(drm_fd, &connector->modes[i], max_dotclock)) {
 			*mode = connector->modes[i];
 			found = true;
 			break;
@@ -6478,20 +6487,6 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
 	return found;
 }
 
-/**
- * get_max_hdisplay:
- * @drm_fd: drm file descriptor
- *
- * Returns: The maximum hdisplay supported per pipe.
- */
-static int get_max_pipe_hdisplay(int drm_fd)
-{
-	int dev_id = intel_get_drm_devid(drm_fd);
-
-	return (intel_display_ver(dev_id) >= 30) ? HDISPLAY_6K_PER_PIPE :
-						   HDISPLAY_5K_PER_PIPE;
-}
-
 /**
  * max_non_joiner_mode_found:
  * @drm_fd: drm file descriptor
@@ -6567,9 +6562,9 @@ bool igt_is_joiner_enabled_for_pipe(int drmfd, enum pipe pipe)
  *
  * Returns: True if mode requires Ultrajoiner, else False.
  */
-bool igt_ultrajoiner_possible(drmModeModeInfo *mode, int max_dotclock)
+bool igt_ultrajoiner_possible(int drm_fd, drmModeModeInfo *mode, int max_dotclock)
 {
-	return (mode->hdisplay > 2 * HDISPLAY_5K_PER_PIPE ||
+	return (mode->hdisplay > 2 * get_max_pipe_hdisplay(drm_fd) ||
 		mode->clock > 2 * max_dotclock);
 }
 
@@ -6591,7 +6586,7 @@ bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
 	bool found = false;
 
 	for (int i = 0; i < connector->count_modes; i++) {
-		if (igt_ultrajoiner_possible(&connector->modes[i], max_dotclock)) {
+		if (igt_ultrajoiner_possible(drm_fd, &connector->modes[i], max_dotclock)) {
 			*mode = connector->modes[i];
 			found = true;
 			break;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 27b545f52..0381c82ad 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1252,7 +1252,7 @@ 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);
 bool igt_is_joiner_enabled_for_pipe(int drmfd, enum pipe pipe);
-bool igt_ultrajoiner_possible(drmModeModeInfo *mode, int max_dotclock);
+bool igt_ultrajoiner_possible(int drmfd, drmModeModeInfo *mode, int max_dotclock);
 bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
 			  int max_dotclock, drmModeModeInfo *mode);
 bool igt_has_force_joiner_debugfs(int drmfd, char *conn_name);
-- 
2.43.0


             reply	other threads:[~2025-03-19  6:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19  6:12 Karthik B S [this message]
2025-03-19  7:41 ` ✓ Xe.CI.BAT: success for lib/igt_kms: Use get_max_pipe_hdisplay in joiner_possible fucntions Patchwork
2025-03-19  7:53 ` ✗ i915.CI.BAT: failure " Patchwork
2025-03-26  4:47   ` Karthik B S
2025-03-19  8:22 ` ✗ Xe.CI.Full: " Patchwork
2025-03-19 17:59 ` [PATCH i-g-t] " B, Jeevan
2025-03-20  6:02   ` Karthik B S
2025-03-20  6:13     ` 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=20250319061244.769947-1-karthik.b.s@intel.com \
    --to=karthik.b.s@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@intel.com \
    --cc=santhosh.reddy.guddati@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