lib: Dump information about the supported 3D stereo formats
authorDamien Lespiau <damien.lespiau@intel.com>
Wed, 12 Sep 2012 13:21:29 +0000 (14:21 +0100)
committerDamien Lespiau <damien.lespiau@intel.com>
Mon, 30 Sep 2013 17:04:21 +0000 (18:04 +0100)
When dumping the details of a mode, let's add the 3D formats the mode
supports.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
lib/drmtest.c
lib/drmtest.h

index 0bc1e86..7f89fd1 100644 (file)
@@ -1724,10 +1724,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,
@@ -1740,7 +1772,8 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
               mode->vtotal,
               mode->flags,
               mode->type,
-              mode->clock);
+              mode->clock,
+              stereo_3d ? flags_str : "");
        fflush(stdout);
 }
 
index cd706f0..35796ca 100644 (file)
@@ -288,6 +288,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);