[coreboot] r3516 - trunk/payloads/libpayload/curses

svn at coreboot.org svn at coreboot.org
Mon Aug 18 21:28:43 CEST 2008


Author: jcrouse
Date: 2008-08-18 21:28:42 +0200 (Mon, 18 Aug 2008)
New Revision: 3516

Modified:
   trunk/payloads/libpayload/curses/tinycurses.c
Log:
Fix tinycurses color output on the VGA console.

The CGA compatible 16 color VGA text mode expects Intensity RGB color
specifications, in the order IRGB from most to least significant bit.
Curses COLOR_ macros follows ANSI X3.64/ISO 6429/ECMA-48, specifying
RGB color in the order BGR from most to least significant bit.
Consequently, it is necessary to swap the red and blue bits.

Signed-off-by: Ulf Jordan <jordan at chalmers.se>
Acked-by: Jordan Crouse <jordan.crouse at amd.com>



Modified: trunk/payloads/libpayload/curses/tinycurses.c
===================================================================
--- trunk/payloads/libpayload/curses/tinycurses.c	2008-08-18 18:55:33 UTC (rev 3515)
+++ trunk/payloads/libpayload/curses/tinycurses.c	2008-08-18 19:28:42 UTC (rev 3516)
@@ -658,6 +658,8 @@
 	return OK;
 }
 
+#define SWAP_RED_BLUE(c) \
+	(((c) & 0x4400) >> 2) | ((c) & 0xAA00) | (((c) & 0x1100) << 2)
 int wnoutrefresh(WINDOW *win)
 {
 	// FIXME.
@@ -720,6 +722,8 @@
 				serial_putchar(ch);
 			}
 
+			c = SWAP_RED_BLUE(c);
+
 			if (curses_flags & F_ENABLE_CONSOLE) {
 				ch = win->_line[y].text[x].chars[0];
 





More information about the coreboot mailing list