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
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.0 +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"
+ "-bgrinvert 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.0 +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;
___
Qemu-devel mailing list
Qemu-devel