From 835cd497723d92cc4db80e934e5fc21698434ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 18 Jan 2012 11:48:46 -0500 Subject: [PATCH] drm: Reset kms mode on vt enter Normally the repaint will trigger a pageflip, which flips back to our fb, but that doesn't work if the kms output has been turned off or set to a different mode. --- src/compositor-drm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index b5914a4a..90013d85 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -788,6 +788,28 @@ drm_destroy(struct weston_compositor *ec) free(d); } +static void +drm_compositor_set_modes(struct drm_compositor *compositor) +{ + struct drm_output *output; + struct drm_mode *drm_mode; + int ret; + + wl_list_for_each(output, &compositor->base.output_list, base.link) { + drm_mode = (struct drm_mode *) output->base.current; + ret = drmModeSetCrtc(compositor->drm.fd, output->crtc_id, + output->fb_id[output->current ^ 1], 0, 0, + &output->connector_id, 1, + &drm_mode->mode_info); + if (ret < 0) { + fprintf(stderr, + "failed to set mode %dx%d for output at %d,%d: %m", + drm_mode->base.width, drm_mode->base.height, + output->base.x, output->base.y); + } + } +} + static void vt_func(struct weston_compositor *compositor, int event) { @@ -803,6 +825,7 @@ vt_func(struct weston_compositor *compositor, int event) wl_display_terminate(compositor->wl_display); } compositor->state = ec->prev_state; + drm_compositor_set_modes(ec); weston_compositor_damage_all(compositor); wl_list_for_each(input, &compositor->input_device_list, link) evdev_add_devices(ec->udev, input);