Another kernel graphics driver
Thursday, March 18, 2010 12:06:02 AM
I got me a new toy - a Blade 2500, 2x 1.28GHz US-IIIi, 4GB RAM and two so far unsupported graphics boards, namely an XVR-500 and an XVR-1200. Of course I had to do something about the graphics boards.
As it turns out both use different variants of 3Dlabs Wildcat OpenGL accelerators to which not a shred of documentation is publicly available. Linux and OpenBSD support them to some degree, OpenBSD even has some acceleration for some of them, but all very hacky and with loads of unanswered questions.
The problem with these boards is that we get the hardware in a quite insane state - there are two 8bit framebuffers, two 32bit framebuffers, and somewhere there's a control plane which selects for each pixel from which framebuffer the colour information comes. Unfortunately this control plane contains garbage ( pixels appear randomly selected from the two 8bit framebuffers ) and we have no idea how to access it, so what both OpenBSD and Linux do is to do all drawing operations in both framebuffers to make sure the pixels show up.
This approach has a few distinctive disadvantages - it's slow, and when you do scrolling operations you can see which pixel belongs to what framebuffer since they scroll one after the other ( of course the latter point is moot on boards where OpenBSD supports acceleration ).
To get around this my driver goes a different route - it uses a shadow framebuffer in main memory. Although wsdisplay already supports shadow framebuffers I couldn't use it since I still need to update two framebuffers, so I had to write my own. All operations are done on the shadow buffer first and then copied into both framebuffers. This has the following advantages:
The result is speed which can rival some older accelerators, at least if you stick the board into a 64bit/66MHz slot.
That said, the wcfb driver has been tested with XVR-500 and XVR-1200 boards in a Blade 2500 and an Ultra 60, it should work fine in other machines ( as long as the firmware sets up a usable graphics mode ) and it will probably work with other Wildcat-based graphics boards like the Expert3D series, XVR-600 etc.
As it turns out both use different variants of 3Dlabs Wildcat OpenGL accelerators to which not a shred of documentation is publicly available. Linux and OpenBSD support them to some degree, OpenBSD even has some acceleration for some of them, but all very hacky and with loads of unanswered questions.
The problem with these boards is that we get the hardware in a quite insane state - there are two 8bit framebuffers, two 32bit framebuffers, and somewhere there's a control plane which selects for each pixel from which framebuffer the colour information comes. Unfortunately this control plane contains garbage ( pixels appear randomly selected from the two 8bit framebuffers ) and we have no idea how to access it, so what both OpenBSD and Linux do is to do all drawing operations in both framebuffers to make sure the pixels show up.
This approach has a few distinctive disadvantages - it's slow, and when you do scrolling operations you can see which pixel belongs to what framebuffer since they scroll one after the other ( of course the latter point is moot on boards where OpenBSD supports acceleration ).
To get around this my driver goes a different route - it uses a shadow framebuffer in main memory. Although wsdisplay already supports shadow framebuffers I couldn't use it since I still need to update two framebuffers, so I had to write my own. All operations are done on the shadow buffer first and then copied into both framebuffers. This has the following advantages:
- all framebuffer reads over the PCI bus are eliminated
- all drawing operations that involve reading from the framebuffer are done in cached memory
- copying data from the shadow buffer to the graphics board happens from cache
- all drawing operations are done only once, into cached memory, and copying the results to the graphics board is much faster than repeating the drawing operation
The result is speed which can rival some older accelerators, at least if you stick the board into a 64bit/66MHz slot.
That said, the wcfb driver has been tested with XVR-500 and XVR-1200 boards in a Blade 2500 and an Ultra 60, it should work fine in other machines ( as long as the firmware sets up a usable graphics mode ) and it will probably work with other Wildcat-based graphics boards like the Expert3D series, XVR-600 etc.













Thabo Thabotizz # Wednesday, June 2, 2010 5:38:11 PM
Lloyd Fosslloyd3369 # Monday, May 9, 2011 8:47:08 PM
You seem to know quite a bit about the XVR-1200, considering you wrote your own device driver for it and everything?! I bought the XVR-1200 because OpenBSD 'supposedly' supported it in 24-bit accelerated mode. At least, that's what the ifb(4) documentation leads one to believe. What's the deal? I can't get X to run either. I also have a PGX64 card which works just fine (console is 'okay' speed-wise and X runs 'okay' as well), but I thought the XVR-1200 would make this card seem like a dinosaur.
Any help? Advice? I don't fully understand how OpenBSD loads or configures device drivers. Are there options that I can change? I know this post is over a year old, but maybe you would be willing to help a fellow Sun enthusiast finally get some graphical 'umph'?
Macallan # Monday, May 9, 2011 9:12:13 PM
So, if you want decent X on a PCI Sun running something else than Solaris stay away from WildCat boards - we have no real docs and unless 3Dlabs changes its corporate mind we're not going to get any. The PGX64 is a Rage XL which should Just Work(tm) with Xorg, if you want something with more video memory ( all mach64 are limited to 8MB by design, I don't know how much memory the PGX64 has but it's probably not much more than 4MB ) get an XVR-100, that's a 32MB Radeon RV100.
Also, OpenBSD is rather misleading in their hardware support docs - then they say "24bit accelerated framebuffer" they mean the hardware capabilities, not necessarily driver support. They have some acceleration for some WildCat variants ( in the jfb driver IIRC ) but that still has the same problem ( two framebuffers with semi-random visibility ) and it's all rather hackish.
That said, I never actually used OpenBSD, we just occasionally look at their code for hardware documentation.
If you want to fix up OpenBSD's driver to be a little faster just look at my wcfb driver in NetBSD - the drawing and cacheing code should be easy enough to port to OpenBSD.
Lloyd Fosslloyd3369 # Tuesday, May 10, 2011 3:26:18 AM
Its funny how OpenBSD prides themselves on how excellent their documentation and man pages are. It seems to me that the driver descriptions should reflect their current operational status and not their theoretical abilities. If I had more motivation, I'd probably write them and argue this point.
Macallan # Tuesday, May 10, 2011 4:55:03 AM
I'm not sure if the E450 has UPA slots - if it does you may want to play with a Creator3D. These boards can accelerate most xrender operations ( and for their age they're ridiculously fast at it - they beat the crap out of an xvr-100 at x11perf -aaftext ), the problem is that the damage and composite extensions don't really seem to work with XAA ( which is what the sunffb driver uses ). The UPA slots offer a lot more bandwidth than PCI and they have their own connection to the crossbar that connects CPUs, memory, PCI bridges etc., so even without hw acceleration they're probably faster at eyecandy effects.
So, what I'm trying to say is, if you want dropshadows, transparency and such your best bet is an xvr-100. These cards also have DVI ports, although they need a firmware update to enable it at boot time.
Lloyd Fosslloyd3369 # Tuesday, May 10, 2011 11:10:05 AM
Macallan # Tuesday, May 10, 2011 1:22:30 PM
That said, while horizontal Creator(3D) cards aren't nearly as numerous as the vertical variety they do show up on ebay every now and then, often mislabeled as SBus cards. Usually you can tell from the picture what it actually is ( For example, if the card itself is single slot but wider than the SBus-like connector it's very likely a Creator. The SBus slots in most SPARCStations are too close together to allow that kind of overhang. ) There are lots of people on ebay who sell Sun gear without any real knowledge of it.