[PATCH i-g-t 2/3] lib/igt_kms: Add support to check joiner mode limit

Karthik B S karthik.b.s at intel.com
Wed Feb 12 10:46:42 UTC 2025


Hi,

On 2/12/2025 1:06 PM, Jeevan B wrote:
> Added library changes to find the highest non-joiner mode.
> This helps to get the mode that does not require a big joiner.
The second sentence seems redundant and could be removed. Also please 
fix the commit subject.
>
> v2: Update commit message, create a new library function
>      to get max hdisplay and fix condtion for selecting mode.
> v3: Update function name.
>
> Signed-off-by: Jeevan B <jeevan.b at intel.com>
> ---
>   lib/igt_kms.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>   lib/igt_kms.h |  2 ++
>   2 files changed, 47 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 3caba7d77..e1a74a3ee 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6406,6 +6406,51 @@ 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_hdisplay(int drm_fd)

'get_max_hdisplay' -> 'get_max_pipe_hdisplay'

With these minor fixes,

Reviewed-by: Karthik B S <karthik.b.s at intel.com>

> +{
> +	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
> + * @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)
> +{
> +	int max_hdisplay = get_max_hdisplay(drm_fd);
> +
> +	for (int i = 0; i < connector->count_modes; i++) {
> +		drmModeModeInfo *current_mode = &connector->modes[i];
> +
> +		if (current_mode->hdisplay == max_hdisplay &&
> +		    current_mode->clock < max_dotclock) {
> +			*mode = *current_mode;
> +			return true;
> +		}
> +	}
> +
> +	return false;
> +}
> +
>   /**
>    * igt_is_joiner_enabled_for_pipe:
>    * @drmfd: A drm file descriptor
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 1cfacf87d..7227f0b0e 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1245,6 +1245,8 @@ int igt_get_max_dotclock(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(drmModeModeInfo *mode, int max_dotclock);
>   bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,


More information about the igt-dev mailing list