]> xenbits.xensource.com Git - xenclient/kernel.git/commitdiff
imported patch fbcon-blinking-implementation fbcon-blink
authort_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:06:00 +0000 (12:06 +0000)
committert_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:06:00 +0000 (12:06 +0000)
drivers/video/console/fbcon.c

index 6165fd9662d5a1194f3d843b09e1bd1c717ef6f2..80c677e65890975ba5ce11ea375d73fb1ed03efb 100644 (file)
@@ -136,6 +136,8 @@ static int rotate;
 
 static const struct consw fb_con;
 
+static int blink_flag = 1;
+
 #define CM_SOFTBACK    (8)
 
 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
@@ -390,6 +392,9 @@ static void fb_flashcursor(void *private)
        struct vc_data *vc = NULL;
        int c;
        int mode;
+       unsigned short *s;
+       int x = 0, y = 0;
+       static int show_blink = 1;
 
        acquire_console_sem();
        if (ops && ops->currcon != -1)
@@ -397,18 +402,48 @@ static void fb_flashcursor(void *private)
 
        if (!vc || !CON_IS_VISIBLE(vc) ||
            fbcon_is_inactive(vc, info) ||
-           registered_fb[con2fb_map[vc->vc_num]] != info ||
-           vc_cons[ops->currcon].d->vc_deccm != 1) {
+           registered_fb[con2fb_map[vc->vc_num]] != info) {
                release_console_sem();
                return;
        }
 
        p = &fb_display[vc->vc_num];
-       c = scr_readw((u16 *) vc->vc_pos);
-       mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
-               CM_ERASE : CM_DRAW;
-       ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
-                   get_color(vc, info, c, 0));
+       if (vc_cons[ops->currcon].d->vc_deccm == 1) {
+               c = scr_readw((u16 *) vc->vc_pos);
+               mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
+                       CM_ERASE : CM_DRAW;
+               ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
+                               get_color(vc, info, c, 0));
+       }
+
+       if (vc->vc_hi_font_mask || vc->vc_num != fg_console || !blink_flag) {
+               release_console_sem();
+               return;
+       }
+       if (!softback_lines)
+               s = (u16 *) vc->vc_origin;
+       else
+               s = (u16 *) softback_curr;
+       while (y < vc->vc_rows) {
+               while (x < vc->vc_cols) {
+                       c = scr_readw(s);
+                       if (attr_blink(c)) {
+                               blink_flag = 1;
+                               if (!show_blink)
+                                       c = (c & 0xf4ff) | (attr_bgcol(12, c) << 8);
+                               fbcon_putc(vc, c, y, x);
+                       }
+                       s++;
+                       x++;
+               }
+               x = 0;
+               y++;
+               if (s == (u16 *) softback_end)
+                       s = (u16 *) softback_buf;
+               if (s == (u16 *) softback_in)
+                       s = (u16 *) vc->vc_origin;
+       }
+       show_blink = show_blink ? 0 : 1;
        release_console_sem();
 }
 
@@ -1276,6 +1311,8 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
        struct display *p = &fb_display[vc->vc_num];
        struct fbcon_ops *ops = info->fbcon_par;
 
+       if (!vc->vc_hi_font_mask && (vc->vc_attr & 0x80))
+               blink_flag = 1;
        if (!fbcon_is_inactive(vc, info))
                ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
                           get_color(vc, info, scr_readw(s), 1),
@@ -1295,6 +1332,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
        struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
        struct fbcon_ops *ops = info->fbcon_par;
 
+       blink_flag = 1;
        if (!fbcon_is_inactive(vc, info))
                ops->clear_margins(vc, info, bottom_only);
 }
@@ -1756,6 +1794,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
                return -EINVAL;
 
        fbcon_cursor(vc, CM_ERASE);
+       blink_flag = 1;
 
        /*
         * ++Geert: Only use ywrap/ypan if the console is in text mode
@@ -1950,6 +1989,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
        if (!width || !height)
                return;
 
+       blink_flag = 1;
        /*  Split blits that cross physical y_wrap case.
         *  Pathological case involves 4 blits, better to use recursive
         *  code rather than unrolled case
@@ -2657,6 +2697,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines)
        struct display *p = &fb_display[fg_console];
        int offset, limit, scrollback_old;
 
+       blink_flag = 1;
        if (softback_top) {
                if (vc->vc_num != fg_console)
                        return 0;