]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/video/console/fbcon.c
Merge branch 'master'
[linux-2.6-omap-h63xx.git] / drivers / video / console / fbcon.c
index e829ba18e0a5cda254e774480f7841c05407327e..3660e51b2612996a80963137777db21b4e9f65a0 100644 (file)
@@ -106,8 +106,7 @@ enum {
        FBCON_LOGO_DONTSHOW     = -3    /* do not show the logo */
 };
 
-struct display fb_display[MAX_NR_CONSOLES];
-EXPORT_SYMBOL(fb_display);
+static struct display fb_display[MAX_NR_CONSOLES];
 
 static signed char con2fb_map[MAX_NR_CONSOLES];
 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
@@ -193,6 +192,8 @@ static void fbcon_preset_disp(struct fb_info *info, struct fb_var_screeninfo *va
                              int unit);
 static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
                              int line, int count, int dy);
+static void fbcon_modechanged(struct fb_info *info);
+static void fbcon_set_all_vcs(struct fb_info *info);
 
 #ifdef CONFIG_MAC
 /*
@@ -218,6 +219,51 @@ static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
        else
                ops->rotate = 0;
 }
+
+static void fbcon_rotate(struct fb_info *info, u32 rotate)
+{
+       struct fbcon_ops *ops= info->fbcon_par;
+       struct fb_info *fb_info;
+
+       if (!ops || ops->currcon == -1)
+               return;
+
+       fb_info = registered_fb[con2fb_map[ops->currcon]];
+
+       if (info == fb_info) {
+               struct display *p = &fb_display[ops->currcon];
+
+               if (rotate < 4)
+                       p->con_rotate = rotate;
+               else
+                       p->con_rotate = 0;
+
+               fbcon_modechanged(info);
+       }
+}
+
+static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
+{
+       struct fbcon_ops *ops = info->fbcon_par;
+       struct vc_data *vc;
+       struct display *p;
+       int i;
+
+       if (!ops || ops->currcon < 0 || rotate > 3)
+               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];
+               p->con_rotate = rotate;
+       }
+
+       fbcon_set_all_vcs(info);
+}
 #else
 static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
 {
@@ -225,8 +271,25 @@ static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
 
        ops->rotate = FB_ROTATE_UR;
 }
+
+static void fbcon_rotate(struct fb_info *info, u32 rotate)
+{
+       return;
+}
+
+static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
+{
+       return;
+}
 #endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */
 
+static int fbcon_get_rotate(struct fb_info *info)
+{
+       struct fbcon_ops *ops = info->fbcon_par;
+
+       return (ops) ? ops->rotate : 0;
+}
+
 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
 {
        struct fbcon_ops *ops = info->fbcon_par;
@@ -589,13 +652,12 @@ static void set_blitting_type(struct vc_data *vc, struct fb_info *info,
 {
        struct fbcon_ops *ops = info->fbcon_par;
 
+       ops->p = (p) ? p : &fb_display[vc->vc_num];
+
        if ((info->flags & FBINFO_MISC_TILEBLITTING))
                fbcon_set_tileops(vc, info, p, ops);
        else {
-               struct display *disp;
-
-               disp = (p) ? p : &fb_display[vc->vc_num];
-               fbcon_set_rotation(info, disp);
+               fbcon_set_rotation(info, ops->p);
                fbcon_set_bitops(ops);
        }
 }
@@ -604,11 +666,10 @@ static void set_blitting_type(struct vc_data *vc, struct fb_info *info,
                              struct display *p)
 {
        struct fbcon_ops *ops = info->fbcon_par;
-       struct display *disp;
 
        info->flags &= ~FBINFO_MISC_TILEBLITTING;
-       disp = (p) ? p : &fb_display[vc->vc_num];
-       fbcon_set_rotation(info, disp);
+       ops->p = (p) ? p : &fb_display[vc->vc_num];
+       fbcon_set_rotation(info, ops->p);
        fbcon_set_bitops(ops);
 }
 #endif /* CONFIG_MISC_TILEBLITTING */
@@ -1987,7 +2048,7 @@ static int fbcon_switch(struct vc_data *vc)
        struct fbcon_ops *ops;
        struct display *p = &fb_display[vc->vc_num];
        struct fb_var_screeninfo var;
-       int i, prev_console;
+       int i, prev_console, charcnt = 256;
 
        info = registered_fb[con2fb_map[vc->vc_num]];
        ops = info->fbcon_par;
@@ -2042,7 +2103,8 @@ static int fbcon_switch(struct vc_data *vc)
        fb_set_var(info, &var);
        ops->var = info->var;
 
-       if (old_info != NULL && old_info != info) {
+       if (old_info != NULL && (old_info != info ||
+                                info->flags & FBINFO_MISC_ALWAYS_SETPAR)) {
                if (info->fbops->fb_set_par)
                        info->fbops->fb_set_par(info);
                fbcon_del_cursor_timer(old_info);
@@ -2059,6 +2121,13 @@ static int fbcon_switch(struct vc_data *vc)
 
        vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
        vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
+
+       if (p->userfont)
+               charcnt = FNTCHARCNT(vc->vc_font.data);
+
+       if (charcnt > 256)
+               vc->vc_complement_mask <<= 1;
+
        updatescrollmode(p, info, vc);
 
        switch (p->scrollmode) {
@@ -2078,8 +2147,12 @@ static int fbcon_switch(struct vc_data *vc)
 
        scrollback_max = 0;
        scrollback_current = 0;
-       ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
-       ops->update_start(info);
+
+       if (!fbcon_is_inactive(vc, info)) {
+           ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
+           ops->update_start(info);
+       }
+
        fbcon_set_palette(vc, color_table);     
        fbcon_clear_margins(vc, 0);
 
@@ -2123,11 +2196,14 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
                ops->graphics = 1;
 
                if (!blank) {
+                       if (info->fbops->fb_save_state)
+                               info->fbops->fb_save_state(info);
                        var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
                        fb_set_var(info, &var);
                        ops->graphics = 0;
                        ops->var = info->var;
-               }
+               } else if (info->fbops->fb_restore_state)
+                       info->fbops->fb_restore_state(info);
        }
 
        if (!fbcon_is_inactive(vc, info)) {
@@ -2675,8 +2751,12 @@ static void fbcon_modechanged(struct fb_info *info)
                updatescrollmode(p, info, vc);
                scrollback_max = 0;
                scrollback_current = 0;
-               ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
-               ops->update_start(info);
+
+               if (!fbcon_is_inactive(vc, info)) {
+                   ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
+                   ops->update_start(info);
+               }
+
                fbcon_set_palette(vc, color_table);
                update_screen(vc);
                if (softback_buf)
@@ -2713,8 +2793,13 @@ static void fbcon_set_all_vcs(struct fb_info *info)
                        updatescrollmode(p, info, vc);
                        scrollback_max = 0;
                        scrollback_current = 0;
-                       ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
-                       ops->update_start(info);
+
+                       if (!fbcon_is_inactive(vc, info)) {
+                           ops->var.xoffset = ops->var.yoffset =
+                               p->yscroll = 0;
+                           ops->update_start(info);
+                       }
+
                        fbcon_set_palette(vc, color_table);
                        update_screen(vc);
                        if (softback_buf)
@@ -2864,6 +2949,14 @@ static int fbcon_event_notify(struct notifier_block *self,
        case FB_EVENT_NEW_MODELIST:
                fbcon_new_modelist(info);
                break;
+       case FB_EVENT_SET_CON_ROTATE:
+               fbcon_rotate(info, *(int *)event->data);
+               break;
+       case FB_EVENT_GET_CON_ROTATE:
+               ret = fbcon_get_rotate(info);
+               break;
+       case FB_EVENT_SET_CON_ROTATE_ALL:
+               fbcon_rotate_all(info, *(int *)event->data);
        }
 
        return ret;