Subject: XFree86 and macppc
To: None <tech-x11@netbsd.org>
From: Michael <macallan18@earthlink.net>
List: tech-x11
Date: 12/03/2004 16:43:41
This is a multi-part message in MIME format.

--Multipart=_Fri__3_Dec_2004_16_43_41_-0500_96_BIihbs9H1i9Ds
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello,

a lot of VGA-compatible graphics cards don't currently work on NetBSD/macppc with XFree86 ( Matrox, 3Dfx and others for instance ) even when they work as console. The reasons are silly PCish assumptions in XFree and problems accessing PCI IO space.
Lots of XFree drivers use the vgahw module to save/restore the state of the console. This includes the VGA framebuffer and registers.
XFree accesses the graphics card through the console device ( it opens /dev/ttyE0 ) by mmap()ing the framebuffer and memory-mapped registers. That's not quite enough because there's currently no way for XFree to access IO registers. All PCI Macs have host bridges which can generate IO cycles, they just map IO space into memory, but to make things complicated - every bridge has its own range and lots of Macs have more than one PCI bus. To get around this I suggest the following changes:
- add some code to ofb which maps the correct IO range into user space - for instance when a user process wants to mmap 0xf0000000 ofb should map the address range corresponding to the graphics device it's sitting on, like 0xf0000000 for a G4's AGP slot, 0xf2000000 for the first bandit or UniNorth, 0xf4000000 for 2nd bandit and so on. This can be taken from the card's IO tag.
- optionally allow mapping of 0xa0000 to satisfy vgahw when it tries to access the VGA framebuffer. We could return the beginning of the real frame buffer here. Of course vgahw shouldn't do that on NetBSD/macppc but it would be pretty complicated to decide when to allow it and when not, returning the beginning of the frame buffer here doesn't do any harm.
- add an xf86EnableIO to XFree's os-support/bsd stuff to mmap 0xf0000000 and set ioBase accordingly so drivers which need it can access PCI IO registers.

The reasons to do it this way:
- try to run the drivers unchanged - they're supposed to be sort of architecture independent ( yes, I know they're not really ) so I wouldn't like to add any NetBSD/macppc-specific code there
- on first glance it would be cleaner to mmap only the card's IO range, but since XFree likes to access IO registers as (BAR+offset) this would add unnecessary complexity.
 - the same approach could also work on other architectures which don't have IO instructions 

Problem:
- it wouldn't work with two cards in different PCI busses when both need IO access. This is a limitation in XFree ( or rather the BSD-specific code it contains ) - it expects to access all graphics cards through one device.

The attached patches are sort of a proof of concept and do the following things...
xfree.patch:
- add support for xf86EnableIO() for PowerPC-based NetBSD
- remove the dummy

ofb.patch:
- lots of debugging stuff I didn't weed out yet, like...
  * explicitly enabling IO access for graphics cards
  * support for using a different font than the ROM one even in resolutions lower than 1024x768. The reason is that I got feedback about the console font being distorted after exiting X so I tried to load another one to see where the distortion happens. ( options OFB_USE_ROM_FONT forces using the ROM font, without that it will first try to find a compiled-in font with 8 pixels width, then any font and if it still can't find one fall back to the ROM font )
- support for mmap()ing the right IO range when asked to mmap(0xf0000000)
- catch ioctl(WSDISPLAYIO_SMODE) to clean up the console when X exits ( doesn't always work )
- optionally allow mmap(0xa0000) ( options  OFB_FAKE_VGA_FB )
- optionally allow to mmap() everything above 0x80000000, this allows other graphics cards in the same PCI bus as the one handled by ofb to be used by XFree ( options OFB_ALLOW_OTHERS )
- properly center the console

both patches are for current NetBSD and xsrc/xfree.

Hardware:
- UMAX S900 with Voodoo3 and Matrox Millennium - works perfectly. Can't use the Matrox as console though, so I can't reproduce the font problem - it doesn't occur on the Voodoo.
- PM9500 with Matrox Millennium - X11 works just fine but the console font looks weird when X exits ( offset and partially mirrored, couldn't yet figure out why )
- iBook G4 - works perfectly as long as Option iBookHacks is enabled
- PowerMac G4 with nVidia GeForce 2MX - X11 works just fine, no feedback about the console though
- PM4400 with onboard graphics ( some ATi Mach64 ) - works, sort of. Apparently XFree uses only 1MB video RAM for some reason, seems to be an ATi driver issue though - any resolutions/colour depths which need more than 1MB look weird, partly mirrored.

Apart from (maybe) the iBook none of the above works without the patch.

have fun
Michael

--Multipart=_Fri__3_Dec_2004_16_43_41_-0500_96_BIihbs9H1i9Ds
Content-Type: application/octet-stream;
 name="xfree.patch"
Content-Disposition: attachment;
 filename="xfree.patch"
Content-Transfer-Encoding: base64

PyAuZGVwZW5kCj8gRE9ORQo/IE1ha2VmaWxlCj8gZHJtLy5kZXBlbmQKPyBkcm0vTWF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CAi
eGY4NkVuYWJsZUlPICVkXG4iLGZkKTsKKwlpZihpb0Jhc2U9PU1BUF9GQUlMRUQpCisJeworCQlp
b0Jhc2U9bW1hcChOVUxMLDB4MTAwMDAsUFJPVF9SRUFEfFBST1RfV1JJVEUsTUFQX1NIQVJFRCxm
ZCwweGYwMDAwMDAwKTsKKwkJeGY4Nk1zZ1ZlcmIoWF9XQVJOSU5HLCAzLCAieGY4NkVuYWJsZUlP
OiAlMDh4XG4iLGlvQmFzZSk7CisJCWlmKGlvQmFzZT09TUFQX0ZBSUxFRCkKKwkJCXhmODZNc2dW
ZXJiKFhfV0FSTklORywgMywgIkNhbid0IG1hcCBJTyBzcGFjZSFcbiIpOworCX0KK30KKwordm9p
ZCB4Zjg2RGlzYWJsZUlPKCkKK3sKKwlpZihpb0Jhc2UhPU1BUF9GQUlMRUQpCisJeworCQltdW5t
YXAoaW9CYXNlLDB4MTAwMDApOworCQlpb0Jhc2U9TUFQX0ZBSUxFRDsKKwl9Cit9CisKKyNlbmRp
Zgo=

--Multipart=_Fri__3_Dec_2004_16_43_41_-0500_96_BIihbs9H1i9Ds
Content-Type: application/octet-stream;
 name="ofb.patch"
Content-Disposition: attachment;
 filename="ofb.patch"
Content-Transfer-Encoding: base64

SW5kZXg6IG9mYi5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9jdnNyb290L3NyYy9zeXMvYXJjaC9t
YWNwcGMvZGV2L29mYi5jLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjM5CmRpZmYgLXUgLXcgLXIx
LjM5IG9mYi5jCi0tLSBvZmIuYwkyNCBBcHIgMjAwNCAxNTo0OTowMCAtMDAwMAkxLjM5CisrKyBv
ZmIuYwkzIERlYyAyMDA0IDIxOjAxOjQ4IC0wMDAwCkBAIC00Nyw2ICs0Nyw3IEBACiAjaW5jbHVk
ZSA8ZGV2L3BjaS9wY2lpby5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