Skip to contentSkip to conversation

rivafb 16bpp text background colour fix

PATCH Applied Jakub Bogusz 2 participants 2 messages Apr 22, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rivafb 16bpp text background colour fix

I sent it already to Ani Joshi long time ago (December 2002), but it seems to be lost somewhere in time.
I noticed that Pawel Goleniowski made the same patch and sent to LKML in December 2003 and January 2004:
http://www.uwsg.iu.edu/hypermail/linux/kernel/0312.2/1258.html
http://www.uwsg.iu.edu/hypermail/linux/kernel/0401.1/0225.html
but it's still not fixed.

The same applies to 2.6.x series, only filename (linux-2.6.*/drivers/video/riva/fbdev.c instead of .../riva/accel.c) and whitespace (tabs are used now instead of spaces) differ.

Original description (written in Dec 2002):

Quoted 7 lines

I noticed, that text background in 16bpp (only) modes is displayed incorrectly. That's because convert_bgcolor_16() converts value to RGBA from 15bpp, not 16bpp.

The fix is attached (works for me, tested by one more person). Patch was made against Linux 2.4.19, but should apply to 2.4.20 and 2.5.x without changes.

Signature · 1 line
Jakub Bogusz    http://cyber.cs.net.pl/~qboosh/

Text background in 16bpp (only) modes was displayed incorrectly because onvert_bgcolor_16() converted value to RGBA from 15bpp, not 16bpp as it should.

drivers/video/riva/accel.c renamed from drivers/video/riva/accel.c.orig +2 -2
@@ -293,8 +293,8 @@
 
 static inline void convert_bgcolor_16(u32 *col)
 {
-	*col = ((*col & 0x00007C00) << 9)
-             | ((*col & 0x000003E0) << 6)
+	*col = ((*col & 0x0000F800) << 8)
+             | ((*col & 0x000007E0) << 5)
              | ((*col & 0x0000001F) << 3)
              |          0xFF000000;
 }

Text background in 16bpp (only) modes was displayed incorrectly because onvert_bgcolor_16() converted value to RGBA from 15bpp, not 16bpp as it should.

drivers/video/riva/fbdev.c renamed from drivers/video/riva/fbdev.c.orig +2 -2
@@ -1368,8 +1368,8 @@
 
 static inline void convert_bgcolor_16(u32 *col)
 {
-	*col = ((*col & 0x00007C00) << 9)
-		| ((*col & 0x000003E0) << 6)
+	*col = ((*col & 0x0000F800) << 8)
+		| ((*col & 0x000007E0) << 5)
 		| ((*col & 0x0000001F) << 3)
 		|	   0xFF000000;
 }
#1 lore raw

I applied it to the newer Nvidia driver I have. I plan to o stream line in the next few weeks.

Quoted 23 lines · Jakub Bogusz

I sent it already to Ani Joshi long time ago (December 2002), but it seems to be lost somewhere in time.
I noticed that Pawel Goleniowski made the same patch and sent to LKML in December 2003 and January 2004:
http://www.uwsg.iu.edu/hypermail/linux/kernel/0312.2/1258.html
http://www.uwsg.iu.edu/hypermail/linux/kernel/0401.1/0225.html
but it's still not fixed.

The same applies to 2.6.x series, only filename (linux-2.6.*/drivers/video/riva/fbdev.c instead of .../riva/accel.c) and whitespace (tabs are used now instead of spaces) differ.

Original description (written in Dec 2002):

Quoted 7 lines

I noticed, that text background in 16bpp (only) modes is displayed incorrectly. That's because convert_bgcolor_16() converts value to RGBA from 15bpp, not 16bpp.

The fix is attached (works for me, tested by one more person). Patch was made against Linux 2.4.19, but should apply to 2.4.20 and 2.5.x without changes.