From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ED37n-0007Ia-Bz for qemu-devel@nongnu.org; Wed, 07 Sep 2005 12:50:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ED37l-0007Hr-EL for qemu-devel@nongnu.org; Wed, 07 Sep 2005 12:50:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ED37l-0007Hh-Ao for qemu-devel@nongnu.org; Wed, 07 Sep 2005 12:50:13 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1ED371-0002vp-F5 for qemu-devel@nongnu.org; Wed, 07 Sep 2005 12:49:27 -0400 Message-ID: <431F18C7.5030808@gmx.com> Date: Wed, 07 Sep 2005 18:43:51 +0200 From: Martin Bochnig MIME-Version: 1.0 References: <431D8B04.7010406@Sun.COM> <431D8D61.8050305@gmx.com> <431D9739.7000500@Sun.COM> <431D9B40.9070703@gmx.com> <431D9BEF.9010808@Sun.COM> <431DA049.6010100@gmx.com> <431DA4CE.30705@Sun.COM> In-Reply-To: <431DA4CE.30705@Sun.COM> Content-Type: multipart/mixed; boundary="------------040206010204060106060807" Subject: [Qemu-devel] RGB vs. BGR rame buffers _/_ Re: colors Reply-To: mb1x@gmx.com, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: dclarke@blastwave.org, Philip Brown , Ben Taylor This is a multi-part message in MIME format. --------------040206010204060106060807 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: <> 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 --------------040206010204060106060807 Content-Type: text/x-patch; name="CSWqemu_src_0.7.2__with_new_bgr_option.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="CSWqemu_src_0.7.2__with_new_bgr_option.diff" 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; --------------040206010204060106060807--