All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH] lib/igt_kms: Add a helper function to check Bigjoiner support
@ 2022-05-02 14:51 Bhanuprakash Modem
  2022-05-02 16:21 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Bhanuprakash Modem @ 2022-05-02 14:51 UTC (permalink / raw)
  To: igt-dev, karthik.b.s, petri.latvala

Create a helper function to check that the system supports the
given crtc/connector mode(s).

Example: Pipe-D won't support Bigjoiner, hence we can't use the
connector modes greater than 5K on Pipe-D

To use this helper, each individual subtest needs to set the
@pipe to a specific @output by igt_output_set_pipe() and call
this helper to check the validity of the combo.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 lib/igt_kms.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  2 ++
 2 files changed, 68 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 7838ff28..e277193d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -5379,3 +5379,69 @@ int igt_get_dsc_debugfs_fd(int drmfd, drmModeConnector *connector)
 
 	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
 }
+
+/*
+ * igt_check_bigjoiner_support:
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Get all active pipes from connected outputs (i.e. pending_pipe != PIPE_NONE)
+ * and check those pipes supports the selected mode(s).
+ *
+ * Example: Pipe-D can't support mode > 5K
+ *
+ * Returns: true if a valid crtc/connector mode combo found, else false
+ */
+bool igt_check_bigjoiner_support(igt_display_t *display)
+{
+	uint8_t i, total_pipes = 0, active_pipes = 0;
+	enum pipe p;
+	struct {
+		enum pipe idx;
+		drmModeModeInfo *mode;
+	} pipes[IGT_MAX_PIPES];
+
+	/* Get total enabled pipes. */
+	for_each_pipe(display, p)
+		total_pipes++;
+
+	/*
+	 * Get list of active pipes those were set by igt_output_set_pipe()
+	 * just before calling this function.
+	 */
+	for (i = 0 ; i < display->n_outputs; i++) {
+		igt_output_t *output = &display->outputs[i];
+
+		if (output->pending_pipe == PIPE_NONE)
+			continue;
+
+		pipes[active_pipes].idx = output->pending_pipe;
+		pipes[active_pipes].mode = igt_output_get_mode(output);
+		active_pipes++;
+	}
+
+	if (active_pipes)
+		return true;
+
+	/*
+	 * if mode.hdisplay > 5120, then ignore
+	 *  - last crtc in single/multi-connector config
+	 *  - consecutive crtcs in multi-connector config
+	 *
+	 * in multi-connector config ignore if
+	 *  - previous crtc mode.hdisplay > 5120 and
+	 *  - current & previous crtcs are consecutive
+	 */
+	for (i = 0; i < active_pipes; i++) {
+		if (((pipes[i].mode->hdisplay > MAX_HDISPLAY_PER_PIPE) &&
+		     ((pipes[i].idx >= (total_pipes - 1)) ||
+		      ((i < (active_pipes - 1)) && (abs(pipes[i + 1].idx - pipes[i].idx) <= 1)))) ||
+		    ((i > 0) && (pipes[i - 1].mode->hdisplay > MAX_HDISPLAY_PER_PIPE) &&
+		     (abs(pipes[i].idx - pipes[i - 1].idx) <= 1))) {
+			igt_debug("CRTC/Connector is not possible with selected mode(s).\n");
+
+			return false;
+		}
+	}
+
+	return true;
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index e9ecd21e..8a14bb3c 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -109,6 +109,7 @@ const char *kmstest_connector_status_str(int status);
 const char *kmstest_connector_type_str(int type);
 
 void kmstest_dump_mode(drmModeModeInfo *mode);
+#define MAX_HDISPLAY_PER_PIPE 5120
 
 int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
 void kmstest_set_vt_graphics_mode(void);
@@ -947,5 +948,6 @@ int igt_force_dsc_enable(int drmfd, drmModeConnector *connector);
 int igt_force_dsc_enable_bpp(int drmfd, drmModeConnector *connector,
 				int bpp);
 int igt_get_dsc_debugfs_fd(int drmfd, drmModeConnector *connector);
+bool igt_check_bigjoiner_support(igt_display_t *display);
 
 #endif /* __IGT_KMS_H__ */
-- 
2.35.1

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

end of thread, other threads:[~2022-06-15  2:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 14:51 [igt-dev] [PATCH] lib/igt_kms: Add a helper function to check Bigjoiner support Bhanuprakash Modem
2022-05-02 16:21 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2022-05-02 20:59 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-05-12 20:05 ` [igt-dev] [PATCH] " Navare, Manasi
2022-05-13  2:38   ` Modem, Bhanuprakash
2022-06-07 22:38     ` Navare, Manasi
2022-06-08  7:22       ` Modem, Bhanuprakash
2022-06-08  7:21 ` [igt-dev] [V2] " Bhanuprakash Modem
2022-06-09  9:43   ` Karthik B S
2022-06-09 18:20     ` Navare, Manasi
2022-06-10 10:08   ` [igt-dev] [V3] " Bhanuprakash Modem
2022-06-13  9:01     ` Karthik B S
2022-06-08 10:10 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_kms: Add a helper function to check Bigjoiner support (rev2) Patchwork
2022-06-08 18:01 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-06-10 16:19 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_kms: Add a helper function to check Bigjoiner support (rev3) Patchwork
2022-06-14  8:50 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_kms: Add a helper function to check Bigjoiner support (rev4) Patchwork
2022-06-14 16:47 ` [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_kms: Add a helper function to check Bigjoiner support (rev3) Patchwork
2022-06-15  2:06 ` [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_kms: Add a helper function to check Bigjoiner support (rev4) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.