uterm: video: fbdev: fix setting current-mode on activation

We must not recreate a video-mode if we re-activate an fbdev display after
wake-up. Otherwise, the "current" pointer changes and users might get
confused. We guarantee that the "current" pointer stays the same during
operation as we currently do not support changing display size without
reactiating the display.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-10-15 14:25:59 +02:00
parent c1256560d1
commit acba8f0177

View File

@ -274,14 +274,16 @@ static int display_activate_force(struct uterm_display *disp,
/* TODO: make dithering configurable */
disp->flags |= DISPLAY_DITHERING;
ret = mode_new(&disp->modes, &fbdev_mode_ops);
if (ret) {
munmap(disp->fbdev.map, disp->fbdev.len);
return ret;
if (!disp->current_mode) {
ret = mode_new(&disp->modes, &fbdev_mode_ops);
if (ret) {
munmap(disp->fbdev.map, disp->fbdev.len);
return ret;
}
disp->modes->fbdev.width = disp->fbdev.xres;
disp->modes->fbdev.height = disp->fbdev.yres;
disp->current_mode = disp->modes;
}
disp->modes->fbdev.width = disp->fbdev.xres;
disp->modes->fbdev.height = disp->fbdev.yres;
disp->current_mode = disp->modes;
disp->flags |= DISPLAY_ONLINE;
return 0;
@ -298,7 +300,9 @@ static void display_deactivate_force(struct uterm_display *disp, bool force)
return;
log_info("deactivating device %s", disp->fbdev.node);
uterm_mode_unref(disp->modes);
if (!force)
uterm_mode_unref(disp->current_mode);
disp->modes = NULL;
disp->current_mode = NULL;
munmap(disp->fbdev.map, disp->fbdev.len);