RE: [PATCH i-g-t 5/7] tests/intel/kms_joiner_helper: Move max_non_joiner_mode_found

Kandpal, Suraj
2026-04-02T05:24:11Z

> Subject: [PATCH i-g-t 5/7] tests/intel/kms_joiner_helper: Move
> max_non_joiner_mode_found
>
> max_non_joiner_mode_found() is Intel-specific since it relies on
> igt_bigjoiner_possible() which checks Intel platform pipe limits.
> Move it out of the generic lib/igt_kms.[ch] into the Intel-specific
> tests/intel/kms_joiner_helper.[ch] where it belongs.
>
> v2: Move the function out from lib/igt_kms.[ch] (Jani)
>
> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
> ---
> lib/igt_kms.c | 36 ---------------------------------
> lib/igt_kms.h | 2 --
> tests/intel/kms_joiner_helper.c | 36
> +++++++++++++++++++++++++++++++++ tests/intel/kms_joiner_helper.h | 2
> ++
> 4 files changed, 38 insertions(+), 38 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 323446780..afea8598b 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6965,42 +6965,6 @@ bool bigjoiner_mode_found(int drm_fd,
> drmModeConnector *connector,
> return found;
> }
>
> -/**
> - * max_non_joiner_mode_found:
> - * @drm_fd: drm file descriptor
> - * @connector: libdrm connector
> - * @max_dot_clock: max dot clock frequency
> - * @mode: libdrm mode to be filled
> - *
> - * Finds the highest possible display mode that does
> - * not require a big joiner.
> - *
> - * Returns: True if a valid non-joiner mode is found,
> - * false otherwise.
> - */
> -bool max_non_joiner_mode_found(int drm_fd, drmModeConnector
> *connector,
> - int max_dotclock, drmModeModeInfo *mode)
> -{
> - bool found = false;
> -
> - for (int i = 0; i < connector->count_modes; i++) {
> - drmModeModeInfo *current_mode = &connector->modes[i];
> -
> - if (igt_bigjoiner_possible(drm_fd, current_mode,
> max_dotclock))
> - continue;
> -
> - if (!found ||
> - current_mode->hdisplay > mode->hdisplay ||
> - (current_mode->hdisplay == mode->hdisplay &&
> - current_mode->clock > mode->clock)) {
> - *mode = *current_mode;
> - found = true;
> - }
> - }
> -
> - return found;
> -}
> -
> /* TODO: Move these lib functions to the joiner-specific library file
> * once those patches are merged.
> */
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h index a9f02a10a..2ada64fc8 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1242,8 +1242,6 @@ int igt_get_current_cdclk(int fd); bool
> igt_bigjoiner_possible(int drm_fd, drmModeModeInfo *mode, int
> max_dotclock); bool bigjoiner_mode_found(int drm_fd, drmModeConnector
> *connector,
> int max_dotclock, drmModeModeInfo *mode); -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(int drmfd, drmModeModeInfo *mode, int
> max_dotclock); bool ultrajoiner_mode_found(int drm_fd, drmModeConnector
> *connector, diff --git a/tests/intel/kms_joiner_helper.c
> b/tests/intel/kms_joiner_helper.c index e24d7ce94..ac1bef2e3 100644
> --- a/tests/intel/kms_joiner_helper.c
> +++ b/tests/intel/kms_joiner_helper.c
> @@ -183,3 +183,39 @@ bool igt_assign_pipes_for_outputs(int drm_fd,
> }
> return true;
> }
> +
> +/**
> + * max_non_joiner_mode_found:
> + * @drm_fd: drm file descriptor
> + * @connector: libdrm connector
> + * @max_dot_clock: max dot clock frequency
> + * @mode: libdrm mode to be filled
> + *
> + * Finds the highest possible display mode that does
> + * not require a big joiner.
> + *
> + * Returns: True if a valid non-joiner mode is found,
> + * false otherwise.
> + */
> +bool max_non_joiner_mode_found(int drm_fd, drmModeConnector
> *connector,

This can now be renamed with intel_ prefix now

According to me do this change first then change done in patch 3

Regards,
Suraj Kandpal

> + int max_dotclock, drmModeModeInfo *mode) {
> + bool found = false;
> +
> + for (int i = 0; i < connector->count_modes; i++) {
> + drmModeModeInfo *current_mode = &connector->modes[i];
> +
> + if (igt_bigjoiner_possible(drm_fd, current_mode,
> max_dotclock))
> + continue;
> +
> + if (!found ||
> + current_mode->hdisplay > mode->hdisplay ||
> + (current_mode->hdisplay == mode->hdisplay &&
> + current_mode->clock > mode->clock)) {
> + *mode = *current_mode;
> + found = true;
> + }
> + }
> +
> + return found;
> +}
> diff --git a/tests/intel/kms_joiner_helper.h b/tests/intel/kms_joiner_helper.h
> index 6d21e7eb0..3fef18f67 100644
> --- a/tests/intel/kms_joiner_helper.h
> +++ b/tests/intel/kms_joiner_helper.h
> @@ -17,6 +17,8 @@ bool igt_assign_pipes_for_outputs(int drm_fd,
> uint32_t *used_pipes_mask,
> uint32_t master_pipes_mask,
> uint32_t valid_pipes_mask);
> +bool max_non_joiner_mode_found(int drm_fd, drmModeConnector
> *connector,
> + int max_dotclock, drmModeModeInfo *mode);
>
> enum force_joiner_mode {
> FORCE_JOINER_ENABLE = 0,
> --
> 2.25.1