Sparc32 network problems
Hello,
I have recently upgraded from Q/qemu 0.9.0 to qemu CVS HEAD and the sparc32 Lance NIC appears to no longer work correctly.
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I repeatedly got a kernel panic "Aiee".
CVS HEAD was configured on OS X ppc using no special options (--prefix=... --target-list=sparc-softmmu). When I boot into the above installation disc, it does boot on ppc now but DHCP does not work (could not test on i386 yet due to Q's OS X patches failing against CVS HEAD). If I configure the network manually it displays an error but I am able to complete the base installation. This system then prints the following on startup:
...
Cleaning up ifupdown....
Loading kernel modules...loop: loaded (max 8 devices)
sunlance.c:v2.02 8/24/03 Miguel de Icaza ([email protected])
SunLance: using auto-carrier-detection.
eth0: LANCE 52:54:00:12:34:56
done.
...
Configuring network interfaces...done.
LANCE unopened after 100 ticks, csr0=0032.
dcsr=a0061020
LANCE unopened after 100 ticks, csr0=0032.
dcsr=a0061020
...
Messages similar to the latter are also displayed when I try to ifup eth0:
LANCE unopened after 0 ticks, csr0=0032.
dcsr=a0061020
SIOCSIFFLAGS: Operation not permitted
LANCE unopened after 0 ticks, csr0=0032.
dcsr=a0061020
SIOCSIFFLAGS: Operation not permitted
Failed to bring up eth0.
(in case it's relevant: csr0 appears to be 0032 on SS-5 and ffff on SS-10, ticks 100 on SS-5 and 0 on SS-10)
Any ideas?
Andreas
P.S. Are you aware that ppc-softmmu no longer builds on OS X? I get two unresolved symbol errors.
Quoted 5 lines · Andreas Färber
Hello,
I have recently upgraded from Q/qemu 0.9.0 to qemu CVS HEAD and the sparc32 Lance NIC appears to no longer work correctly.
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I repeatedly got a kernel panic "Aiee".
I've also seen the same with a Linux host running Debian/Sparc guest. It's only started happening with the last few day's CVS.
-Nigel
Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter. NJH Music, Barnsley, UK. ICQ#20252325 [email protected] http://www.bandsman.co.uk
begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard
Quoted 2 lines
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I repeatedly got a kernel panic "Aiee".
I should add that when I tried the interrupt checking patch proposed on this list (http://lists.gnu.org/archive/html/qemu-devel/2007-03/msg00153.html) then instead of the kernel panic I got a qemu crash.
Andreas
Quoted 9 lines · Andreas Färber
Quoted 5 lines
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I repeatedly got a kernel panic "Aiee".
I should add that when I tried the interrupt checking patch proposed on this list (http://lists.gnu.org/archive/html/qemu-devel/2007-03/
msg00153.html) then instead of the kernel panic I got a qemu crash.
Would this happen to be the same bug as in this report:
http://marc.info/?l=qemu-devel&m=117768736212439&w=2
Quoted 11 lines · Blue Swirl
Quoted 7 lines · Andreas Färber
Quoted 4 lines
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I repeatedly got a kernel panic "Aiee".
I should add that when I tried the interrupt checking patch proposed on this list (http://lists.gnu.org/archive/html/qemu-devel/2007-03/
msg00153.html) then instead of the kernel panic I got a qemu crash.Would this happen to be the same bug as in this report:
http://marc.info/?l=qemu-devel&m=117768736212439&w=2
I don't think so, this bug has already been fixed in the CVS. Or maybe it is back.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 10 lines · Aurelien Jarno
Quoted 9 lines · Blue Swirl
Quoted 7 lines · Andreas Färber
Quoted 4 lines
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I repeatedly got a kernel panic "Aiee".
I should add that when I tried the interrupt checking patch proposed on this list (http://lists.gnu.org/archive/html/qemu-devel/2007-03/
msg00153.html) then instead of the kernel panic I got a qemu crash.
Quoted 5 lines
Quoted 2 lines
Would this happen to be the same bug as in this report:
http://marc.info/?l=qemu-devel&m=117768736212439&w=2I don't think so, this bug has already been fixed in the CVS. Or maybe it is back.
I still get the same kernel panic message after loading 7% of additional components.
Hi,
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I repeatedly got a kernel panic "Aiee".
I should add that when I tried the interrupt checking patch proposed on this list (http://lists.gnu.org/archive/html/qemu-devel/2007-03/
msg00153.html) then instead of the kernel panic I got a qemu crash.Would this happen to be the same bug as in this report:
http://marc.info/?l=qemu-devel&m=117768736212439&w=2
Yes, a similar one, except that the kernel panic did somehow mention the code I quoted above.
I have seen it both in 0.9.0 and in 0.9.0 + HEAD openbios-sparc32 on OS X Intel.
But I am unable to try CVS HEAD there because some of Q's patches do not work against HEAD. Would be great if they could make it into CVS to avoid these issues.
I also made some local changes to tcx.c today to avoid having a blue-footed penguin on Intel. There's a TODO in that file saying the RGB functions should be merged with vga.c (where they are being patched by Q) - should I provide a qemu patch doing this and fixing the issue for both? Or is this for some reason restricted to Q?
On PPC I wasn't able to follow an identical installation path and the point of error on Intel was pretty much reproducable, so I can't tell whether it would have surfaced later on. From my view these are two separate issues, and for now I can only test the network issue on ppc - unless someone has instructions how to correctly patch HEAD for Intel support...
Andreas
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the NIC configured through DHCP and install to about 73% where I
repeatedly
Quoted 1 line
got a kernel panic "Aiee".
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I should add that when I tried the interrupt checking patch proposed on this list (http://lists.gnu.org/archive/html/qemu-devel/2007-03/
msg00153.html) then instead of the kernel panic I got a qemu crash.Would this happen to be the same bug as in this report:
http://marc.info/?l=qemu-devel&m=117768736212439&w=2Yes, a similar one, except that the kernel panic did somehow mention the code I quoted above.
When using debian-40r0-sparc-DVD-1.iso on PPC, configuring network manually and selecting the desktop option it crashed at 69% (python-2.4?) with the following message:
Unable to handle kernel NULL pointer dereference
tsk->{mm,active_mm}->contect = 0000007b
tsk->{mm,active_mm}->pgd = fc054400
Kernel panic - not syncing: Aiee, killing interrupt handler!It does not say "Illegal Instruction" and it did recognize and repartition the harddrive.
Andreas
Am 07.06.2007 um 13:47 schrieb Andreas Färber:
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 3 lines
Using Q 0.9.0d88 on a Mac OS X i386 host I was able to boot into debian-40r0-sparc-netinst.iso with qemu-system-sparc, have the
NIC
Quoted 1 line
configured through DHCP and install to about 73% where I
repeatedly
Quoted 1 line
got a kernel panic "Aiee".
I should add that when I tried the interrupt checking patch proposed on this list (http://lists.gnu.org/archive/html/qemu-devel/2007-03/
msg00153.html) then instead of the kernel panic I got a qemu crash.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Would this happen to be the same bug as in this report:
http://marc.info/?l=qemu-devel&m=117768736212439&w=2Yes, a similar one, except that the kernel panic did somehow mention the code I quoted above.
When using debian-40r0-sparc-DVD-1.iso on PPC, configuring network manually and selecting the desktop option it crashed at 69%
Okay, I got it installed now through the following procedure:
use same DVD as above
configure network manually
do not select desktop option
then after a reboot I was able to install additional packages from the DVD using apt-get, aptitude and - after similar crashes as before - dpkg --configure -a
Is Debian correct is saying that TCX supports 8-bit only? Don't we have 15, 16 and 32 bit there, too?
I modified xorg.conf to use suntcx instead of sunffb; depths of 24, 16 and 15 did not work, with 8 bit I got the Blue Swirl. ;-) Looks a little ugly at 8bpp, and without Lance working I can't use XDMCP or VNC instead.
Andreas
Quoted 6 lines · Andreas Färber
Is Debian correct is saying that TCX supports 8-bit only? Don't we have 15, 16 and 32 bit there, too?
I modified xorg.conf to use suntcx instead of sunffb; depths of 24, 16 and 15 did not work, with 8 bit I got the Blue Swirl. ;-) Looks a little ugly at 8bpp, and without Lance working I can't use XDMCP or VNC instead.
I'm not sure if there is anything else besides the 8 and 24-bit modes, only those are implemented. To get the 24-bit mode you have to add -g 1024x768x24 to the command line. Otherwise the device is the 8-bit version.
Am 10.06.2007 um 17:49 schrieb Blue Swirl:
Quoted 10 lines · Andreas Färber
Quoted 6 lines
Is Debian correct is saying that TCX supports 8-bit only? Don't we have 15, 16 and 32 bit there, too?
I modified xorg.conf to use suntcx instead of sunffb; depths of 24, 16 and 15 did not work, with 8 bit I got the Blue Swirl. ;-) Looks a little ugly at 8bpp, and without Lance working I can't use XDMCP or VNC instead.I'm not sure if there is anything else besides the 8 and 24-bit modes, only those are implemented.
Does that mean the 15, 16, 32 is dependent on the host?
Quoted 3 lines
To get the 24-bit mode you have to add -g
1024x768x24 to the command line. Otherwise the device is the 8-bit version.
Then please add this to the documentation! That currently only mentions -g WxH for the size (and when I last tried with a lower size it resulted in the text being cut off).
Andreas
Quoted 11 lines · Andreas Färber
Am 10.06.2007 um 17:49 schrieb Blue Swirl:
Quoted 8 lines · Andreas Färber
Quoted 6 lines
Is Debian correct is saying that TCX supports 8-bit only? Don't we have 15, 16 and 32 bit there, too?
I modified xorg.conf to use suntcx instead of sunffb; depths of 24, 16 and 15 did not work, with 8 bit I got the Blue Swirl. ;-) Looks a little ugly at 8bpp, and without Lance working I can't use XDMCP or VNC instead.
Quoted 4 lines
Quoted 2 lines
I'm not sure if there is anything else besides the 8 and 24-bit modes, only those are implemented.
Does that mean the 15, 16, 32 is dependent on the host?
No, my understanding is that TCX doesn't have those modes at all.
Quoted 7 lines
Quoted 3 lines
To get the 24-bit mode you have to add -g
1024x768x24 to the command line. Otherwise the device is the 8-bit version.Then please add this to the documentation! That currently only mentions -g WxH for the size (and when I last tried with a lower size it resulted in the text being cut off).
Good point. The resolution is currently hardcoded in OpenBIOS.
Quoted 5 lines · Andreas Färber
I also made some local changes to
tcx.ctoday to avoid having a blue- footed penguin on Intel. There's a TODO in that file saying the RGB functions should be merged withvga.c(where they are being patched by Q) - should I provide a qemu patch doing this and fixing the issue for both? Or is this for some reason restricted to Q?
I made a patch to fix both vga and tcx while also unifying the pixel operations, does it fix the blue foot disease on PPC?
hw/pixel_ops.h new file +49 -0
@@ -0,0 +1,49 @@ +static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g, +unsigned int b) +{ +#ifdef WORDS_BIGENDIAN +return ((b >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (r >>6 ); +#else +return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); +#endif +} + +static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g, +unsigned int b) +{ +#ifdef WORDS_BIGENDIAN +return ((b >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (r >>3 ); +#else +return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); +#endif +} + +static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g, +unsigned int b) +{ +#ifdef WORDS_BIGENDIAN +return ((b >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (r >>3 ); +#else +return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); +#endif +} + +static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g, +unsigned int b) +{ +#ifdef WORDS_BIGENDIAN +return (b <<16 ) | (g <<8 ) | r; +#else +return (r <<16 ) | (g <<8 ) | b; +#endif +} + +static inline unsigned int rgb_to_pixel32bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +#ifdef WORDS_BIGENDIAN +return (r <<16 ) | (g <<8 ) | b; +#else +return (b <<16 ) | (g <<8 ) | r; +#endif +}
hw/tcx.c +1 -21
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "vl.h" +#include "pixel_ops.h" #define MAXX 1024#define MAXY 768
@@ -47,27 +48,6 @@static void tcx_invalidate_display (void *opaque);static void tcx24_invalidate_display (void *opaque); -/* XXX: unify with vga draw line functions */ -static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); -} - -static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g,unsigned b) -{ -return (r <<16 ) | (g <<8 ) | b; -} -static void update_palette_entries (TCXState *s,int start,int end) {int i;
hw/vga.c +1 -25
@@ -23,6 +23,7 @@*/ #include "vl.h" #include "vga_int.h" +#include "pixel_ops.h" //#define DEBUG_VGA //#define DEBUG_VGA_MEM
@@ -812,31 +813,6 @@typedef void vga_draw_line_func (VGAState *s1,uint8_t *d,const uint8_t *s,int width); -static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); -} - -static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g,unsigned b) -{ -return (r <<16 ) | (g <<8 ) | b; -} - -static inline unsigned int rgb_to_pixel32bgr (unsigned int r,unsigned int g,unsigned b) -{ -return (b <<16 ) | (g <<8 ) | r; -} -#define DEPTH 8#include "vga_template.h"
Makefile.target +4 -0
@@ -592,6 +592,10 @@ signal.o: signal.c $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< +vga.o: pixel_ops.h + +tcx.o: pixel_ops.h + ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h endif
Quoted 9 lines · Blue Swirl
Quoted 5 lines · Andreas Färber
I also made some local changes to
tcx.ctoday to avoid having a blue- footed penguin on Intel. There's a TODO in that file saying the RGB functions should be merged withvga.c(where they are being patched by Q) - should I provide a qemu patch doing this and fixing the issue for both? Or is this for some reason restricted to Q?I made a patch to fix both vga and tcx while also unifying the pixel operations, does it fix the blue foot disease on PPC?
Hm, _with_ this patch I get (on PPC/Linux, emulating LE MIPS):
- a blue-footed penguin when the cirrus FB is started
- blue instead of red colour in console output
- A general blue-to-red inversion for X11 in 16bit mode.
Note that the colours for the last one were already not quite right (e.g. grey became a pale blue), but with your patch it looks even weirder.
Thiemo
Quoted 12 lines
Quoted 9 lines · Blue Swirl
Quoted 5 lines · Andreas Färber
I also made some local changes to
tcx.ctoday to avoid having a blue- footed penguin on Intel. There's a TODO in that file saying the RGB functions should be merged withvga.c(where they are being patched by Q) - should I provide a qemu patch doing this and fixing the issue for both? Or is this for some reason restricted to Q?I made a patch to fix both vga and tcx while also unifying the pixel operations, does it fix the blue foot disease on PPC?
Quoted 8 lines
Hm, _with_ this patch I get (on PPC/Linux, emulating LE MIPS):
- a blue-footed penguin when the cirrus FB is started
- blue instead of red colour in console output
- A general blue-to-red inversion for X11 in 16bit mode.Note that the colours for the last one were already not quite right (e.g. grey became a pale blue), but with your patch it looks even weirder.
I haven't been able to test the new patch yet.
Q's patch and my adaptation for tcx just reversed the order of the colors, just like BlueSwirl's patch except that they used #if __LITTLE_ENDIAN__ in place of #ifdef WORDS_BIGENDIAN, and this worked for both i386 and sparc32 guests on i386 host (but is not applied for ppc host).
http://www.kju-app.org/proj/browser/trunk/patches/q_vga.c_02.diff
Andreas
Quoted 25 lines · Andreas Färber
Quoted 14 lines
Quoted 11 lines · Blue Swirl
Quoted 7 lines · Andreas Färber
I also made some local changes to
tcx.ctoday to avoid having a blue-
footed penguin on Intel. There's a TODO in that file saying the RGB functions should be merged withvga.c(where they are being patched by Q) - should I provide a qemu patch doing this and fixing the issue
for both? Or is this for some reason restricted to Q?I made a patch to fix both vga and tcx while also unifying the pixel operations, does it fix the blue foot disease on PPC?
Quoted 8 lines
Hm, _with_ this patch I get (on PPC/Linux, emulating LE MIPS):
- a blue-footed penguin when the cirrus FB is started
- blue instead of red colour in console output
- A general blue-to-red inversion for X11 in 16bit mode.Note that the colours for the last one were already not quite right (e.g. grey became a pale blue), but with your patch it looks even weirder.
I haven't been able to test the new patch yet.
Quoted 7 lines
Q's patch and my adaptation for tcx just reversed the order of the colors, just like BlueSwirl's patch except that they used #if
__LITTLE_ENDIAN__in place of #ifdefWORDS_BIGENDIAN, and this worked for both i386 and sparc32 guests on i386 host (but is not applied for ppc host).http://www.kju-app.org/proj/browser/trunk/patches/q_vga.c_02.diff
I think this is not correct either, instead the DisplayState bgr attribute should be used. This version should work like before, and on BGR displays the colours should be correct. VGA needs a similar change for 15 and 16 bit depths if I'm correct.
hw/pixel_ops.h new file +41 -0
@@ -0,0 +1,41 @@ +static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); +} + +static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel15bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel16bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g, +unsigned int b) +{ +return (r <<16 ) | (g <<8 ) | b; +} + +static inline unsigned int rgb_to_pixel32bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return (b <<16 ) | (g <<8 ) | r; +}
hw/tcx.c +13 -24
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "vl.h" +#include "pixel_ops.h" #define MAXX 1024#define MAXY 768
@@ -47,27 +48,6 @@static void tcx_invalidate_display (void *opaque);static void tcx24_invalidate_display (void *opaque); -/* XXX: unify with vga draw line functions */ -static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); -} - -static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g,unsigned b) -{ -return (r <<16 ) | (g <<8 ) | b; -} -static void update_palette_entries (TCXState *s,int start,int end) {int i;
@@ -78,13 +58,22 @@ s->palette[i] =rgb_to_pixel8 (s->r[i], s->g[i], s->b[i]);break ;case 15 : - s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel15bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]);break ;case 16 : - s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel16bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]);break ;case 32 : - s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel32bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]);break ; } }
hw/vga.c +1 -25
@@ -23,6 +23,7 @@*/ #include "vl.h" #include "vga_int.h" +#include "pixel_ops.h" //#define DEBUG_VGA //#define DEBUG_VGA_MEM
@@ -812,31 +813,6 @@typedef void vga_draw_line_func (VGAState *s1,uint8_t *d,const uint8_t *s,int width); -static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); -} - -static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g,unsigned b) -{ -return (r <<16 ) | (g <<8 ) | b; -} - -static inline unsigned int rgb_to_pixel32bgr (unsigned int r,unsigned int g,unsigned b) -{ -return (b <<16 ) | (g <<8 ) | r; -} -#define DEPTH 8#include "vga_template.h"
Makefile.target +4 -0
@@ -592,6 +592,10 @@ signal.o: signal.c $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< +vga.o: pixel_ops.h + +tcx.o: pixel_ops.h + ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h endif
Blue Swirl wrote:
[snip]
Quoted 8 lines
Quoted 8 lines
I haven't been able to test the new patch yet.
Q's patch and my adaptation for tcx just reversed the order of the colors, just like BlueSwirl's patch except that they used #if
__LITTLE_ENDIAN__in place of #ifdefWORDS_BIGENDIAN, and this worked for both i386 and sparc32 guests on i386 host (but is not applied for ppc host).
Quoted 6 lines
I think this is not correct either, instead the DisplayState bgr attribute should be used. This version should work like before, and on BGR displays the colours should be correct. VGA needs a similar change for 15 and 16 bit depths if I'm correct.
This one doesn't change anything for my testcases, so I guess it is ok for me.
Thiemo
Quoted 12 lines · Thiemo Seufer
Blue Swirl wrote:
[snip]Quoted 10 lines
Quoted 9 lines
I haven't been able to test the new patch yet.
Q's patch and my adaptation for tcx just reversed the order of the colors, just like BlueSwirl's patch except that they used #if
__LITTLE_ENDIAN__in place of #ifdefWORDS_BIGENDIAN, and this worked for both i386 and sparc32 guests on i386 host (but is not applied for ppc host).http://www.kju-app.org/proj/browser/trunk/patches/q_vga.c_02.diff
Quoted 7 lines
Quoted 4 lines
I think this is not correct either, instead the DisplayState bgr attribute should be used. This version should work like before, and on BGR displays the colours should be correct. VGA needs a similar change for 15 and 16 bit depths if I'm correct.
This one doesn't change anything for my testcases, so I guess it is ok for me.
Could you test if this version fixes the 16/15 bit PPC host case?
hw/pixel_ops.h new file +41 -0
@@ -0,0 +1,41 @@ +static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); +} + +static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel15bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel16bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g, +unsigned int b) +{ +return (r <<16 ) | (g <<8 ) | b; +} + +static inline unsigned int rgb_to_pixel32bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return (b <<16 ) | (g <<8 ) | r; +}
hw/tcx.c +13 -24
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "vl.h" +#include "pixel_ops.h" #define MAXX 1024#define MAXY 768
@@ -47,27 +48,6 @@static void tcx_invalidate_display (void *opaque);static void tcx24_invalidate_display (void *opaque); -/* XXX: unify with vga draw line functions */ -static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); -} - -static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g,unsigned b) -{ -return (r <<16 ) | (g <<8 ) | b; -} -static void update_palette_entries (TCXState *s,int start,int end) {int i;
@@ -78,13 +58,22 @@ s->palette[i] =rgb_to_pixel8 (s->r[i], s->g[i], s->b[i]);break ;case 15 : - s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel15bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]);break ;case 16 : - s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel16bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]);break ;case 32 : - s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel32bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]);break ; } }
hw/vga.c +64 -28
219 lines not on this page · raw message
Makefile.target +4 -0
@@ -592,6 +592,10 @@ signal.o: signal.c $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< +vga.o: pixel_ops.h + +tcx.o: pixel_ops.h + ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h endif
Quoted 18 lines · Blue Swirl
Quoted 17 lines · Thiemo Seufer
Blue Swirl wrote:
[snip]Quoted 14 lines
Quoted 9 lines
I haven't been able to test the new patch yet.
Q's patch and my adaptation for tcx just reversed the order of the colors, just like BlueSwirl's patch except that they used #if
__LITTLE_ENDIAN__in place of #ifdefWORDS_BIGENDIAN, and this worked for both i386 and sparc32 guests on i386 host (but is not applied for ppc host).http://www.kju-app.org/proj/browser/trunk/patches/q_vga.c_02.diff
I think this is not correct either, instead the DisplayState bgr attribute should be used. This version should work like before, and on BGR displays the colours should be correct. VGA needs a similar change for 15 and 16 bit depths if I'm correct.
Quoted 4 lines
Quoted 2 lines
This one doesn't change anything for my testcases, so I guess it is ok for me.
Could you test if this version fixes the 16/15 bit PPC host case?
Again, no change for me.
Thiemo
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Q's patch and my adaptation for tcx just reversed the order of the colors, just like BlueSwirl's patch except that they used #if
__LITTLE_ENDIAN__in place of #ifdefWORDS_BIGENDIAN, and this worked for both i386 and sparc32 guests on i386 host (but is not applied for ppc host).http://www.kju-app.org/proj/browser/trunk/patches/q_vga.c_02.diff
Quoted 7 lines
Quoted 4 lines
I think this is not correct either, instead the DisplayState bgr attribute should be used. This version should work like before, and on BGR displays the colours should be correct. VGA needs a similar change for 15 and 16 bit depths if I'm correct.
This one doesn't change anything for my testcases, so I guess it is ok for me.
It is not okay. It works on ppc but on Intel applied to 0.9.0 s->ds->bgr does not evaluate to true so OpenBIOS and Tux are blue again... (tested i386 and sparc guests; my console output indicates rgb_to_pixel32 is called for tcx)
Andreas
Quoted 4 lines · Andreas Färber
It is not okay. It works on ppc but on Intel applied to 0.9.0 s->ds-
Quoted 1 line
bgr does not evaluate to true so OpenBIOS and Tux are blue again...
(tested i386 and sparc guests; my console output indicates
rgb_to_pixel32is called for tcx)
Maybe the bgr detection logic in sdl.c is flawed. Is this patch any better?
hw/pixel_ops.h new file +41 -0
@@ -0,0 +1,41 @@ +static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); +} + +static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel15bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel16bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g, +unsigned int b) +{ +return (r <<16 ) | (g <<8 ) | b; +} + +static inline unsigned int rgb_to_pixel32bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return (b <<16 ) | (g <<8 ) | r; +}
hw/tcx.c +13 -24
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "vl.h" +#include "pixel_ops.h" #define MAXX 1024#define MAXY 768
@@ -47,27 +48,6 @@static void tcx_invalidate_display (void *opaque);static void tcx24_invalidate_display (void *opaque); -/* XXX: unify with vga draw line functions */ -static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); -} - -static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g,unsigned b) -{ -return (r <<16 ) | (g <<8 ) | b; -} -static void update_palette_entries (TCXState *s,int start,int end) {int i;
@@ -78,13 +58,22 @@ s->palette[i] =rgb_to_pixel8 (s->r[i], s->g[i], s->b[i]);break ;case 15 : - s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel15bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]);break ;case 16 : - s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel16bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]);break ;case 32 : - s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel32bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]);break ; } }
hw/vga.c +64 -28
219 lines not on this page · raw message
Makefile.target +4 -0
@@ -592,6 +592,10 @@ signal.o: signal.c $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< +vga.o: pixel_ops.h + +tcx.o: pixel_ops.h + ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h endif
sdl.c +1 -1
@@ -87,7 +87,7 @@ ds->data = screen->pixels; ds->linesize = screen->pitch; ds->depth = screen->format->BitsPerPixel; -if (ds->depth ==32 && screen->format->Rshift ==0 ) { +if (screen->format->Bshift > screen->format->Rshift) { ds->bgr =1 ; }else { ds->bgr =0 ;
Quoted 7 lines · Blue Swirl
Quoted 4 lines · Andreas Färber
It is not okay. It works on ppc but on Intel applied to 0.9.0 s->ds-
Quoted 1 line
bgr does not evaluate to true so OpenBIOS and Tux are blue again...
(tested i386 and sparc guests; my console output indicates
rgb_to_pixel32is called for tcx)Maybe the bgr detection logic in
sdl.cis flawed. Is this patch any better?
Except that on OSX the correct place to fix this would be in cocoa.m, right?
Is there some better way to detect BGR than using the host endianness like in this version?
hw/pixel_ops.h new file +41 -0
@@ -0,0 +1,41 @@ +static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); +} + +static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel15bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); +} + +static inline unsigned int rgb_to_pixel16bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return ((b >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (r >>3 ); +} + +static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g, +unsigned int b) +{ +return (r <<16 ) | (g <<8 ) | b; +} + +static inline unsigned int rgb_to_pixel32bgr (unsigned int r,unsigned int g, +unsigned int b) +{ +return (b <<16 ) | (g <<8 ) | r; +}
hw/tcx.c +13 -24
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "vl.h" +#include "pixel_ops.h" #define MAXX 1024#define MAXY 768
@@ -47,27 +48,6 @@static void tcx_invalidate_display (void *opaque);static void tcx24_invalidate_display (void *opaque); -/* XXX: unify with vga draw line functions */ -static inline unsigned int rgb_to_pixel8 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>5 ) <<5 ) | ((g >>5 ) <<2 ) | (b >>6 ); -} - -static inline unsigned int rgb_to_pixel15 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<10 ) | ((g >>3 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel16 (unsigned int r,unsigned int g,unsigned b) -{ -return ((r >>3 ) <<11 ) | ((g >>2 ) <<5 ) | (b >>3 ); -} - -static inline unsigned int rgb_to_pixel32 (unsigned int r,unsigned int g,unsigned b) -{ -return (r <<16 ) | (g <<8 ) | b; -} -static void update_palette_entries (TCXState *s,int start,int end) {int i;
@@ -78,13 +58,22 @@ s->palette[i] =rgb_to_pixel8 (s->r[i], s->g[i], s->b[i]);break ;case 15 : - s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel15bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel15 (s->r[i], s->g[i], s->b[i]);break ;case 16 : - s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel16bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel16 (s->r[i], s->g[i], s->b[i]);break ;case 32 : - s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]); +if (s->ds->bgr) + s->palette[i] =rgb_to_pixel32bgr (s->r[i], s->g[i], s->b[i]); +else + s->palette[i] =rgb_to_pixel32 (s->r[i], s->g[i], s->b[i]);break ; } }
hw/vga.c +64 -28
219 lines not on this page · raw message
Makefile.target +4 -0
@@ -592,6 +592,10 @@ signal.o: signal.c $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $< +vga.o: pixel_ops.h + +tcx.o: pixel_ops.h + ifeq ($(TARGET_BASE_ARCH), i386) op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h endif
sdl.c +1 -1
@@ -87,7 +87,7 @@ ds->data = screen->pixels; ds->linesize = screen->pitch; ds->depth = screen->format->BitsPerPixel; -if (ds->depth ==32 && screen->format->Rshift ==0 ) { +if (screen->format->Bshift > screen->format->Rshift) { ds->bgr =1 ; }else { ds->bgr =0 ;
cocoa.m +6 -1
@@ -164,7 +164,12 @@ ds->depth = device_bpp; ds->width = w; ds->height = h; - +#ifdef __LITTLE_ENDIAN__ + ds->bgr = 1; +#else + ds->bgr = 0; +#endif + current_ds = *ds; }
Am 09.06.2007 um 10:05 schrieb Blue Swirl:
Quoted 3 lines
Quoted 1 line
Maybe the bgr detection logic in
sdl.cis flawed. Is this patch any better?Except that on OSX the correct place to fix this would be in cocoa.m, right?
For qemu yes. Works fine on ppc (and if ds->bgr is manually set to 1, shows the blue-footed penguin on ppc). [If the ds->bgr initialization is omitted it hangs with a black screen and the spinning color wheel. That's strange since bgr == 0 would be okay and any other value should lead to a blue-footed penguin only.]
For Q's interface I derived a patch against host-cocoa/cocoaQemu.m. That works fine on OS X i386 and ppc hosts.
Quoted 2 lines
Is there some better way to detect BGR than using the host endianness like in this version?
I have no idea...
But are you sure that we do not need 8-bit bgr? Q's patch inverted that, too. How would I test that?
Andreas
cocoaQemu.m +7 -0
@@ -1534,6 +1534,13 @@ ds->dpy_update = cocoa_update; ds->dpy_resize = cocoa_resize; ds->dpy_refresh = cocoa_refresh; + +#ifdef __LITTLE_ENDIAN__ + ds->bgr = 1; +#else + ds->bgr = 0; +#endif + cocoa_resize(ds, 640, 400); }
Quoted 6 lines · Andreas Färber
Am 09.06.2007 um 10:05 schrieb Blue Swirl:
Quoted 3 lines
Quoted 2 lines
Maybe the bgr detection logic in
sdl.cis flawed. Is this patch any better?
Quoted 8 lines
Quoted 2 lines
Except that on OSX the correct place to fix this would be in cocoa.m, right?
For qemu yes. Works fine on ppc (and if
ds->bgris manually set to 1, shows the blue-footed penguin on ppc). [If theds->bgrinitialization is omitted it hangs with a black screen and the spinning color wheel. That's strange since bgr == 0 would be okay and any other value should lead to a blue-footed penguin only.]
OK, I'll apply the patch.
Quoted 10 lines
For Q's interface I derived a patch against host-cocoa/cocoaQemu.m. That works fine on OS X i386 and ppc hosts.
Quoted 2 lines
Is there some better way to detect BGR than using the host endianness like in this version?
I have no idea...
But are you sure that we do not need 8-bit bgr? Q's patch inverted that, too. How would I test that?
I think there in 8-bit mode the colours come from the palette indexed by the pixel value, not directly from the pixel value.