diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-01-18 11:48:46 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-01-18 11:48:46 -0500 |
commit | 835cd497723d92cc4db80e934e5fc21698434ff5 (patch) | |
tree | af0132abca819cb8733af6422e487622bc2e3421 | |
parent | 54f14c3c3ebc28f4fe5249474b3ae7edd47ea066 (diff) |
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.
-rw-r--r-- | src/compositor-drm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/compositor-drm.c b/src/compositor-drm.c index b5914a4..90013d8 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -789,6 +789,28 @@ drm_destroy(struct weston_compositor *ec) } 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) { struct drm_compositor *ec = (struct drm_compositor *) compositor; @@ -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); |