diff -Nurb qemu__OLD/hw/vga.c qemu__with_new_bgr_option/hw/vga.c --- qemu__OLD/hw/vga.c 2005-09-07 18:21:31.490916000 +0200 +++ qemu__with_new_bgr_option/hw/vga.c 2005-09-07 17:30:43.529284000 +0200 @@ -788,23 +788,43 @@ static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b) { +if (bgr_display_enabled) { + return ((b >> 5) << 5) | ((g >> 5) << 2) | (r >> 6); +} +else { return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6); } +} static inline unsigned int rgb_to_pixel15(unsigned int r, unsigned int g, unsigned b) { +if (bgr_display_enabled) { + return ((b >> 3) << 10) | ((g >> 3) << 5) | (r >> 3); +} +else { return ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); } +} static inline unsigned int rgb_to_pixel16(unsigned int r, unsigned int g, unsigned b) { +if (bgr_display_enabled) { + return ((b >> 3) << 11) | ((g >> 2) << 5) | (r >> 3); +} +else { return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); } +} static inline unsigned int rgb_to_pixel32(unsigned int r, unsigned int g, unsigned b) { +if (bgr_display_enabled) { + return (b << 16) | (g << 8) | r; +} +else { return (r << 16) | (g << 8) | b; } +} #define DEPTH 8 #include "vga_template.h" diff -Nurb qemu__OLD/vl.c qemu__with_new_bgr_option/vl.c --- qemu__OLD/vl.c 2005-09-05 22:28:45.000000000 +0200 +++ qemu__with_new_bgr_option/vl.c 2005-09-07 16:44:42.100901000 +0200 @@ -139,6 +139,7 @@ int prep_enabled = 0; int rtc_utc = 1; int cirrus_vga_enabled = 1; +int bgr_display_enabled = 0; #ifdef TARGET_SPARC int graphic_width = 1024; int graphic_height = 768; @@ -2879,6 +2880,7 @@ "-snapshot write to temporary files instead of disk image files\n" "-m megs set virtual RAM size to megs MB [default=%d]\n" "-nographic disable graphical output and redirect serial I/Os to console\n" + "-bgr invert colors for HOSTS using certain SPARC frame buffers\n" #ifndef _WIN32 "-k language use keyboard layout (for example \"fr\" for French)\n" #endif @@ -3011,6 +3013,7 @@ QEMU_OPTION_cirrusvga, QEMU_OPTION_g, QEMU_OPTION_std_vga, + QEMU_OPTION_bgr, QEMU_OPTION_monitor, QEMU_OPTION_serial, QEMU_OPTION_parallel, @@ -3089,6 +3092,7 @@ { "full-screen", 0, QEMU_OPTION_full_screen }, { "pidfile", HAS_ARG, QEMU_OPTION_pidfile }, { "win2k-hack", 0, QEMU_OPTION_win2k_hack }, + { "bgr", 0, QEMU_OPTION_bgr }, /* temporary options */ { "pci", 0, QEMU_OPTION_pci }, @@ -3516,6 +3520,9 @@ case QEMU_OPTION_std_vga: cirrus_vga_enabled = 0; break; + case QEMU_OPTION_bgr: + bgr_display_enabled = 1; + break; case QEMU_OPTION_g: { const char *p; diff -Nurb qemu__OLD/vl.h qemu__with_new_bgr_option/vl.h --- qemu__OLD/vl.h 2005-08-21 11:30:40.000000000 +0200 +++ qemu__with_new_bgr_option/vl.h 2005-09-07 16:10:39.365955000 +0200 @@ -128,6 +128,7 @@ extern int bios_size; extern int rtc_utc; extern int cirrus_vga_enabled; +extern int bgr_display_enabled; extern int graphic_width; extern int graphic_height; extern int graphic_depth;