qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Updated BGR vs. RGB vga patch...
@ 2006-04-10 16:25 Leonardo E. Reiter
  2006-04-10 16:35 ` Paul Brook
  2006-04-10 23:12 ` Thiemo Seufer
  0 siblings, 2 replies; 17+ messages in thread
From: Leonardo E. Reiter @ 2006-04-10 16:25 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

Hello,

attached is an updated version (against today's CVS) of a patch to 
enable B/G/R color encoding rather than R/G/B with the command-line 
option -bgr.  I found the original here (post by Martin Bochnig):

http://lists.nongnu.org/archive/html/qemu-devel/2005-09/msg00059.html

It's main intention is to deal with some 24-bit Sun/SPARC X servers, 
including SunRays.  But you can also mimic this behavior with a VNC 
server if you want.

Anyway, it may not be too interesting to most, but it is to me at the 
moment, so I figured I'd share.  To use it, you can pass in the -bgr 
command line option to qemu.  You can get some psychadelic colors if 
you're really bored and want to try it on an R/G/B 24-bit X server, like 
XFree86 or X.org :)

Regards,

Leo Reiter


-- 
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing from Desktop to Data Center
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com

[-- Attachment #2: qemu-vga-bgr.patch --]
[-- Type: text/x-patch, Size: 3466 bytes --]

Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.168
diff -a -u -r1.168 vl.c
--- vl.c	9 Apr 2006 01:32:52 -0000	1.168
+++ vl.c	10 Apr 2006 14:07:26 -0000
@@ -128,6 +128,7 @@
 int vm_running;
 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;
@@ -4131,6 +4132,7 @@
            "-m megs         set virtual RAM size to megs MB [default=%d]\n"
            "-smp n          set the number of CPUs to 'n' [default=1]\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
@@ -4283,6 +4285,7 @@
     QEMU_OPTION_cirrusvga,
     QEMU_OPTION_g,
     QEMU_OPTION_std_vga,
+    QEMU_OPTION_bgr,
     QEMU_OPTION_monitor,
     QEMU_OPTION_serial,
     QEMU_OPTION_parallel,
@@ -4360,6 +4363,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 },
     { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
     { "smp", HAS_ARG, QEMU_OPTION_smp },
     
@@ -4850,6 +4854,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;
Index: vl.h
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.h,v
retrieving revision 1.107
diff -a -u -r1.107 vl.h
--- vl.h	9 Apr 2006 01:32:52 -0000	1.107
+++ vl.h	10 Apr 2006 14:07:26 -0000
@@ -130,6 +130,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;
Index: hw/vga.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/vga.c,v
retrieving revision 1.42
diff -a -u -r1.42 vga.c
--- hw/vga.c	9 Apr 2006 01:06:34 -0000	1.42
+++ hw/vga.c	10 Apr 2006 14:07:26 -0000
@@ -790,23 +790,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"

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-04-11 17:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-10 16:25 [Qemu-devel] Updated BGR vs. RGB vga patch Leonardo E. Reiter
2006-04-10 16:35 ` Paul Brook
2006-04-10 16:41   ` Leonardo E. Reiter
2006-04-10 16:46     ` Paul Brook
2006-04-10 16:48       ` Leonardo E. Reiter
2006-04-10 16:44   ` Leonardo E. Reiter
2006-04-10 16:49     ` Paul Brook
2006-04-10 16:51       ` Leonardo E. Reiter
2006-04-10 16:59         ` Paul Brook
2006-04-10 18:24           ` Leonardo E. Reiter
2006-04-10 19:08             ` malc
2006-04-10 19:11               ` Leonardo E. Reiter
2006-04-11 17:06               ` Leonardo E. Reiter
2006-04-11 17:11               ` Leonardo E. Reiter
2006-04-10 18:25           ` Leonardo E. Reiter
2006-04-10 23:12 ` Thiemo Seufer
2006-04-10 23:22   ` Leonardo E. Reiter

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).