Skip to contentSkip to conversation

fbcon: bgcolor fix

PATCH In review Stefano Stabellini 2 participants 3 messages Jul 1, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbcon: bgcolor fix

The forth bit of the background color is the blink property bit, not the intensity bit, as for the foreground color.
Therefore it shouldn't be included in the background color.

Signed-off-by [email protected]
---
 drivers/video/console/fbcon.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/console/fbcon.h +1 -1
index 0135e03..beb6a74 100644
@@ -92,7 +92,7 @@ struct fbcon_ops {
 #define attr_fgcol(fgshift,s)    \
 	(((s) >> (fgshift)) & 0x0f)
 #define attr_bgcol(bgshift,s)    \
-	(((s) >> (bgshift)) & 0x0f)
+	(((s) >> (bgshift)) & 0x07)
 
 /* Monochrome */
 #define attr_bold(s) \
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 3 lines · Stefano Stabellini

The forth bit of the background color is the blink property bit, not the intensity bit, as for the foreground color.
Therefore it shouldn't be included in the background color.

I'm a bit skeptical, though I have not tried this. ISTR fb has the power to render full 8 bits background in addition to blinking.

Quoted 11 lines
drivers/video/console/fbcon.h +1 -1
@@ -92,7 +92,7 @@ struct fbcon_ops {
 #define attr_fgcol(fgshift,s)    \
 	(((s) >> (fgshift)) & 0x0f)
 #define attr_bgcol(bgshift,s)    \
-	(((s) >> (bgshift)) & 0x0f)
+	(((s) >> (bgshift)) & 0x07)
 
 /* Monochrome */
 #define attr_bold(s) \
#2 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 3 lines · Stefano Stabellini

The forth bit of the background color is the blink property bit, not the intensity bit, as for the foreground color.
Therefore it shouldn't be included in the background color.

I'm a bit skeptical, though I have not tried this.

If you look at the build_attr function in drivers/char/vt.c you can see that the blink attribute is stored as the forth bit of the background color.

I tried the patches with both an ncurses application and manually using:

echo -en '\E[5m'

and they seems to work fine.