[igt-dev] [RESEND, v3 2/5] lib: Export helpers to get rotation/tiling strings

Gwan-gyeong Mun gwan-gyeong.mun at intel.com
Thu Sep 6 07:23:57 UTC 2018


From: Imre Deak <imre.deak at intel.com>

This is needed for the next patch for some debug prints.

Signed-off-by: Imre Deak <imre.deak at intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 lib/igt_fb.c  | 23 +++++++++++++++++++++++
 lib/igt_fb.h  |  1 +
 lib/igt_kms.c | 11 +++++++++--
 lib/igt_kms.h |  1 +
 4 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..7ac60dd3 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2016,3 +2016,26 @@ bool igt_format_is_yuv(uint32_t drm_format)
 		return false;
 	}
 }
+
+/**
+ * igt_tiling_str:
+ * @tiling: tiling ID
+ *
+ * Returns:
+ * Human-readable tiling string for @tiling.
+ */
+const char *igt_tiling_str(uint64_t tiling)
+{
+	switch (tiling) {
+	case LOCAL_DRM_FORMAT_MOD_NONE:
+		return "linear";
+	case LOCAL_I915_FORMAT_MOD_X_TILED:
+		return "X-tiled";
+	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+		return "Y-tiled";
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+		return "Yf-tiled";
+	default:
+		return "N/A";
+	}
+}
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index d28bc0c4..1091d13e 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -168,6 +168,7 @@ uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
 const char *igt_format_str(uint32_t drm_format);
 bool igt_fb_supported_format(uint32_t drm_format);
 bool igt_format_is_yuv(uint32_t drm_format);
+const char *igt_tiling_str(uint64_t tiling);
 
 #endif /* __IGT_FB_H__ */
 
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 62d84684..8f5b647e 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3794,7 +3794,14 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
 	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H, IGT_FIXED(h, 0));
 }
 
-static const char *rotation_name(igt_rotation_t rotation)
+/**
+ * igt_rotation_degrees_str:
+ * @rotation: rotation degrees/reflect mask
+ *
+ * Returns:
+ * Human-readable string for the rotation degrees part in @rotation.
+ */
+const char *igt_rotation_degrees_str(igt_rotation_t rotation)
 {
 	switch (rotation & IGT_ROTATION_MASK) {
 	case IGT_ROTATION_0:
@@ -3826,7 +3833,7 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
 
 	LOG(display, "%s.%d: plane_set_rotation(%s)\n",
 	    kmstest_pipe_name(pipe->pipe),
-	    plane->index, rotation_name(rotation));
+	    plane->index, igt_rotation_degrees_str(rotation));
 
 	igt_plane_set_prop_value(plane, IGT_PLANE_ROTATION, rotation);
 }
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 3a12f278..fb62d8e3 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -410,6 +410,7 @@ void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd);
 void igt_plane_set_position(igt_plane_t *plane, int x, int y);
 void igt_plane_set_size(igt_plane_t *plane, int w, int h);
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
+const char *igt_rotation_degrees_str(igt_rotation_t rotation);
 void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
 	uint32_t x, uint32_t y);
 void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
-- 
2.18.0



More information about the igt-dev mailing list