[PATCH 3/9] compositor-drm: Deal with VT switch in clone mode
Xiong Zhang
xiong.y.zhang at intel.com
Thu Feb 13 23:17:38 PST 2014
When system do VT switch, slave output should use master
output's fb to restore mode.
Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
---
src/compositor-drm.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index ce85aec..1d8c983 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2608,6 +2608,7 @@ drm_compositor_set_modes(struct drm_compositor *compositor)
struct drm_output *output;
struct drm_mode *drm_mode;
int ret;
+ struct drm_output *clone_output;
wl_list_for_each(output, &compositor->base.output_list, base.link) {
if (!output->current) {
@@ -2628,9 +2629,33 @@ drm_compositor_set_modes(struct drm_compositor *compositor)
if (ret < 0) {
weston_log(
"failed to set mode %dx%d for output at %d,%d: %m\n",
- drm_mode->base.width, drm_mode->base.height,
+ drm_mode->base.width, drm_mode->base.height,
output->base.x, output->base.y);
}
+
+ if (!output->base.is_slave) {
+ wl_list_for_each(clone_output,
+ &output->base.clone_output_list,
+ base.link) {
+ drm_mode = (struct drm_mode *)
+ clone_output->base.current_mode;
+ ret = drmModeSetCrtc(compositor->drm.fd,
+ clone_output->crtc_id,
+ output->current->fb_id,
+ 0, 0,
+ &clone_output->connector_id,
+ 1,
+ &drm_mode->mode_info);
+ if (ret < 0) {
+ weston_log("failed to set mode %dx%d
+ for output at %d,%d: %m\n",
+ drm_mode->base.width,
+ drm_mode->base.height,
+ clone_output->base.x,
+ clone_output->base.y);
+ }
+ }
+ }
}
}
@@ -2641,6 +2666,7 @@ session_notify(struct wl_listener *listener, void *data)
struct drm_compositor *ec = data;
struct drm_sprite *sprite;
struct drm_output *output;
+ struct drm_output *clone_output;
if (ec->base.session_active) {
weston_log("activating session\n");
@@ -2666,6 +2692,16 @@ session_notify(struct wl_listener *listener, void *data)
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);
+
+ if (!output->base.is_slave) {
+ wl_list_for_each(clone_output,
+ &output->base.clone_output_list,
+ base.link) {
+ drmModeSetCursor(ec->drm.fd,
+ clone_output->crtc_id,
+ 0, 0, 0);
+ }
+ }
}
output = container_of(ec->base.output_list.next,
--
1.8.3.2
More information about the wayland-devel
mailing list