Igt-dev Archive on lore.kernel.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>,
	Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>,
	Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
	Karthik B S <karthik.b.s@intel.com>,
	Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Subject: [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib
Date: Sun, 10 Mar 2024 19:57:18 +0530	[thread overview]
Message-ID: <20240310142721.874315-2-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20240310142721.874315-1-kunal1.joshi@intel.com>

move bigjoiner_mode_found to lib

Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 lib/igt_kms.c                | 25 +++++++++++++++++++++++++
 lib/igt_kms.h                |  2 ++
 tests/intel/kms_big_joiner.c | 14 +-------------
 3 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e18f6fe59..63c8045c7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6143,6 +6143,31 @@ bool igt_bigjoiner_possible(drmModeModeInfo *mode, int max_dotclock)
 		mode->clock > max_dotclock);
 }
 
+/**
+ * bigjoiner_mode_found:
+ * @connector: libdrm connector
+ * @sort_method: comparator method
+ * @mode: libdrm mode
+ *
+ * Bigjoiner will come in to the picture when the
+ * resolution > 5K or clock > max-dot-clock.
+ *
+ * Returns: True if big joiner found in connector modes
+ */
+bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
+			  int max_dotclock)
+{
+	bool found = false;
+
+	igt_sort_connector_modes(connector, sort_drm_modes_by_res_dsc);
+	found = igt_bigjoiner_possible(&connector->modes[0], max_dotclock);
+	if (!found) {
+		igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
+		found = igt_bigjoiner_possible(&connector->modes[0], max_dotclock);
+	}
+	return found;
+}
+
 /**
  * igt_check_bigjoiner_support:
  * @display: a pointer to an #igt_display_t structure
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b3882808b..bab8487d3 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1212,6 +1212,8 @@ bool igt_max_bpc_constraint(igt_display_t *display, enum pipe pipe,
 		igt_output_t *output, int bpc);
 int igt_get_max_dotclock(int fd);
 bool igt_bigjoiner_possible(drmModeModeInfo *mode, int max_dotclock);
+bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
+			  int max_dotclock);
 bool igt_check_bigjoiner_support(igt_display_t *display);
 bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
 bool intel_pipe_output_combo_valid(igt_display_t *display);
diff --git a/tests/intel/kms_big_joiner.c b/tests/intel/kms_big_joiner.c
index aba2adfbe..28678b958 100644
--- a/tests/intel/kms_big_joiner.c
+++ b/tests/intel/kms_big_joiner.c
@@ -199,16 +199,6 @@ static void test_dual_display(data_t *data)
 	igt_display_commit2(display, COMMIT_ATOMIC);
 }
 
-static bool bigjoiner_mode_found(drmModeConnector *connector,
-				 int (*sort_method)(const void *, const void*),
-				 drmModeModeInfo *mode)
-{
-	igt_sort_connector_modes(connector, sort_method);
-	*mode = connector->modes[0];
-
-	return igt_bigjoiner_possible(mode, max_dotclock);
-}
-
 igt_main
 {
 	data_t data;
@@ -235,9 +225,7 @@ igt_main
 			 * Bigjoiner will come in to the picture when the
 			 * resolution > 5K or clock > max-dot-clock.
 			 */
-			found = (bigjoiner_mode_found(connector, sort_drm_modes_by_res_dsc, &mode) ||
-				 bigjoiner_mode_found(connector, sort_drm_modes_by_clk_dsc, &mode)) ?
-					true : false;
+			found = bigjoiner_mode_found(data.drm_fd, connector, max_dotclock);
 
 			if (found) {
 				data.output[count].output_id = output->id;
-- 
2.34.1


  reply	other threads:[~2024-03-10 14:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 14:27 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-10 14:27 ` Kunal Joshi [this message]
2024-03-15  4:10   ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Nautiyal, Ankit K
2024-03-18  5:38     ` Joshi, Kunal1
2024-03-20 12:29       ` Nautiyal, Ankit K
2024-03-10 14:27 ` [PATCH i-g-t 2/4] tests/intel/kms_big_joiner: revamp bigjoiner Kunal Joshi
2024-03-14  8:43   ` Nautiyal, Ankit K
2024-03-18  5:26     ` Joshi, Kunal1
2024-03-10 14:27 ` [PATCH i-g-t 3/4] lib/igt_kms: add helper to enable/disable force joiner Kunal Joshi
2024-03-20 12:53   ` Nautiyal, Ankit K
2024-03-20 13:21     ` Nautiyal, Ankit K
2024-03-10 14:27 ` [PATCH i-g-t 4/4] tests/intel/kms_big_joiner: add tests for " Kunal Joshi
2024-03-20 13:17   ` Nautiyal, Ankit K
2024-03-10 14:48 ` ✓ CI.xeBAT: success for revamp big joiner test (rev7) Patchwork
2024-03-10 14:56 ` ✓ Fi.CI.BAT: " Patchwork
2024-03-10 16:26 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-03-28  8:39 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-28  8:39 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi
2024-03-25 16:51 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-25 16:51 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi
2024-03-21 18:28 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-21 18:28 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi
2024-03-25  9:57   ` Nautiyal, Ankit K
2024-03-03 17:22 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-03 17:22 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi
2024-03-01  8:25 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-01  8:25 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi
2024-02-29 18:10 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-02-29 18:10 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi

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=20240310142721.874315-2-kunal1.joshi@intel.com \
    --to=kunal1.joshi@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    --cc=stanislav.lisovskiy@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