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.
dev
Kristian Høgsberg 13 years ago
parent 54f14c3c3e
commit 835cd49772
  1. 23
      src/compositor-drm.c

@ -788,6 +788,28 @@ drm_destroy(struct weston_compositor *ec)
free(d); 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 static void
vt_func(struct weston_compositor *compositor, int event) 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); wl_display_terminate(compositor->wl_display);
} }
compositor->state = ec->prev_state; compositor->state = ec->prev_state;
drm_compositor_set_modes(ec);
weston_compositor_damage_all(compositor); weston_compositor_damage_all(compositor);
wl_list_for_each(input, &compositor->input_device_list, link) wl_list_for_each(input, &compositor->input_device_list, link)
evdev_add_devices(ec->udev, input); evdev_add_devices(ec->udev, input);

Loading…
Cancel
Save