[PATCH i-g-t v2 1/2] lib/igt_kms: Add helper to get non-joiner mode

Pranay Samala
2026-03-04T08:07:10Z

Add igt_get_non_joiner_mode() helper function to find a suitable
display mode from an output that does not require Big Joiner or
Ultra Joiner support. This is useful for tests that want to avoid
joiner modes and use a single pipe configuration.

The function returns a pointer to the mode if found, or NULL if
all modes require joiner support.

v2:
- Rebase

Signed-off-by: Pranay Samala <pranay.samala@intel.com>
Reviewed-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
---
lib/igt_kms.c | 31 +++++++++++++++++++++++++++++++
lib/igt_kms.h | 1 +
2 files changed, 32 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 6087de365..e4a7e1ffa 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6994,6 +6994,37 @@ bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
return found;
}

+/**
+ * igt_get_non_joiner_mode:
+ * @drm_fd: drm file descriptor
+ * @output: pointer to the output structure
+ *
+ * Finds the display mode from the output that does not require
+ * Big Joiner or Ultra Joiner.
+ *
+ * Returns: Pointer to non-joiner mode, or NULL if not found.
+ */
+drmModeModeInfo *igt_get_non_joiner_mode(int drm_fd, igt_output_t *output)
+{
+ drmModeConnector *connector;
+ int max_dotclock;
+
+ connector = output->config.connector;
+ max_dotclock = igt_get_max_dotclock(drm_fd);
+
+ for (int i = 0; i < connector->count_modes; i++) {
+ drmModeModeInfo *current_mode = &connector->modes[i];
+
+ /* Check if mode requires joiner */
+ if (!igt_bigjoiner_possible(drm_fd, current_mode, max_dotclock) &&
+ !igt_ultrajoiner_possible(drm_fd, current_mode, max_dotclock)) {
+ return current_mode;
+ }
+ }
+
+ return NULL;
+}
+
/**
* is_joiner_mode:
* @drm_fd: drm file descriptor
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 1e1f3ead5..f39042cd5 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1262,6 +1262,7 @@ 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);
+drmModeModeInfo *igt_get_non_joiner_mode(int drm_fd, igt_output_t *output);
bool is_joiner_mode(int drm_fd, igt_output_t *output);
bool igt_check_force_joiner_status(int drmfd, char *connector_name);
bool igt_check_bigjoiner_support(igt_display_t *display);
--
2.34.1