[PATCH i-g-t v2 5/5] lib/igt_kms: Add function to get valid pipe for specific output
Louis Chauvet
louis.chauvet at bootlin.com
Fri Nov 8 15:23:38 UTC 2024
On 06/11/24 - 15:28, Kamil Konieczny wrote:
> Hi Louis,
> On 2024-10-22 at 12:28:39 +0200, 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 fce5666cefc6..82d63d6e6229 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -7332,3 +7332,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
> > + */
> > +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)))))
> > + return pipe;
> > + }
> > +
> > + igt_assert_f(false, "No pipe found for output %s\n", igt_output_name(output));
>
> Please try to not assert in lib function.
I will change it to `return PIPE_NONE;` for v2
> Regards,
> Kamil
>
> > +}
> > diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> > index e9732c247dea..e0d968b52033 100644
> > --- a/lib/igt_kms.h
> > +++ b/lib/igt_kms.h
> > @@ -1269,5 +1269,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.46.2
> >
More information about the igt-dev
mailing list