[PATCH i-g-t v2 1/4] lib/igt_kms: Add reflection name and mask

Louis Chauvet louis.chauvet at bootlin.com
Wed Mar 13 17:09:40 UTC 2024


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);
+	}
+}
+
 /**
  * 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);

-- 
2.43.0



More information about the igt-dev mailing list