[PATCH 5/9] deal with VT switch in clone mode

Xiong Zhang xiong.y.zhang at intel.com
Tue Sep 17 20:51:00 PDT 2013


clone output should use primary output's fb to restore mode

Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
---
 src/compositor-drm.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 0b9ab45..a9d2ab5 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2476,9 +2476,14 @@ drm_compositor_set_modes(struct drm_compositor *compositor)
 	struct drm_output *output;
 	struct drm_mode *drm_mode;
 	int ret;
+	uint32_t fb_id;
+	struct drm_output *primary_output;
 
 	wl_list_for_each(output, &compositor->base.output_list, base.link) {
-		if (!output->current) {
+		/* only in extend mode or primary output in clone mode */
+		if (((compositor->base.multiscreen_mode == WESTON_MULTISCREEN_EXTEND) ||
+			(&output->base == compositor->base.primary_output)) &&
+			 (!output->current)) {
 			/* If something that would cause the output to
 			 * switch mode happened while in another vt, we
 			 * might not have a current drm_fb. In that case,
@@ -2489,8 +2494,15 @@ drm_compositor_set_modes(struct drm_compositor *compositor)
 		}
 
 		drm_mode = (struct drm_mode *) output->base.current;
+		if ((compositor->base.multiscreen_mode == WESTON_MULTISCREEN_EXTEND) ||
+			(&output->base == compositor->base.primary_output))
+			fb_id = output->current->fb_id;
+		else {
+			primary_output = (struct drm_output *)compositor->base.primary_output;
+			fb_id = primary_output->current->fb_id;
+		}
 		ret = drmModeSetCrtc(compositor->drm.fd, output->crtc_id,
-				     output->current->fb_id, 0, 0,
+				     fb_id, 0, 0,
 				     &output->connector_id, 1,
 				     &drm_mode->mode_info);
 		if (ret < 0) {
-- 
1.8.3.2



More information about the wayland-devel mailing list