[PATCH] fbdev: Add fbset -a support
authorAntonino A. Daplas <adaplas@gmail.com>
Fri, 9 Sep 2005 20:04:29 +0000 (13:04 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 9 Sep 2005 20:57:58 +0000 (13:57 -0700)
Add capability to fbdev to listen to the FB_ACTIVATE_ALL flag.  If set, it
notifies fbcon that all consoles must be set to the current var.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/console/fbcon.c
drivers/video/fbmem.c
include/linux/fb.h

index 35c88bd7ba5e43d16bb49c08bb76ad5ddd43541d..751890a5f5f35a5cf7ffe43eb078708fae49cf51 100644 (file)
@@ -2593,6 +2593,51 @@ static void fbcon_modechanged(struct fb_info *info)
        }
 }
 
+static void fbcon_set_all_vcs(struct fb_info *info)
+{
+       struct fbcon_ops *ops = info->fbcon_par;
+       struct vc_data *vc;
+       struct display *p;
+       int i, rows, cols;
+
+       if (!ops || ops->currcon < 0)
+               return;
+
+       for (i = 0; i < MAX_NR_CONSOLES; i++) {
+               vc = vc_cons[i].d;
+               if (!vc || vc->vc_mode != KD_TEXT ||
+                   registered_fb[con2fb_map[i]] != info)
+                       continue;
+
+               p = &fb_display[vc->vc_num];
+
+               info->var.xoffset = info->var.yoffset = p->yscroll = 0;
+               var_to_display(p, &info->var, info);
+               cols = info->var.xres / vc->vc_font.width;
+               rows = info->var.yres / vc->vc_font.height;
+               vc_resize(vc, cols, rows);
+
+               if (CON_IS_VISIBLE(vc)) {
+                       updatescrollmode(p, info, vc);
+                       scrollback_max = 0;
+                       scrollback_current = 0;
+                       update_var(vc->vc_num, info);
+                       fbcon_set_palette(vc, color_table);
+                       update_screen(vc);
+                       if (softback_buf) {
+                               int l = fbcon_softback_size / vc->vc_size_row;
+                               if (l > 5)
+                                       softback_end = softback_buf + l * vc->vc_size_row;
+                               else {
+                                       /* Smaller scrollback makes no sense, and 0
+                                          would screw the operation totally */
+                                       softback_top = 0;
+                               }
+                       }
+               }
+       }
+}
+
 static int fbcon_mode_deleted(struct fb_info *info,
                              struct fb_videomode *mode)
 {
@@ -2708,6 +2753,9 @@ static int fbcon_event_notify(struct notifier_block *self,
        case FB_EVENT_MODE_CHANGE:
                fbcon_modechanged(info);
                break;
+       case FB_EVENT_MODE_CHANGE_ALL:
+               fbcon_set_all_vcs(info);
+               break;
        case FB_EVENT_MODE_DELETE:
                mode = event->data;
                ret = fbcon_mode_deleted(info, mode);
index 4ff853fbe0bea8352bf6df8346af90d613b06031..a8eee79e117d2e610d518d40d7f5e1d7a0b23bf9 100644 (file)
@@ -684,11 +684,13 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 
                        if (!err && (flags & FBINFO_MISC_USEREVENT)) {
                                struct fb_event event;
+                               int evnt = (var->activate & FB_ACTIVATE_ALL) ?
+                                       FB_EVENT_MODE_CHANGE_ALL :
+                                       FB_EVENT_MODE_CHANGE;
 
                                info->flags &= ~FBINFO_MISC_USEREVENT;
                                event.info = info;
-                               notifier_call_chain(&fb_notifier_list,
-                                                   FB_EVENT_MODE_CHANGE,
+                               notifier_call_chain(&fb_notifier_list, evnt,
                                                    &event);
                        }
                }
index bc24beeed971d7a803af06bd74eb3c6ef2e300fe..70da819df0f537917b3ab290938421ed39c68a56 100644 (file)
@@ -495,6 +495,9 @@ struct fb_cursor_user {
 #define FB_EVENT_BLANK                  0x08
 /*      Private modelist is to be replaced */
 #define FB_EVENT_NEW_MODELIST           0x09
+/*     The resolution of the passed in fb_info about to change and
+        all vc's should be changed         */
+#define FB_EVENT_MODE_CHANGE_ALL       0x0A
 
 struct fb_event {
        struct fb_info *info;