[weston,08/13] compositor-drm: Print stereo modes as such.

Submitted by Emmanuel Gil Peyrot on Nov. 14, 2017, 3:05 p.m.

Details

Message ID 20171114150600.1763-9-linkmauve@linkmauve.fr
State New
Headers show
Series "Add stereoscopy support" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Emmanuel Gil Peyrot Nov. 14, 2017, 3:05 p.m.
From: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
---
 libweston/compositor-drm.c | 38 +++++++++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index d3480f08..c0f1ebee 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3156,6 +3156,34 @@  drm_output_set_seat(struct weston_output *base,
 				     seat ? seat : "");
 }
 
+static const char *
+format_stereo_flag(uint32_t flag)
+{
+	switch (flag) {
+	case DRM_MODE_FLAG_3D_NONE:
+		return "";
+	case DRM_MODE_FLAG_3D_FRAME_PACKING:
+		return ", stereo (frame packing)";
+	case DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE:
+		return ", stereo (field alternative)";
+	case DRM_MODE_FLAG_3D_LINE_ALTERNATIVE:
+		return ", stereo (line alternative)";
+	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL:
+		return ", stereo (side-by-side full)";
+	case DRM_MODE_FLAG_3D_L_DEPTH:
+		return ", stereo (L + depth)";
+	case DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH:
+		return ", stereo (L + depth + GFX + GFX-depth)";
+	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
+		return ", stereo (top-and-bottom)";
+	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
+		return ", stereo (side-by-side half)";
+	default:
+		/* There should never be multiple 3D flags per mode. */
+		assert(0);
+	}
+}
+
 static int
 drm_output_enable(struct weston_output *base)
 {
@@ -3204,15 +3232,19 @@  drm_output_enable(struct weston_output *base)
 
 	weston_log("Output %s, (connector %d, crtc %d)\n",
 		   output->base.name, output->connector_id, output->crtc_id);
-	wl_list_for_each(m, &output->base.mode_list, link)
-		weston_log_continue(STAMP_SPACE "mode %dx%d@%.1f%s%s%s\n",
+	wl_list_for_each(m, &output->base.mode_list, link) {
+		struct drm_mode *mode = (struct drm_mode*)m;
+		weston_log_continue(STAMP_SPACE "mode %dx%d@%.1f%s%s%s%s\n",
 				    m->width, m->height, m->refresh / 1000.0,
 				    m->flags & WL_OUTPUT_MODE_PREFERRED ?
 				    ", preferred" : "",
 				    m->flags & WL_OUTPUT_MODE_CURRENT ?
 				    ", current" : "",
 				    output->connector->count_modes == 0 ?
-				    ", built-in" : "");
+				    ", built-in" : "",
+				    format_stereo_flag(mode->mode_info.flags
+				                       & DRM_MODE_FLAG_3D_MASK));
+	}
 
 	output->state_invalid = true;