qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Sparc32 network problems
@ 2007-06-05 22:17 Andreas Färber
  2007-06-06  7:42 ` Nigel Horne
  2007-06-06 12:51 ` Andreas Färber
  0 siblings, 2 replies; 24+ messages in thread
From: Andreas Färber @ 2007-06-05 22:17 UTC (permalink / raw)
  To: qemu-devel

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 (miguel@nuclecu.unam.mx)
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.

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-05 22:17 [Qemu-devel] Sparc32 network problems Andreas Färber
@ 2007-06-06  7:42 ` Nigel Horne
  2007-06-06 12:51 ` Andreas Färber
  1 sibling, 0 replies; 24+ messages in thread
From: Nigel Horne @ 2007-06-06  7:42 UTC (permalink / raw)
  To: qemu-devel

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

Andreas Färber wrote:
> 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


-- 
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, Barnsley, UK.  ICQ#20252325
njh@bandsman.co.uk http://www.bandsman.co.uk

[-- Attachment #2: njh.vcf --]
[-- Type: text/x-vcard, Size: 181 bytes --]

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:njh@bandsman.co.uk
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard


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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-05 22:17 [Qemu-devel] Sparc32 network problems Andreas Färber
  2007-06-06  7:42 ` Nigel Horne
@ 2007-06-06 12:51 ` Andreas Färber
  2007-06-06 18:27   ` Blue Swirl
  1 sibling, 1 reply; 24+ messages in thread
From: Andreas Färber @ 2007-06-06 12:51 UTC (permalink / raw)
  To: qemu-devel


> 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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-06 12:51 ` Andreas Färber
@ 2007-06-06 18:27   ` Blue Swirl
  2007-06-06 18:35     ` Aurelien Jarno
  2007-06-06 20:45     ` Andreas Färber
  0 siblings, 2 replies; 24+ messages in thread
From: Blue Swirl @ 2007-06-06 18:27 UTC (permalink / raw)
  To: qemu-devel, andreas.faerber

On 6/6/07, Andreas Färber <andreas.faerber@web.de> wrote:
>
> > 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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-06 18:27   ` Blue Swirl
@ 2007-06-06 18:35     ` Aurelien Jarno
  2007-06-06 18:52       ` Blue Swirl
  2007-06-06 20:45     ` Andreas Färber
  1 sibling, 1 reply; 24+ messages in thread
From: Aurelien Jarno @ 2007-06-06 18:35 UTC (permalink / raw)
  To: qemu-devel

Blue Swirl a écrit :
> On 6/6/07, Andreas Färber <andreas.faerber@web.de> wrote:
>>> 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.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-06 18:35     ` Aurelien Jarno
@ 2007-06-06 18:52       ` Blue Swirl
  0 siblings, 0 replies; 24+ messages in thread
From: Blue Swirl @ 2007-06-06 18:52 UTC (permalink / raw)
  To: qemu-devel

On 6/6/07, Aurelien Jarno <aurelien@aurel32.net> wrote:
> Blue Swirl a écrit :
> > On 6/6/07, Andreas Färber <andreas.faerber@web.de> wrote:
> >>> 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.

I still get the same kernel panic message after loading 7% of
additional components.

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-06 18:27   ` Blue Swirl
  2007-06-06 18:35     ` Aurelien Jarno
@ 2007-06-06 20:45     ` Andreas Färber
  2007-06-07 11:47       ` Andreas Färber
  2007-06-07 19:59       ` Blue Swirl
  1 sibling, 2 replies; 24+ messages in thread
From: Andreas Färber @ 2007-06-06 20:45 UTC (permalink / raw)
  To: qemu-devel

Hi,

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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-06 20:45     ` Andreas Färber
@ 2007-06-07 11:47       ` Andreas Färber
  2007-06-09 12:13         ` Andreas Färber
  2007-06-07 19:59       ` Blue Swirl
  1 sibling, 1 reply; 24+ messages in thread
From: Andreas Färber @ 2007-06-07 11:47 UTC (permalink / raw)
  To: qemu-devel


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

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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-06 20:45     ` Andreas Färber
  2007-06-07 11:47       ` Andreas Färber
@ 2007-06-07 19:59       ` Blue Swirl
  2007-06-07 21:04         ` Thiemo Seufer
  1 sibling, 1 reply; 24+ messages in thread
From: Blue Swirl @ 2007-06-07 19:59 UTC (permalink / raw)
  To: qemu-devel, andreas.faerber

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

On 6/6/07, Andreas Färber <andreas.faerber@web.de> wrote:
> 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?

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?

[-- Attachment #2: big_endian_display.diff --]
[-- Type: text/x-diff, Size: 4560 bytes --]

Index: qemu/hw/pixel_ops.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu/hw/pixel_ops.h	2007-06-07 19:45:57.000000000 +0000
@@ -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
+}
Index: qemu/hw/tcx.c
===================================================================
--- qemu.orig/hw/tcx.c	2007-06-07 19:35:27.000000000 +0000
+++ qemu/hw/tcx.c	2007-06-07 19:38:28.000000000 +0000
@@ -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;
Index: qemu/hw/vga.c
===================================================================
--- qemu.orig/hw/vga.c	2007-06-07 19:36:38.000000000 +0000
+++ qemu/hw/vga.c	2007-06-07 19:41:42.000000000 +0000
@@ -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"
 
Index: qemu/Makefile.target
===================================================================
--- qemu.orig/Makefile.target	2007-06-07 19:47:46.000000000 +0000
+++ qemu/Makefile.target	2007-06-07 19:50:35.000000000 +0000
@@ -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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-07 19:59       ` Blue Swirl
@ 2007-06-07 21:04         ` Thiemo Seufer
  2007-06-07 21:41           ` Andreas Färber
  0 siblings, 1 reply; 24+ messages in thread
From: Thiemo Seufer @ 2007-06-07 21:04 UTC (permalink / raw)
  To: Blue Swirl; +Cc: andreas.faerber, qemu-devel

Blue Swirl wrote:
> On 6/6/07, Andreas Färber <andreas.faerber@web.de> wrote:
> >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?
> 
> 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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-07 21:04         ` Thiemo Seufer
@ 2007-06-07 21:41           ` Andreas Färber
  2007-06-08 16:25             ` Blue Swirl
  0 siblings, 1 reply; 24+ messages in thread
From: Andreas Färber @ 2007-06-07 21:41 UTC (permalink / raw)
  To: qemu-devel


> Blue Swirl wrote:
>> On 6/6/07, Andreas Färber <andreas.faerber@web.de> wrote:
>>> 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?
>>
>> 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.

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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-07 21:41           ` Andreas Färber
@ 2007-06-08 16:25             ` Blue Swirl
  2007-06-08 18:35               ` Thiemo Seufer
  0 siblings, 1 reply; 24+ messages in thread
From: Blue Swirl @ 2007-06-08 16:25 UTC (permalink / raw)
  To: qemu-devel

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

On 6/8/07, Andreas Färber <andreas.faerber@web.de> wrote:
>
> > Blue Swirl wrote:
> >> On 6/6/07, Andreas Färber <andreas.faerber@web.de> wrote:
> >>> 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?
> >>
> >> 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.
>
> 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

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.

[-- Attachment #2: big_endian_display.diff --]
[-- Type: text/x-diff, Size: 5592 bytes --]

Index: qemu/hw/pixel_ops.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu/hw/pixel_ops.h	2007-06-08 16:08:58.000000000 +0000
@@ -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;
+}
Index: qemu/hw/tcx.c
===================================================================
--- qemu.orig/hw/tcx.c	2007-06-07 19:35:27.000000000 +0000
+++ qemu/hw/tcx.c	2007-06-08 16:09:03.000000000 +0000
@@ -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;
         }
     }
Index: qemu/hw/vga.c
===================================================================
--- qemu.orig/hw/vga.c	2007-06-07 19:36:38.000000000 +0000
+++ qemu/hw/vga.c	2007-06-08 16:17:02.000000000 +0000
@@ -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"
 
Index: qemu/Makefile.target
===================================================================
--- qemu.orig/Makefile.target	2007-06-07 19:47:46.000000000 +0000
+++ qemu/Makefile.target	2007-06-07 19:50:35.000000000 +0000
@@ -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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-08 16:25             ` Blue Swirl
@ 2007-06-08 18:35               ` Thiemo Seufer
  2007-06-08 19:04                 ` Blue Swirl
  2007-06-08 20:44                 ` Andreas Färber
  0 siblings, 2 replies; 24+ messages in thread
From: Thiemo Seufer @ 2007-06-08 18:35 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

Blue Swirl wrote:
[snip]
> >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
> 
> 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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-08 18:35               ` Thiemo Seufer
@ 2007-06-08 19:04                 ` Blue Swirl
  2007-06-09 14:48                   ` Thiemo Seufer
  2007-06-08 20:44                 ` Andreas Färber
  1 sibling, 1 reply; 24+ messages in thread
From: Blue Swirl @ 2007-06-08 19:04 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: qemu-devel

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

On 6/8/07, Thiemo Seufer <ths@networkno.de> wrote:
> Blue Swirl wrote:
> [snip]
> > >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
> >
> > 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?

[-- Attachment #2: big_endian_display2.diff --]
[-- Type: text/x-diff, Size: 9821 bytes --]

Index: qemu/hw/pixel_ops.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu/hw/pixel_ops.h	2007-06-08 17:09:59.000000000 +0000
@@ -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;
+}
Index: qemu/hw/tcx.c
===================================================================
--- qemu.orig/hw/tcx.c	2007-06-08 16:40:44.000000000 +0000
+++ qemu/hw/tcx.c	2007-06-08 17:09:59.000000000 +0000
@@ -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;
         }
     }
Index: qemu/hw/vga.c
===================================================================
--- qemu.orig/hw/vga.c	2007-06-08 16:40:44.000000000 +0000
+++ qemu/hw/vga.c	2007-06-08 18:56:32.000000000 +0000
@@ -23,6 +23,7 @@
  */
 #include "vl.h"
 #include "vga_int.h"
+#include "pixel_ops.h"
 
 //#define DEBUG_VGA
 //#define DEBUG_VGA_MEM
@@ -812,37 +813,20 @@
 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"
 
 #define DEPTH 15
 #include "vga_template.h"
 
+#define BGR_FORMAT
+#define DEPTH 15
+#include "vga_template.h"
+
+#define DEPTH 16
+#include "vga_template.h"
+
+#define BGR_FORMAT
 #define DEPTH 16
 #include "vga_template.h"
 
@@ -870,6 +854,15 @@
     return col;
 }
 
+static unsigned int rgb_to_pixel15bgr_dup(unsigned int r, unsigned int g,
+                                          unsigned int b)
+{
+    unsigned int col;
+    col = rgb_to_pixel15bgr(r, g, b);
+    col |= col << 16;
+    return col;
+}
+
 static unsigned int rgb_to_pixel16_dup(unsigned int r, unsigned int g, unsigned b)
 {
     unsigned int col;
@@ -878,6 +871,15 @@
     return col;
 }
 
+static unsigned int rgb_to_pixel16bgr_dup(unsigned int r, unsigned int g,
+                                          unsigned int b)
+{
+    unsigned int col;
+    col = rgb_to_pixel16bgr(r, g, b);
+    col |= col << 16;
+    return col;
+}
+
 static unsigned int rgb_to_pixel32_dup(unsigned int r, unsigned int g, unsigned b)
 {
     unsigned int col;
@@ -998,7 +1000,7 @@
     return full_update;
 }
 
-#define NB_DEPTHS 5
+#define NB_DEPTHS 7
 
 static inline int get_depth_index(DisplayState *s)
 {
@@ -1007,9 +1009,15 @@
     case 8:
         return 0;
     case 15:
-        return 1;
+        if (s->bgr)
+            return 5;
+        else
+            return 1;
     case 16:
-        return 2;
+        if (s->bgr)
+            return 6;
+        else
+            return 2;
     case 32:
         if (s->bgr)
             return 4;
@@ -1024,6 +1032,8 @@
     vga_draw_glyph8_16,
     vga_draw_glyph8_32,
     vga_draw_glyph8_32,
+    vga_draw_glyph8_16,
+    vga_draw_glyph8_16,
 };
 
 static vga_draw_glyph8_func *vga_draw_glyph16_table[NB_DEPTHS] = {
@@ -1032,6 +1042,8 @@
     vga_draw_glyph16_16,
     vga_draw_glyph16_32,
     vga_draw_glyph16_32,
+    vga_draw_glyph16_16,
+    vga_draw_glyph16_16,
 };
 
 static vga_draw_glyph9_func *vga_draw_glyph9_table[NB_DEPTHS] = {
@@ -1040,6 +1052,8 @@
     vga_draw_glyph9_16,
     vga_draw_glyph9_32,
     vga_draw_glyph9_32,
+    vga_draw_glyph9_16,
+    vga_draw_glyph9_16,
 };
     
 static const uint8_t cursor_glyph[32 * 4] = {
@@ -1260,60 +1274,80 @@
     vga_draw_line2_16,
     vga_draw_line2_32,
     vga_draw_line2_32,
+    vga_draw_line2_16,
+    vga_draw_line2_16,
 
     vga_draw_line2d2_8,
     vga_draw_line2d2_16,
     vga_draw_line2d2_16,
     vga_draw_line2d2_32,
     vga_draw_line2d2_32,
+    vga_draw_line2d2_16,
+    vga_draw_line2d2_16,
 
     vga_draw_line4_8,
     vga_draw_line4_16,
     vga_draw_line4_16,
     vga_draw_line4_32,
     vga_draw_line4_32,
+    vga_draw_line4_16,
+    vga_draw_line4_16,
 
     vga_draw_line4d2_8,
     vga_draw_line4d2_16,
     vga_draw_line4d2_16,
     vga_draw_line4d2_32,
     vga_draw_line4d2_32,
+    vga_draw_line4d2_16,
+    vga_draw_line4d2_16,
 
     vga_draw_line8d2_8,
     vga_draw_line8d2_16,
     vga_draw_line8d2_16,
     vga_draw_line8d2_32,
     vga_draw_line8d2_32,
+    vga_draw_line8d2_16,
+    vga_draw_line8d2_16,
 
     vga_draw_line8_8,
     vga_draw_line8_16,
     vga_draw_line8_16,
     vga_draw_line8_32,
     vga_draw_line8_32,
+    vga_draw_line8_16,
+    vga_draw_line8_16,
 
     vga_draw_line15_8,
     vga_draw_line15_15,
     vga_draw_line15_16,
     vga_draw_line15_32,
     vga_draw_line15_32bgr,
+    vga_draw_line15_15bgr,
+    vga_draw_line15_16bgr,
 
     vga_draw_line16_8,
     vga_draw_line16_15,
     vga_draw_line16_16,
     vga_draw_line16_32,
     vga_draw_line16_32bgr,
+    vga_draw_line16_15bgr,
+    vga_draw_line16_16bgr,
 
     vga_draw_line24_8,
     vga_draw_line24_15,
     vga_draw_line24_16,
     vga_draw_line24_32,
     vga_draw_line24_32bgr,
+    vga_draw_line24_15bgr,
+    vga_draw_line24_16bgr,
 
     vga_draw_line32_8,
     vga_draw_line32_15,
     vga_draw_line32_16,
     vga_draw_line32_32,
     vga_draw_line32_32bgr,
+    vga_draw_line32_15bgr,
+    vga_draw_line32_16bgr,
 };
 
 typedef unsigned int rgb_to_pixel_dup_func(unsigned int r, unsigned int g, unsigned b);
@@ -1324,6 +1358,8 @@
     rgb_to_pixel16_dup,
     rgb_to_pixel32_dup,
     rgb_to_pixel32bgr_dup,
+    rgb_to_pixel15bgr_dup,
+    rgb_to_pixel16bgr_dup,
 };
 
 static int vga_get_bpp(VGAState *s)
Index: qemu/Makefile.target
===================================================================
--- qemu.orig/Makefile.target	2007-06-08 16:40:44.000000000 +0000
+++ qemu/Makefile.target	2007-06-08 17:09:59.000000000 +0000
@@ -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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-08 18:35               ` Thiemo Seufer
  2007-06-08 19:04                 ` Blue Swirl
@ 2007-06-08 20:44                 ` Andreas Färber
  2007-06-09  7:05                   ` Blue Swirl
  1 sibling, 1 reply; 24+ messages in thread
From: Andreas Färber @ 2007-06-08 20:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl


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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-08 20:44                 ` Andreas Färber
@ 2007-06-09  7:05                   ` Blue Swirl
  2007-06-09  8:05                     ` Blue Swirl
  0 siblings, 1 reply; 24+ messages in thread
From: Blue Swirl @ 2007-06-09  7:05 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel

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

On 6/8/07, Andreas Färber <andreas.faerber@web.de> wrote:
> 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)

Maybe the bgr detection logic in sdl.c is flawed. Is this patch any better?

[-- Attachment #2: big_endian_display3.diff --]
[-- Type: text/x-diff, Size: 10323 bytes --]

Index: qemu/hw/pixel_ops.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu/hw/pixel_ops.h	2007-06-08 17:09:59.000000000 +0000
@@ -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;
+}
Index: qemu/hw/tcx.c
===================================================================
--- qemu.orig/hw/tcx.c	2007-06-08 16:40:44.000000000 +0000
+++ qemu/hw/tcx.c	2007-06-08 17:09:59.000000000 +0000
@@ -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;
         }
     }
Index: qemu/hw/vga.c
===================================================================
--- qemu.orig/hw/vga.c	2007-06-08 16:40:44.000000000 +0000
+++ qemu/hw/vga.c	2007-06-08 18:56:32.000000000 +0000
@@ -23,6 +23,7 @@
  */
 #include "vl.h"
 #include "vga_int.h"
+#include "pixel_ops.h"
 
 //#define DEBUG_VGA
 //#define DEBUG_VGA_MEM
@@ -812,37 +813,20 @@
 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"
 
 #define DEPTH 15
 #include "vga_template.h"
 
+#define BGR_FORMAT
+#define DEPTH 15
+#include "vga_template.h"
+
+#define DEPTH 16
+#include "vga_template.h"
+
+#define BGR_FORMAT
 #define DEPTH 16
 #include "vga_template.h"
 
@@ -870,6 +854,15 @@
     return col;
 }
 
+static unsigned int rgb_to_pixel15bgr_dup(unsigned int r, unsigned int g,
+                                          unsigned int b)
+{
+    unsigned int col;
+    col = rgb_to_pixel15bgr(r, g, b);
+    col |= col << 16;
+    return col;
+}
+
 static unsigned int rgb_to_pixel16_dup(unsigned int r, unsigned int g, unsigned b)
 {
     unsigned int col;
@@ -878,6 +871,15 @@
     return col;
 }
 
+static unsigned int rgb_to_pixel16bgr_dup(unsigned int r, unsigned int g,
+                                          unsigned int b)
+{
+    unsigned int col;
+    col = rgb_to_pixel16bgr(r, g, b);
+    col |= col << 16;
+    return col;
+}
+
 static unsigned int rgb_to_pixel32_dup(unsigned int r, unsigned int g, unsigned b)
 {
     unsigned int col;
@@ -998,7 +1000,7 @@
     return full_update;
 }
 
-#define NB_DEPTHS 5
+#define NB_DEPTHS 7
 
 static inline int get_depth_index(DisplayState *s)
 {
@@ -1007,9 +1009,15 @@
     case 8:
         return 0;
     case 15:
-        return 1;
+        if (s->bgr)
+            return 5;
+        else
+            return 1;
     case 16:
-        return 2;
+        if (s->bgr)
+            return 6;
+        else
+            return 2;
     case 32:
         if (s->bgr)
             return 4;
@@ -1024,6 +1032,8 @@
     vga_draw_glyph8_16,
     vga_draw_glyph8_32,
     vga_draw_glyph8_32,
+    vga_draw_glyph8_16,
+    vga_draw_glyph8_16,
 };
 
 static vga_draw_glyph8_func *vga_draw_glyph16_table[NB_DEPTHS] = {
@@ -1032,6 +1042,8 @@
     vga_draw_glyph16_16,
     vga_draw_glyph16_32,
     vga_draw_glyph16_32,
+    vga_draw_glyph16_16,
+    vga_draw_glyph16_16,
 };
 
 static vga_draw_glyph9_func *vga_draw_glyph9_table[NB_DEPTHS] = {
@@ -1040,6 +1052,8 @@
     vga_draw_glyph9_16,
     vga_draw_glyph9_32,
     vga_draw_glyph9_32,
+    vga_draw_glyph9_16,
+    vga_draw_glyph9_16,
 };
     
 static const uint8_t cursor_glyph[32 * 4] = {
@@ -1260,60 +1274,80 @@
     vga_draw_line2_16,
     vga_draw_line2_32,
     vga_draw_line2_32,
+    vga_draw_line2_16,
+    vga_draw_line2_16,
 
     vga_draw_line2d2_8,
     vga_draw_line2d2_16,
     vga_draw_line2d2_16,
     vga_draw_line2d2_32,
     vga_draw_line2d2_32,
+    vga_draw_line2d2_16,
+    vga_draw_line2d2_16,
 
     vga_draw_line4_8,
     vga_draw_line4_16,
     vga_draw_line4_16,
     vga_draw_line4_32,
     vga_draw_line4_32,
+    vga_draw_line4_16,
+    vga_draw_line4_16,
 
     vga_draw_line4d2_8,
     vga_draw_line4d2_16,
     vga_draw_line4d2_16,
     vga_draw_line4d2_32,
     vga_draw_line4d2_32,
+    vga_draw_line4d2_16,
+    vga_draw_line4d2_16,
 
     vga_draw_line8d2_8,
     vga_draw_line8d2_16,
     vga_draw_line8d2_16,
     vga_draw_line8d2_32,
     vga_draw_line8d2_32,
+    vga_draw_line8d2_16,
+    vga_draw_line8d2_16,
 
     vga_draw_line8_8,
     vga_draw_line8_16,
     vga_draw_line8_16,
     vga_draw_line8_32,
     vga_draw_line8_32,
+    vga_draw_line8_16,
+    vga_draw_line8_16,
 
     vga_draw_line15_8,
     vga_draw_line15_15,
     vga_draw_line15_16,
     vga_draw_line15_32,
     vga_draw_line15_32bgr,
+    vga_draw_line15_15bgr,
+    vga_draw_line15_16bgr,
 
     vga_draw_line16_8,
     vga_draw_line16_15,
     vga_draw_line16_16,
     vga_draw_line16_32,
     vga_draw_line16_32bgr,
+    vga_draw_line16_15bgr,
+    vga_draw_line16_16bgr,
 
     vga_draw_line24_8,
     vga_draw_line24_15,
     vga_draw_line24_16,
     vga_draw_line24_32,
     vga_draw_line24_32bgr,
+    vga_draw_line24_15bgr,
+    vga_draw_line24_16bgr,
 
     vga_draw_line32_8,
     vga_draw_line32_15,
     vga_draw_line32_16,
     vga_draw_line32_32,
     vga_draw_line32_32bgr,
+    vga_draw_line32_15bgr,
+    vga_draw_line32_16bgr,
 };
 
 typedef unsigned int rgb_to_pixel_dup_func(unsigned int r, unsigned int g, unsigned b);
@@ -1324,6 +1358,8 @@
     rgb_to_pixel16_dup,
     rgb_to_pixel32_dup,
     rgb_to_pixel32bgr_dup,
+    rgb_to_pixel15bgr_dup,
+    rgb_to_pixel16bgr_dup,
 };
 
 static int vga_get_bpp(VGAState *s)
Index: qemu/Makefile.target
===================================================================
--- qemu.orig/Makefile.target	2007-06-08 16:40:44.000000000 +0000
+++ qemu/Makefile.target	2007-06-08 17:09:59.000000000 +0000
@@ -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
Index: qemu/sdl.c
===================================================================
--- qemu.orig/sdl.c	2007-06-09 06:44:06.000000000 +0000
+++ qemu/sdl.c	2007-06-09 06:52:18.000000000 +0000
@@ -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;

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-09  7:05                   ` Blue Swirl
@ 2007-06-09  8:05                     ` Blue Swirl
  2007-06-09 10:30                       ` Andreas Färber
  0 siblings, 1 reply; 24+ messages in thread
From: Blue Swirl @ 2007-06-09  8:05 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel

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

On 6/9/07, Blue Swirl <blauwirbel@gmail.com> wrote:
> On 6/8/07, Andreas Färber <andreas.faerber@web.de> wrote:
> > 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)
>
> Maybe the bgr detection logic in sdl.c is 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?

[-- Attachment #2: big_endian_display4.diff --]
[-- Type: text/x-diff, Size: 10726 bytes --]

Index: qemu/hw/pixel_ops.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu/hw/pixel_ops.h	2007-06-08 17:09:59.000000000 +0000
@@ -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;
+}
Index: qemu/hw/tcx.c
===================================================================
--- qemu.orig/hw/tcx.c	2007-06-08 16:40:44.000000000 +0000
+++ qemu/hw/tcx.c	2007-06-08 17:09:59.000000000 +0000
@@ -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;
         }
     }
Index: qemu/hw/vga.c
===================================================================
--- qemu.orig/hw/vga.c	2007-06-08 16:40:44.000000000 +0000
+++ qemu/hw/vga.c	2007-06-08 18:56:32.000000000 +0000
@@ -23,6 +23,7 @@
  */
 #include "vl.h"
 #include "vga_int.h"
+#include "pixel_ops.h"
 
 //#define DEBUG_VGA
 //#define DEBUG_VGA_MEM
@@ -812,37 +813,20 @@
 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"
 
 #define DEPTH 15
 #include "vga_template.h"
 
+#define BGR_FORMAT
+#define DEPTH 15
+#include "vga_template.h"
+
+#define DEPTH 16
+#include "vga_template.h"
+
+#define BGR_FORMAT
 #define DEPTH 16
 #include "vga_template.h"
 
@@ -870,6 +854,15 @@
     return col;
 }
 
+static unsigned int rgb_to_pixel15bgr_dup(unsigned int r, unsigned int g,
+                                          unsigned int b)
+{
+    unsigned int col;
+    col = rgb_to_pixel15bgr(r, g, b);
+    col |= col << 16;
+    return col;
+}
+
 static unsigned int rgb_to_pixel16_dup(unsigned int r, unsigned int g, unsigned b)
 {
     unsigned int col;
@@ -878,6 +871,15 @@
     return col;
 }
 
+static unsigned int rgb_to_pixel16bgr_dup(unsigned int r, unsigned int g,
+                                          unsigned int b)
+{
+    unsigned int col;
+    col = rgb_to_pixel16bgr(r, g, b);
+    col |= col << 16;
+    return col;
+}
+
 static unsigned int rgb_to_pixel32_dup(unsigned int r, unsigned int g, unsigned b)
 {
     unsigned int col;
@@ -998,7 +1000,7 @@
     return full_update;
 }
 
-#define NB_DEPTHS 5
+#define NB_DEPTHS 7
 
 static inline int get_depth_index(DisplayState *s)
 {
@@ -1007,9 +1009,15 @@
     case 8:
         return 0;
     case 15:
-        return 1;
+        if (s->bgr)
+            return 5;
+        else
+            return 1;
     case 16:
-        return 2;
+        if (s->bgr)
+            return 6;
+        else
+            return 2;
     case 32:
         if (s->bgr)
             return 4;
@@ -1024,6 +1032,8 @@
     vga_draw_glyph8_16,
     vga_draw_glyph8_32,
     vga_draw_glyph8_32,
+    vga_draw_glyph8_16,
+    vga_draw_glyph8_16,
 };
 
 static vga_draw_glyph8_func *vga_draw_glyph16_table[NB_DEPTHS] = {
@@ -1032,6 +1042,8 @@
     vga_draw_glyph16_16,
     vga_draw_glyph16_32,
     vga_draw_glyph16_32,
+    vga_draw_glyph16_16,
+    vga_draw_glyph16_16,
 };
 
 static vga_draw_glyph9_func *vga_draw_glyph9_table[NB_DEPTHS] = {
@@ -1040,6 +1052,8 @@
     vga_draw_glyph9_16,
     vga_draw_glyph9_32,
     vga_draw_glyph9_32,
+    vga_draw_glyph9_16,
+    vga_draw_glyph9_16,
 };
     
 static const uint8_t cursor_glyph[32 * 4] = {
@@ -1260,60 +1274,80 @@
     vga_draw_line2_16,
     vga_draw_line2_32,
     vga_draw_line2_32,
+    vga_draw_line2_16,
+    vga_draw_line2_16,
 
     vga_draw_line2d2_8,
     vga_draw_line2d2_16,
     vga_draw_line2d2_16,
     vga_draw_line2d2_32,
     vga_draw_line2d2_32,
+    vga_draw_line2d2_16,
+    vga_draw_line2d2_16,
 
     vga_draw_line4_8,
     vga_draw_line4_16,
     vga_draw_line4_16,
     vga_draw_line4_32,
     vga_draw_line4_32,
+    vga_draw_line4_16,
+    vga_draw_line4_16,
 
     vga_draw_line4d2_8,
     vga_draw_line4d2_16,
     vga_draw_line4d2_16,
     vga_draw_line4d2_32,
     vga_draw_line4d2_32,
+    vga_draw_line4d2_16,
+    vga_draw_line4d2_16,
 
     vga_draw_line8d2_8,
     vga_draw_line8d2_16,
     vga_draw_line8d2_16,
     vga_draw_line8d2_32,
     vga_draw_line8d2_32,
+    vga_draw_line8d2_16,
+    vga_draw_line8d2_16,
 
     vga_draw_line8_8,
     vga_draw_line8_16,
     vga_draw_line8_16,
     vga_draw_line8_32,
     vga_draw_line8_32,
+    vga_draw_line8_16,
+    vga_draw_line8_16,
 
     vga_draw_line15_8,
     vga_draw_line15_15,
     vga_draw_line15_16,
     vga_draw_line15_32,
     vga_draw_line15_32bgr,
+    vga_draw_line15_15bgr,
+    vga_draw_line15_16bgr,
 
     vga_draw_line16_8,
     vga_draw_line16_15,
     vga_draw_line16_16,
     vga_draw_line16_32,
     vga_draw_line16_32bgr,
+    vga_draw_line16_15bgr,
+    vga_draw_line16_16bgr,
 
     vga_draw_line24_8,
     vga_draw_line24_15,
     vga_draw_line24_16,
     vga_draw_line24_32,
     vga_draw_line24_32bgr,
+    vga_draw_line24_15bgr,
+    vga_draw_line24_16bgr,
 
     vga_draw_line32_8,
     vga_draw_line32_15,
     vga_draw_line32_16,
     vga_draw_line32_32,
     vga_draw_line32_32bgr,
+    vga_draw_line32_15bgr,
+    vga_draw_line32_16bgr,
 };
 
 typedef unsigned int rgb_to_pixel_dup_func(unsigned int r, unsigned int g, unsigned b);
@@ -1324,6 +1358,8 @@
     rgb_to_pixel16_dup,
     rgb_to_pixel32_dup,
     rgb_to_pixel32bgr_dup,
+    rgb_to_pixel15bgr_dup,
+    rgb_to_pixel16bgr_dup,
 };
 
 static int vga_get_bpp(VGAState *s)
Index: qemu/Makefile.target
===================================================================
--- qemu.orig/Makefile.target	2007-06-08 16:40:44.000000000 +0000
+++ qemu/Makefile.target	2007-06-08 17:09:59.000000000 +0000
@@ -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
Index: qemu/sdl.c
===================================================================
--- qemu.orig/sdl.c	2007-06-09 06:44:06.000000000 +0000
+++ qemu/sdl.c	2007-06-09 06:52:18.000000000 +0000
@@ -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;
Index: qemu/cocoa.m
===================================================================
--- qemu.orig/cocoa.m	2007-06-09 07:56:04.000000000 +0000
+++ qemu/cocoa.m	2007-06-09 07:57:18.000000000 +0000
@@ -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;
 }
 

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-09  8:05                     ` Blue Swirl
@ 2007-06-09 10:30                       ` Andreas Färber
  2007-06-10 15:40                         ` Blue Swirl
  0 siblings, 1 reply; 24+ messages in thread
From: Andreas Färber @ 2007-06-09 10:30 UTC (permalink / raw)
  To: qemu-devel

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


Am 09.06.2007 um 10:05 schrieb Blue Swirl:

>> Maybe the bgr detection logic in sdl.c is 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.

> 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

[-- Attachment #2: Q_bgr.diff --]
[-- Type: application/octet-stream, Size: 417 bytes --]

Index: host-cocoa/cocoaQemu.m
===================================================================
--- host-cocoa/cocoaQemu.m	(revision 89)
+++ host-cocoa/cocoaQemu.m	(working copy)
@@ -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);
 }
 

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-07 11:47       ` Andreas Färber
@ 2007-06-09 12:13         ` Andreas Färber
  2007-06-10 15:49           ` Blue Swirl
  0 siblings, 1 reply; 24+ messages in thread
From: Andreas Färber @ 2007-06-09 12:13 UTC (permalink / raw)
  To: qemu-devel


Am 07.06.2007 um 13:47 schrieb Andreas Färber:

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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-08 19:04                 ` Blue Swirl
@ 2007-06-09 14:48                   ` Thiemo Seufer
  0 siblings, 0 replies; 24+ messages in thread
From: Thiemo Seufer @ 2007-06-09 14:48 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

Blue Swirl wrote:
> On 6/8/07, Thiemo Seufer <ths@networkno.de> wrote:
> >Blue Swirl wrote:
> >[snip]
> >> >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
> >>
> >> 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?

Again, no change for me.


Thiemo

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-09 10:30                       ` Andreas Färber
@ 2007-06-10 15:40                         ` Blue Swirl
  0 siblings, 0 replies; 24+ messages in thread
From: Blue Swirl @ 2007-06-10 15:40 UTC (permalink / raw)
  To: qemu-devel

On 6/9/07, Andreas Färber <andreas.faerber@web.de> wrote:
>
> Am 09.06.2007 um 10:05 schrieb Blue Swirl:
>
> >> Maybe the bgr detection logic in sdl.c is 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.]

OK, I'll apply the patch.

> For Q's interface I derived a patch against host-cocoa/cocoaQemu.m.
> That works fine on OS X i386 and ppc hosts.
>
> > 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.

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-09 12:13         ` Andreas Färber
@ 2007-06-10 15:49           ` Blue Swirl
  2007-06-10 16:26             ` Andreas Färber
  0 siblings, 1 reply; 24+ messages in thread
From: Blue Swirl @ 2007-06-10 15:49 UTC (permalink / raw)
  To: qemu-devel

On 6/9/07, Andreas Färber <andreas.faerber@web.de> wrote:
> 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.

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-10 15:49           ` Blue Swirl
@ 2007-06-10 16:26             ` Andreas Färber
  2007-06-10 16:44               ` Blue Swirl
  0 siblings, 1 reply; 24+ messages in thread
From: Andreas Färber @ 2007-06-10 16:26 UTC (permalink / raw)
  To: qemu-devel


Am 10.06.2007 um 17:49 schrieb Blue Swirl:

> On 6/9/07, Andreas Färber <andreas.faerber@web.de> wrote:
>> 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?

> 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

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

* Re: [Qemu-devel] Sparc32 network problems
  2007-06-10 16:26             ` Andreas Färber
@ 2007-06-10 16:44               ` Blue Swirl
  0 siblings, 0 replies; 24+ messages in thread
From: Blue Swirl @ 2007-06-10 16:44 UTC (permalink / raw)
  To: qemu-devel

On 6/10/07, Andreas Färber <andreas.faerber@web.de> wrote:
>
> Am 10.06.2007 um 17:49 schrieb Blue Swirl:
>
> > On 6/9/07, Andreas Färber <andreas.faerber@web.de> wrote:
> >> 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?

No, my understanding is that TCX doesn't have those modes at all.

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

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

end of thread, other threads:[~2007-06-10 16:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05 22:17 [Qemu-devel] Sparc32 network problems Andreas Färber
2007-06-06  7:42 ` Nigel Horne
2007-06-06 12:51 ` Andreas Färber
2007-06-06 18:27   ` Blue Swirl
2007-06-06 18:35     ` Aurelien Jarno
2007-06-06 18:52       ` Blue Swirl
2007-06-06 20:45     ` Andreas Färber
2007-06-07 11:47       ` Andreas Färber
2007-06-09 12:13         ` Andreas Färber
2007-06-10 15:49           ` Blue Swirl
2007-06-10 16:26             ` Andreas Färber
2007-06-10 16:44               ` Blue Swirl
2007-06-07 19:59       ` Blue Swirl
2007-06-07 21:04         ` Thiemo Seufer
2007-06-07 21:41           ` Andreas Färber
2007-06-08 16:25             ` Blue Swirl
2007-06-08 18:35               ` Thiemo Seufer
2007-06-08 19:04                 ` Blue Swirl
2007-06-09 14:48                   ` Thiemo Seufer
2007-06-08 20:44                 ` Andreas Färber
2007-06-09  7:05                   ` Blue Swirl
2007-06-09  8:05                     ` Blue Swirl
2007-06-09 10:30                       ` Andreas Färber
2007-06-10 15:40                         ` Blue Swirl

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