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

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Tue Nov 14 15:05:55 UTC 2017


From: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>

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

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;
 
-- 
2.15.0



More information about the wayland-devel mailing list