All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Bochnig <mb1x@gmx.com>
To: qemu-devel@nongnu.org
Cc: dclarke@blastwave.org, Philip Brown <phil@bolthole.com>,
	Ben Taylor <John.B.Taylor@Sun.COM>
Subject: [Qemu-devel] RGB vs. BGR rame buffers _/_ Re: colors
Date: Wed, 07 Sep 2005 18:43:51 +0200	[thread overview]
Message-ID: <431F18C7.5030808@gmx.com> (raw)
In-Reply-To: <431DA4CE.30705@Sun.COM>

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

Hi,

Ben Taylor wrote:

> Do you think this is one of those things that could be done as a 
> command line option, (like -rgb/-gbr)
> without having to have two versions?  (this would allow you to have 
> both behaviors in
> one binary).   [Don't take this as me asking you to do this, I'm just 
> wondering what
> the correct way to do this "outloud" is. :-)]
> As I don't do much *heavy* coding, do you think it would be 
> appropriate to use a function
> table, or just if/then's to handle the correct mapping?  Again - I'm 
> just wondering outloud
> so I can be a little smarter after this experience.
>
> Ben


you're right: Adding a "-bgr" runtime option (for certain SPARC frame 
buffer based HOSTS [displaying the QEMU window, but not necessarily 
running the QEMU process]) was overdue.
I just did so and the updated "Solaris_sparc_OR_x86_HOST_ready" tarball 
is now available at

http://user.cs.tu-berlin.de/~mbeinsx/s_r_c/CSWqemu_src_0.7.2__with_new_bgr_option.tar.bz2

The actual gdiff to
http://user.cs.tu-berlin.de/~mbeinsx/s_r_c/CSWqemu_0.7.2_sources.tar.bz2
can be found here:
http://user.cs.tu-berlin.de/~mbeinsx/s_r_c/CSWqemu_src_0.7.2__with_new_bgr_option.diff

Furthermore it is attached for convenience:
<<CSWqemu_src_0.7.2__with_new_bgr_option.diff>>

The older precompiled SunOS/SVR4 pkgadd packages contine to be available at
http://user.cs.tu-berlin.de/~mbeinsx/qemu/qemu-0.7.0,REV=2005.06.27-SunOS5.8-sparc-CSW.pkg.bz2
and
http://user.cs.tu-berlin.de/~mbeinsx/qemu/qemu-0.7.0,REV=2005.06.27-SunOS5.8-i386-CSW.pkg.bz2
where plain networking *is* included and fully functional (emulated 
NE2000 nic).
However, TUN/TAP bridging support was not yet compiled in.



  martin
             bochnig

[-- Attachment #2: CSWqemu_src_0.7.2__with_new_bgr_option.diff --]
[-- Type: text/x-patch, Size: 3267 bytes --]

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;

           reply	other threads:[~2005-09-07 16:50 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <431DA4CE.30705@Sun.COM>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=431F18C7.5030808@gmx.com \
    --to=mb1x@gmx.com \
    --cc=John.B.Taylor@Sun.COM \
    --cc=dclarke@blastwave.org \
    --cc=phil@bolthole.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.