]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/video/console/fbcon.c
Pull address_range into release branch
[linux-2.6-omap-h63xx.git] / drivers / video / console / fbcon.c
index 50e4c4eb491fbb2e457c482bc92ee14ec8a51d56..47ba1a79adcd350e6487b42d1d5e6b1a4e1b6c7a 100644 (file)
@@ -209,13 +209,13 @@ static irqreturn_t fb_vbl_detect(int irq, void *dummy, struct pt_regs *fp)
 #endif
 
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION
-static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
+static inline void fbcon_set_rotation(struct fb_info *info)
 {
        struct fbcon_ops *ops = info->fbcon_par;
 
        if (!(info->flags & FBINFO_MISC_TILEBLITTING) &&
-           p->con_rotate < 4)
-               ops->rotate = p->con_rotate;
+           ops->p->con_rotate < 4)
+               ops->rotate = ops->p->con_rotate;
        else
                ops->rotate = 0;
 }
@@ -265,7 +265,7 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
        fbcon_set_all_vcs(info);
 }
 #else
-static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
+static inline void fbcon_set_rotation(struct fb_info *info)
 {
        struct fbcon_ops *ops = info->fbcon_par;
 
@@ -402,7 +402,7 @@ static void fb_flashcursor(void *private)
        c = scr_readw((u16 *) vc->vc_pos);
        mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
                CM_ERASE : CM_DRAW;
-       ops->cursor(vc, info, p, mode, softback_lines, get_color(vc, info, c, 1),
+       ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
                    get_color(vc, info, c, 0));
        release_console_sem();
 }
@@ -466,7 +466,7 @@ static int __init fb_console_setup(char *this_opt)
        int i, j;
 
        if (!this_opt || !*this_opt)
-               return 0;
+               return 1;
 
        while ((options = strsep(&this_opt, ",")) != NULL) {
                if (!strncmp(options, "font:", 5))
@@ -481,10 +481,10 @@ static int __init fb_console_setup(char *this_opt)
                                        options++;
                                }
                                if (*options != ',')
-                                       return 0;
+                                       return 1;
                                options++;
                        } else
-                               return 0;
+                               return 1;
                }
                
                if (!strncmp(options, "map:", 4)) {
@@ -496,7 +496,7 @@ static int __init fb_console_setup(char *this_opt)
                                        con2fb_map_boot[i] =
                                                (options[j++]-'0') % FB_MAX;
                                }
-                       return 0;
+                       return 1;
                }
 
                if (!strncmp(options, "vc:", 3)) {
@@ -518,7 +518,7 @@ static int __init fb_console_setup(char *this_opt)
                                rotate = 0;
                }
        }
-       return 0;
+       return 1;
 }
 
 __setup("fbcon=", fb_console_setup);
@@ -647,29 +647,27 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
 }
 
 #ifdef CONFIG_FB_TILEBLITTING
-static void set_blitting_type(struct vc_data *vc, struct fb_info *info,
-                             struct display *p)
+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];
+       ops->p = &fb_display[vc->vc_num];
 
        if ((info->flags & FBINFO_MISC_TILEBLITTING))
-               fbcon_set_tileops(vc, info, p, ops);
+               fbcon_set_tileops(vc, info);
        else {
-               fbcon_set_rotation(info, ops->p);
+               fbcon_set_rotation(info);
                fbcon_set_bitops(ops);
        }
 }
 #else
-static void set_blitting_type(struct vc_data *vc, struct fb_info *info,
-                             struct display *p)
+static void set_blitting_type(struct vc_data *vc, struct fb_info *info)
 {
        struct fbcon_ops *ops = info->fbcon_par;
 
        info->flags &= ~FBINFO_MISC_TILEBLITTING;
-       ops->p = (p) ? p : &fb_display[vc->vc_num];
-       fbcon_set_rotation(info, ops->p);
+       ops->p = &fb_display[vc->vc_num];
+       fbcon_set_rotation(info);
        fbcon_set_bitops(ops);
 }
 #endif /* CONFIG_MISC_TILEBLITTING */
@@ -689,15 +687,14 @@ static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info,
                err = -ENODEV;
 
        if (!err) {
-               ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
+               ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
                if (!ops)
                        err = -ENOMEM;
        }
 
        if (!err) {
-               memset(ops, 0, sizeof(struct fbcon_ops));
                info->fbcon_par = ops;
-               set_blitting_type(vc, info, NULL);
+               set_blitting_type(vc, info);
        }
 
        if (err) {
@@ -921,19 +918,18 @@ static const char *fbcon_startup(void)
                return NULL;
        }
 
-       ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
+       ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
        if (!ops) {
                module_put(owner);
                return NULL;
        }
 
-       memset(ops, 0, sizeof(struct fbcon_ops));
        ops->currcon = -1;
        ops->graphics = 1;
        ops->cur_rotate = -1;
        info->fbcon_par = ops;
        p->con_rotate = rotate;
-       set_blitting_type(vc, info, NULL);
+       set_blitting_type(vc, info);
 
        if (info->fix.type != FB_TYPE_TEXT) {
                if (fbcon_softback_size) {
@@ -1093,7 +1089,7 @@ static void fbcon_init(struct vc_data *vc, int init)
 
        ops = info->fbcon_par;
        p->con_rotate = rotate;
-       set_blitting_type(vc, info, NULL);
+       set_blitting_type(vc, info);
 
        cols = vc->vc_cols;
        rows = vc->vc_rows;
@@ -1141,11 +1137,12 @@ static void fbcon_init(struct vc_data *vc, int init)
        if (vc == svc && softback_buf)
                fbcon_update_softback(vc);
 
-       if (ops->rotate_font && ops->rotate_font(info, vc, p)) {
+       if (ops->rotate_font && ops->rotate_font(info, vc)) {
                ops->rotate = FB_ROTATE_UR;
-               set_blitting_type(vc, info, p);
+               set_blitting_type(vc, info);
        }
 
+       ops->p = &fb_display[fg_console];
 }
 
 static void fbcon_deinit(struct vc_data *vc)
@@ -1243,7 +1240,6 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
 {
        struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
        struct fbcon_ops *ops = info->fbcon_par;
-       struct display *p = &fb_display[vc->vc_num];
        int y;
        int c = scr_readw((u16 *) vc->vc_pos);
 
@@ -1260,7 +1256,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
                y = 0;
        }
 
-       ops->cursor(vc, info, p, mode, y, get_color(vc, info, c, 1),
+       ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1),
                    get_color(vc, info, c, 0));
        vbl_cursor_cnt = CURSOR_DRAW_DELAY;
 }
@@ -1411,16 +1407,13 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count)
        struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
        struct fbcon_ops *ops = info->fbcon_par;
        struct display *p = &fb_display[vc->vc_num];
-       int redraw = 0;
 
        p->yscroll += count;
+
        if (p->yscroll > p->vrows - vc->vc_rows) {
                p->yscroll -= p->vrows - vc->vc_rows;
-               redraw = 1;
-       }
-
-       if (redraw)
                fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t);
+       }
 
        ops->var.xoffset = 0;
        ops->var.yoffset = p->yscroll * vc->vc_font.height;
@@ -1462,16 +1455,13 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count)
        struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
        struct fbcon_ops *ops = info->fbcon_par;
        struct display *p = &fb_display[vc->vc_num];
-       int redraw = 0;
 
        p->yscroll -= count;
+
        if (p->yscroll < 0) {
                p->yscroll += p->vrows - vc->vc_rows;
-               redraw = 1;
-       }
-
-       if (redraw)
                fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count);
+       }
 
        ops->var.xoffset = 0;
        ops->var.yoffset = p->yscroll * vc->vc_font.height;
@@ -1755,7 +1745,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
                                        fbcon_redraw_move(vc, p, 0, t, count);
                                ypan_up_redraw(vc, t, count);
                                if (vc->vc_rows - b > 0)
-                                       fbcon_redraw_move(vc, p, b - count,
+                                       fbcon_redraw_move(vc, p, b,
                                                          vc->vc_rows - b, b);
                        } else
                                fbcon_redraw_move(vc, p, t + count, b - t - count, t);
@@ -1968,7 +1958,8 @@ static __inline__ void updatescrollmode(struct display *p,
                divides(ypan, vc->vc_font.height) && vyres > yres;
        int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) &&
                divides(ywrap, vc->vc_font.height) &&
-               divides(vc->vc_font.height, vyres);
+               divides(vc->vc_font.height, vyres) &&
+               divides(vc->vc_font.height, yres);
        int reading_fast = cap & FBINFO_READS_FAST;
        int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) &&
                !(cap & FBINFO_HWACCEL_DISABLED);
@@ -2107,16 +2098,19 @@ static int fbcon_switch(struct vc_data *vc)
                                 info->flags & FBINFO_MISC_ALWAYS_SETPAR)) {
                if (info->fbops->fb_set_par)
                        info->fbops->fb_set_par(info);
-               fbcon_del_cursor_timer(old_info);
-               fbcon_add_cursor_timer(info);
+
+               if (old_info != info) {
+                       fbcon_del_cursor_timer(old_info);
+                       fbcon_add_cursor_timer(info);
+               }
        }
 
-       set_blitting_type(vc, info, p);
+       set_blitting_type(vc, info);
        ops->cursor_reset = 1;
 
-       if (ops->rotate_font && ops->rotate_font(info, vc, p)) {
+       if (ops->rotate_font && ops->rotate_font(info, vc)) {
                ops->rotate = FB_ROTATE_UR;
-               set_blitting_type(vc, info, p);
+               set_blitting_type(vc, info);
        }
 
        vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
@@ -2637,7 +2631,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines)
                                        scr_memcpyw((u16 *) q, (u16 *) p,
                                                    vc->vc_size_row);
                                }
-                               softback_in = p;
+                               softback_in = softback_curr = p;
                                update_region(vc, vc->vc_origin,
                                              logo_lines * vc->vc_cols);
                        }
@@ -2739,7 +2733,7 @@ static void fbcon_modechanged(struct fb_info *info)
                return;
 
        p = &fb_display[vc->vc_num];
-       set_blitting_type(vc, info, p);
+       set_blitting_type(vc, info);
 
        if (CON_IS_VISIBLE(vc)) {
                var_to_display(p, &info->var, info);
@@ -2781,7 +2775,7 @@ static void fbcon_set_all_vcs(struct fb_info *info)
                        continue;
 
                p = &fb_display[vc->vc_num];
-               set_blitting_type(vc, info, p);
+               set_blitting_type(vc, info);
                var_to_display(p, &info->var, info);
                cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
                rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
@@ -2806,6 +2800,8 @@ static void fbcon_set_all_vcs(struct fb_info *info)
                                fbcon_update_softback(vc);
                }
        }
+
+       ops->p = &fb_display[ops->currcon];
 }
 
 static int fbcon_mode_deleted(struct fb_info *info,