[PATCH i-g-t v2 1/4] lib/igt_kms: Add reflection name and mask
Arthur Grillo
arthurgrillo at riseup.net
Wed Mar 13 20:00:11 UTC 2024
On 13/03/24 14:09, Louis Chauvet wrote:
> As for IGT_ROTATION_MASK and igt_plane_rotation_name, create the mask
> IGT_REFLECT_MASK and the function igt_plane_reflect_name.
>
> Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
> ---
> lib/igt_kms.c | 23 +++++++++++++++++++++++
> lib/igt_kms.h | 3 +++
> 2 files changed, 26 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e18f6fe59882..85d278f3cae3 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5142,6 +5142,29 @@ const char *igt_plane_rotation_name(igt_rotation_t rotation)
> }
> }
>
> +
> +/**
> + * igt_plane_reflect_name:
> + * @reflect: Plane reflection value (x, y)
> + *
> + * Returns: Plane reflection value as a string
> + */
> +const char *igt_plane_reflect_name(igt_rotation_t reflect)
> +{
> + switch (reflect & IGT_REFLECT_MASK) {
> + case 0:
> + return "none";
> + case IGT_REFLECT_X:
> + return "X";
> + case IGT_REFLECT_Y:
> + return "Y";
> + case IGT_REFLECT_X | IGT_REFLECT_Y:
> + return "XY";
> + default:
> + igt_assert(0);
> + }
> +}
I think it would be good to call this on igt_plane_set_rotation(), like
igt_plane_rotation_name() is, for debug purposes.
Best Regards,
~Arthur Grillo
> +
> /**
> * igt_plane_set_rotation:
> * @plane: Plane pointer for which rotation is to be set
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index b3882808b42f..4760394428f3 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -371,6 +371,8 @@ typedef enum {
>
> #define IGT_ROTATION_MASK \
> (IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
> +#define IGT_REFLECT_MASK \
> + (IGT_REFLECT_X | IGT_REFLECT_Y)
>
> /**
> * igt_rotation_90_or_270:
> @@ -562,6 +564,7 @@ static inline bool igt_plane_has_rotation(igt_plane_t *plane, igt_rotation_t rot
> return (plane->rotations & rotation) == rotation;
> }
> const char *igt_plane_rotation_name(igt_rotation_t rotation);
> +const char *igt_plane_reflect_name(igt_rotation_t reflect);
>
> void igt_wait_for_vblank(int drm_fd, int crtc_offset);
> void igt_wait_for_vblank_count(int drm_fd, int crtc_offset, int count);
>
More information about the igt-dev
mailing list