[PATCH i-g-t v3 5/5] lib/igt_kms: Add function to get valid pipe for specific output

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Dec 19 20:15:35 UTC 2024


Hi Louis,
On 2024-11-22 at 16:19:08 +0100, Louis Chauvet wrote:
> Introduces a new function igt_get_pipe_for_output in igt_kms. The function
> is designed to retrieve a valid pipe for a specific output in a display.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
> ---
>  lib/igt_kms.c | 19 +++++++++++++++++++
>  lib/igt_kms.h |  1 +
>  2 files changed, 20 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 5c242a5bdec619d181c3d0d632f1ea7d94d34743..ef783f9d3aaca9e0a65156a78c0657d2c3316bcc 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -7420,3 +7420,22 @@ uint32_t igt_get_connector_id_from_mst_path(int drm_fd, const void *mst_path)
>  	drmModeFreeResources(res);
>  	return 0;
>  }
> +
> +/**
> + * igt_get_pipe_for_output - Get a valid pipe for a specific output
> + * @display: display to fetch the pipes
> + * @output: output to use

Document return value, write also about PIPE_NONE.

> + */
> +enum pipe igt_get_pipe_for_output(igt_display_t *display,
> +				  igt_output_t *output)
> +{
> +	enum pipe pipe;
> +
> +	for_each_pipe(display, pipe) {
> +		if ((igt_output_is_connected((output)) &&
> +		     (output->config.valid_crtc_idx_mask & (1 << (pipe)))))

if (igt_output_is_connected(output) &&
    (output->config.valid_crtc_idx_mask & (1 << (pipe))))

With above corrected
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> +			return pipe;
> +	}
> +
> +	return PIPE_NONE;
> +}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index d61ddcaa0a25f1f9bc34eff7314eaa49a3de9cc2..3cf6669bcc56b4c24644091c72140ed7760ac198 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1281,5 +1281,6 @@ int igt_get_connected_connectors(int drm_fd, uint32_t **connector_ids);
>  drmModeConnectorPtr igt_get_connector_from_name(int drm_fd, const char *port_name);
>  uint32_t igt_get_connector_id_from_name(int drm_fd, const char *port_name);
>  uint32_t igt_get_connector_id_from_mst_path(int drm_fd, const void *mst_path);
> +enum pipe igt_get_pipe_for_output(igt_display_t *display, igt_output_t *output);
>  
>  #endif /* __IGT_KMS_H__ */
> 
> -- 
> 2.47.0
> 


More information about the igt-dev mailing list