vserver 2.0 rc7
[linux-2.6.git] / drivers / video / console / bitblit.c
index 2ab37d6..b28a4b0 100644 (file)
@@ -39,7 +39,7 @@ static inline int get_attribute(struct fb_info *info, u16 c)
 {
        int attribute = 0;
 
-       if (fb_get_color_depth(info) == 1) {
+       if (fb_get_color_depth(&info->var) == 1) {
                if (attr_underline(c))
                        attribute |= FBCON_ATTRIBUTE_UNDERLINE;
                if (attr_reverse(c))
@@ -199,7 +199,10 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
                count -= cnt;
        }
 
-       if (buf)
+       /* buf is always NULL except when in monochrome mode, so in this case
+          it's a gain to check buf against NULL even though kfree() handles
+          NULL pointers just fine */
+       if (unlikely(buf))
                kfree(buf);
 }
 
@@ -236,7 +239,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
 }
 
 static void bit_cursor(struct vc_data *vc, struct fb_info *info,
-                      struct display *p, int mode, int fg, int bg)
+                      struct display *p, int mode, int softback_lines, int fg, int bg)
 {
        struct fb_cursor cursor;
        struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par;
@@ -248,6 +251,15 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info,
 
        cursor.set = 0;
 
+       if (softback_lines) {
+               if (y + softback_lines >= vc->vc_rows) {
+                       mode = CM_ERASE;
+                       ops->cursor_flash = 0;
+                       return;
+               } else
+                       y += softback_lines;
+       }
+
        c = scr_readw((u16 *) vc->vc_pos);
        attribute = get_attribute(info, c);
        src = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height));
@@ -264,8 +276,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info,
                dst = kmalloc(w * vc->vc_font.height, GFP_ATOMIC);
                if (!dst)
                        return;
-               if (ops->cursor_data)
-                       kfree(ops->cursor_data);
+               kfree(ops->cursor_data);
                ops->cursor_data = dst;
                update_attr(dst, src, attribute, vc);
                src = dst;
@@ -312,8 +323,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info,
                if (!mask)
                        return;
 
-               if (ops->cursor_state.mask)
-                       kfree(ops->cursor_state.mask);
+               kfree(ops->cursor_state.mask);
                ops->cursor_state.mask = mask;
 
                p->cursor_shape = vc->vc_cursor_type;