[Intel-gfx] [PATCH i-g-t 01/12] lib: Dump information about the supported 3D stereo formats

Damien Lespiau damien.lespiau at intel.com
Fri Sep 6 21:08:39 CEST 2013


When dumping the details of a mode, let's add the 3D formats the mode
supports.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 lib/drmtest.c | 37 +++++++++++++++++++++++++++++++++++--
 lib/drmtest.h |  9 +++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 37a0e22..eca792c 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1587,10 +1587,42 @@ struct type_name connector_type_names[] = {
 
 type_name_fn(connector_type)
 
+#define DRM_MODE_FOR_EACH_3D_FLAG(func, sep) \
+		func(DRM_MODE_FLAG_3D_FRAME_PACKING) sep \
+	        func(DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE) sep \
+	        func(DRM_MODE_FLAG_3D_LINE_ALTERNATIVE) sep \
+	        func(DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL) sep \
+	        func(DRM_MODE_FLAG_3D_L_DEPTH) sep \
+	        func(DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH) sep \
+	        func(DRM_MODE_FLAG_3D_TOP_AND_BOTTOM) sep \
+	        func(DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF)
 
 void kmstest_dump_mode(drmModeModeInfo *mode)
 {
-	printf("  %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d\n",
+	bool stereo_3d = mode->flags & DRMTEST_MODE_FLAG_3D_MASK;
+	char flags_str[32];
+
+#define PRINT_S(name) "%s"
+#define SEP_EMPTY
+#define PRINT_FLAG(flag, str)	\
+	mode->flags & DRM_MODE_FLAG_3D_ ## flag ? " "str : ""
+
+	snprintf(flags_str, sizeof(flags_str), " (3D:"
+		 DRM_MODE_FOR_EACH_3D_FLAG(PRINT_S, SEP_EMPTY) ")",
+		 PRINT_FLAG(FRAME_PACKING, "FP"),
+		 PRINT_FLAG(FIELD_ALTERNATIVE, "FA"),
+		 PRINT_FLAG(LINE_ALTERNATIVE, "LA"),
+		 PRINT_FLAG(SIDE_BY_SIDE_FULL, "SBSF"),
+		 PRINT_FLAG(L_DEPTH, "LD"),
+		 PRINT_FLAG(L_DEPTH_GFX_GFX_DEPTH, "LDGFX"),
+		 PRINT_FLAG(TOP_AND_BOTTOM, "TB"),
+		 PRINT_FLAG(SIDE_BY_SIDE_HALF, "SBSH"));
+
+#undef PRINT_S
+#undef SEP_EMPTY
+#undef PRINT_FLAG
+
+	printf("  %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s\n",
 	       mode->name,
 	       mode->vrefresh,
 	       mode->hdisplay,
@@ -1603,7 +1635,8 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
 	       mode->vtotal,
 	       mode->flags,
 	       mode->type,
-	       mode->clock);
+	       mode->clock,
+	       stereo_3d ? flags_str : "");
 	fflush(stdout);
 }
 
diff --git a/lib/drmtest.h b/lib/drmtest.h
index f55825e..2a562f7 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -259,6 +259,15 @@ bool igt_run_in_simulation(void);
  */
 void igt_skip_on_simulation(void);
 
+#define DRMTEST_MODE_FLAG_3D_MASK   (DRM_MODE_FLAG_3D_FRAME_PACKING         | \
+				     DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE     | \
+				     DRM_MODE_FLAG_3D_LINE_ALTERNATIVE      | \
+				     DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL     | \
+				     DRM_MODE_FLAG_3D_L_DEPTH               | \
+				     DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH | \
+				     DRM_MODE_FLAG_3D_TOP_AND_BOTTOM        | \
+				     DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF)
+
 /* helpers based upon the libdrm buffer manager */
 void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
 void igt_trash_aperture(void);
-- 
1.8.3.1




More information about the Intel-gfx mailing list