* [PATCH] [RESEND] fbcon: simple text blinking implementation
@ 2008-07-17 13:50 Stefano Stabellini
2008-07-17 18:50 ` Geert Uytterhoeven
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2008-07-17 13:50 UTC (permalink / raw)
To: linux-kernel; +Cc: Stefano Stabellini, linux-fbdev-devel
Hi all,
at the moment blinking is not supported in fbcon but it is supported in
vgacon.
Since userspace applications don't distinguish between the two, they just
assume that the linux terminal is always capable of blinking text.
However implementing blinking in fbcon is not so difficult: this patch
provides a very simple (too simple?) implementation of that.
I am using the flashcursor function to scan the buffer for blinking text.
For the sake of efficiency I added a simple flag mechanism to disable the scan
when I am sure that there are no blinking characters on the screen.
Signed-off-by: stefano.stabellini@eu.citrix.com
---
drivers/video/console/fbcon.c | 62 +++++++++++++++++++++++++++++++++-------
1 files changed, 51 insertions(+), 11 deletions(-)
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 97aff8d..163b37a 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -152,6 +152,8 @@ static int fbcon_has_sysfs;
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)
@@ -402,24 +404,58 @@ static void fb_flashcursor(struct work_struct *work)
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)
vc = vc_cons[ops->currcon].d;
if (!vc || !CON_IS_VISIBLE(vc) ||
- registered_fb[con2fb_map[vc->vc_num]] != info ||
- vc->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->vc_deccm == 1 && !(vc->vc_cursor_type & 0x10)) {
+ 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 || !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();
}
@@ -1331,6 +1367,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),
@@ -1350,6 +1388,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);
}
@@ -1364,10 +1403,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
return;
- if (vc->vc_cursor_type & 0x10)
- fbcon_del_cursor_timer(info);
- else
- fbcon_add_cursor_timer(info);
+ fbcon_add_cursor_timer(info);
ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
if (mode & CM_SOFTBACK) {
@@ -1860,6 +1896,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
@@ -2074,6 +2111,8 @@ 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
@@ -2811,6 +2850,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines)
struct display *disp = &fb_display[fg_console];
int offset, limit, scrollback_old;
+ blink_flag = 1;
if (softback_top) {
if (vc->vc_num != fg_console)
return 0;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [RESEND] fbcon: simple text blinking implementation
2008-07-17 13:50 [PATCH] [RESEND] fbcon: simple text blinking implementation Stefano Stabellini
@ 2008-07-17 18:50 ` Geert Uytterhoeven
2008-08-08 9:54 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2008-07-17 18:50 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: linux-fbdev-devel, linux-kernel
On Thu, 17 Jul 2008, Stefano Stabellini wrote:
> at the moment blinking is not supported in fbcon but it is supported in
> vgacon.
> Since userspace applications don't distinguish between the two, they just
> assume that the linux terminal is always capable of blinking text.
> However implementing blinking in fbcon is not so difficult: this patch
> provides a very simple (too simple?) implementation of that.
> I am using the flashcursor function to scan the buffer for blinking text.
> For the sake of efficiency I added a simple flag mechanism to disable the scan
> when I am sure that there are no blinking characters on the screen.
Ehrm, there's already blinking support on some platforms?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [RESEND] fbcon: simple text blinking implementation
2008-07-17 18:50 ` Geert Uytterhoeven
@ 2008-08-08 9:54 ` Stefano Stabellini
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2008-08-08 9:54 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-fbdev-devel, linux-kernel
Geert Uytterhoeven wrote:
> On Thu, 17 Jul 2008, Stefano Stabellini wrote:
>> at the moment blinking is not supported in fbcon but it is supported in
>> vgacon.
>> Since userspace applications don't distinguish between the two, they just
>> assume that the linux terminal is always capable of blinking text.
>> However implementing blinking in fbcon is not so difficult: this patch
>> provides a very simple (too simple?) implementation of that.
>> I am using the flashcursor function to scan the buffer for blinking text.
>> For the sake of efficiency I added a simple flag mechanism to disable the scan
>> when I am sure that there are no blinking characters on the screen.
>
> Ehrm, there's already blinking support on some platforms?
>
are you sure?
fbcon isn't supposed to be a software implementation?
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-08 9:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-17 13:50 [PATCH] [RESEND] fbcon: simple text blinking implementation Stefano Stabellini
2008-07-17 18:50 ` Geert Uytterhoeven
2008-08-08 9:54 ` Stefano Stabellini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).