[igt-dev] [PATCH i-g-t v3 14/21] lib/igt_kms: Add helpers to count and iterate planes from output
Lyude Paul
lyude at redhat.com
Tue Jan 15 22:00:07 UTC 2019
Reviewed-by: Lyude Paul <lyude at redhat.com>
On Fri, 2019-01-11 at 10:05 +0100, Paul Kocialkowski wrote:
> With helpers to count and iterate among planes of a given type from the
> pipe in place, we can use them with the current pipe for the output to
> make it possible for tests to use them (the pipe struct is not currently
> easily exposed to tests and exposing it adds unnecessary complexity).
>
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
> ---
> lib/igt_kms.c | 36 ++++++++++++++++++++++++++++++++++++
> lib/igt_kms.h | 3 +++
> 2 files changed, 39 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e5c4ee72884a..f87c869fd3b7 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3718,6 +3718,42 @@ igt_plane_t *igt_output_get_plane_type(igt_output_t
> *output, int plane_type)
> return igt_pipe_get_plane_type(pipe, plane_type);
> }
>
> +/**
> + * igt_output_count_plane_type:
> + * @output: Target output
> + * @plane_type: Cursor, primary or an overlay plane
> + *
> + * Counts the number of planes of type @plane_type for the provided
> @output.
> + *
> + * Returns: The number of planes that match the requested plane type
> + */
> +int igt_output_count_plane_type(igt_output_t *output, int plane_type)
> +{
> + igt_pipe_t *pipe = igt_output_get_driving_pipe(output);
> + igt_assert(pipe);
> +
> + return igt_pipe_count_plane_type(pipe, plane_type);
> +}
> +
> +/**
> + * igt_output_get_plane_type_index:
> + * @output: Target output
> + * @plane_type: Cursor, primary or an overlay plane
> + * @index: the index of the plane among planes of the same type
> + *
> + * Get the @index th plane of type @plane_type for the provided @output.
> + *
> + * Returns: The @index th plane that matches the requested plane type
> + */
> +igt_plane_t *igt_output_get_plane_type_index(igt_output_t *output,
> + int plane_type, int index)
> +{
> + igt_pipe_t *pipe = igt_output_get_driving_pipe(output);
> + igt_assert(pipe);
> +
> + return igt_pipe_get_plane_type_index(pipe, plane_type, index);
> +}
> +
> /**
> * igt_plane_set_fb:
> * @plane: Plane
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 0f99535e2c6e..1cfce9647637 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -401,6 +401,9 @@ void igt_output_override_mode(igt_output_t *output,
> drmModeModeInfo *mode);
> void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
> igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx);
> igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int
> plane_type);
> +int igt_output_count_plane_type(igt_output_t *output, int plane_type);
> +igt_plane_t *igt_output_get_plane_type_index(igt_output_t *output,
> + int plane_type, int index);
> igt_output_t *igt_output_from_connector(igt_display_t *display,
> drmModeConnector *connector);
>
--
Cheers,
Lyude Paul
More information about the igt-dev
mailing list