Subject: Re: vgahw and so on
To: Matthieu Herrb <matthieu.herrb@laas.fr>
From: Michael <macallan18@earthlink.net>
List: port-macppc
Date: 07/16/2004 14:06:32
Hello,

> XFree86 already provides this level of abstraction, to handle the 
> needed cache flushes (and even the various MMIO base adresses for 
> multiple cards on different busses attached to different host 
> bridges).
Yes, I've seen that but sadly it doesn't always work properly ( or 
vgahw is more broken than I thought )

> See the xf86{Read,Write}Mmio() functions in 
> xc/programs/Xserver/hw/xfree86/common/compiler.h.
Did that. Looks a lot like the stuff in <powerpc/pio.h>

> There is a fundamental problem with PCI/AGP vga cards on powerpc (and 
> PCI based sparc[64] machines too) that XFree86 doesn't solve correctly 
> for now: how to recognize (and handle) a x86 BIOS based card from an 
> OpenFirmware based card. For now, the ati and nv drivers have quite a 
> bit of #ifdef __powerpc__ code that assume that the card uses 
> OpenFirmware.
Yep, the tdfx driver is full of them. Now that it gets past vgahw 
mapping 0xa0000 it fails horribly when trying to change display 
resolution - it can change colour depth but the resolution stays at 
whatever OF set up - I think tdfx has some endianness issues - for 
instance it thinks my 16MB Voodoo3 has 0.09MB texture RAM...
And vgahw can't access the VGA registers even after tdfx enabled them - 
they're neither in their default place ( 0x3cx ) or in the Voodoo3's IO 
block ( currently at 0x2000 )

> In theory you can plug a card using a x86 BIOS as secondary head and 
> get it running in you mac (it could even be the primary head if you 
> use a serial console of some sort for booting). But the current 
> drivers will probably fail to get x86 based cards because of the 
> powerpc specific code there. XFree86 needs a way do detect the kind of 
> BIOS at run-time and adapt the driver at run-time, not at compile 
> time.
Hmm, I didn't see the tdfx driver trying to access the ROM at all, but 
maybe it just escaped my attention. It doesn't complain about anything, 
accelleration seems to work, it just can't program different 
resolutions - for some reason it tries to use the VGA registers for 
that and so far I can't access them.
So - again - to access PCI IO stuff, is the proper way to just pretend 
the IO addresses are memory addresses and mmap(/dev/mem) them? If 
that's true then tdfx just failed to enable the VGA registers - maybe 
an endianness problem. Or are IO addresses mapped somewhere else, 
probably >0x80000000?

have fun
Michael