[PATCH 10/12] compositor-drm: Deal with VT switch in clone mode

Xiong Zhang xiong.y.zhang at intel.com
Fri Mar 7 00:27:28 PST 2014


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

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index de777b3..58a0efa 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2376,7 +2376,7 @@ drm_destroy(struct weston_compositor *ec)
 static void
 drm_compositor_set_modes(struct drm_compositor *compositor)
 {
-	struct drm_output *output;
+	struct drm_output *output, *clone_output;
 
 	wl_list_for_each(output, &compositor->base.output_list, base.link) {
 		if (!output->current) {
@@ -2390,16 +2390,33 @@ drm_compositor_set_modes(struct drm_compositor *compositor)
 		}
 
 		drm_output_set_mode(output, output->current->fb_id);
+
+		/* Set mode for all associated clone outputs. */
+		wl_list_for_each(clone_output, &output->base.clone_output_list,
+				 base.link)
+			drm_output_set_mode(clone_output,
+					clone_output->current->fb_id);
 	}
 }
 
 static void
+drm_output_clear_cursor(struct drm_output *output)
+{
+	struct drm_compositor *ec =
+		(struct drm_compositor *)output->base.compositor;
+
+	output->base.repaint_needed = 0;
+	drmModeSetCursor(ec->drm.fd, output->crtc_id, 0, 0, 0);
+
+}
+
+static void
 session_notify(struct wl_listener *listener, void *data)
 {
 	struct weston_compositor *compositor = data;
 	struct drm_compositor *ec = data;
 	struct drm_sprite *sprite;
-	struct drm_output *output;
+	struct drm_output *output, *clone;
 
 	if (ec->base.session_active) {
 		weston_log("activating session\n");
@@ -2423,8 +2440,11 @@ session_notify(struct wl_listener *listener, void *data)
 		 * pending frame callbacks. */
 
 		wl_list_for_each(output, &ec->base.output_list, base.link) {
-			output->base.repaint_needed = 0;
-			drmModeSetCursor(ec->drm.fd, output->crtc_id, 0, 0, 0);
+			drm_output_clear_cursor(output);
+
+			wl_list_for_each(clone, &output->base.clone_output_list,
+					 base.link)
+				drm_output_clear_cursor(clone);
 		}
 
 		output = container_of(ec->base.output_list.next,
-- 
1.8.3.2



More information about the wayland-devel mailing list