photo of Macallan

Rants & Ramblings

Another SBus monster

, , , , ,

Some Kind Soul(tm) sent me a Sun CG12 a few weeks ago, also known as GS or Matrox SG3. Yes, the board was designed and manufactured by Matrox, contains a bunch of Matrox-designed custom chips which don't show up in any part supplier's inventory list and a handful better known ones.
So, let me describe the board. It's quite huge - if you've ever seen a Leo or an AG-10e, it's like that, just one more slot. It occupies three SBus slots so it only fits in a handful machines like the SS5, SS1(+) and maybe the SS20 where it would hog one CPU slot. I put it in my SS5 where it blocks all SBus slots so there's no room for a fast ethernet board. Bummer.
The board I got turned out to be a CG12+, with 8MB framebuffer, 2MB z-buffer, 128KB RAM for the DSP. The only documentation available is a header file from SMI which contains a rudimentary register and address space layout, existing drivers in OpenBSD and Linux are both based on this file, and by necessity, so is mine.
If you read this header file and then look at documentation for older Matrox chips you will see a lot of familiar terms, apparently the entire Millennium I family and its ancestry ( like Athena ) are more or less distant relatives of the CG12. This should at least give us some ideas how the drawing engine works.
Of course I got the board for the promise to make it work in NetBSD. Unfortunately the firmware lies about the graphics mode set up at boot time so genfb at sbus produces garbage - the address property points at the monochrome overlay plane while the depth property contains 32. Sure, the board has a 32bit framebuffer but that's not what the firmware console uses. Getting it to work as a monochrome wsdisplay was easy enough but when I tried to use a shadow framebuffer to speed things up I found out that NetBSD's machine independent drawing routines for colour depths less than 8 hadn't been adapted to shadow framebuffer usage, so I did that and now the card works fine as a not all that slow but still monochrome console.
Given the similarities between the CG12 and older, more or less well documented Matrox graphics chips it may be possible to get the blitter going. I did some experiments but didn't get very far - all older Matrox graphics chips start commands by ORing 0x100 to the address of a register write. This doesn't match up with the CG12 - the engine registers occupy two successive blocks of 0x100 bytes, so if they use the same method they must use a different value to OR to the address. Also, the engine appears to be in a reset state of some sort, writes to any drawing related registers are ignored, or at least don't show up when reading registers. All other registers appear to contain something sensible and respond to writes, like the DACs ( there are three Brooktree 8 bit DACs, apparently working in lockstep ), various registers that control which view of the framebuffer you see ( be it 8 or 24 bit, overlay or enable planes etc. ) and what appears to be video mode setup.
It may well be that the board requires a firmware image to be uploaded somewhere ( maybe the DSP's private memory ), on the other hand the device properties give a firmware version. It is unclear wether this refers to the ROM content in general or the DSP's firmware. It is also unclear to what extent the drawing engine depends on the DSP, if at all. I don't think we will be able to use the DSP ( there are registers which seem to be for communication with the DSP but no indication whatsoever how they are supposed to work ) but I don't think we have to - the drawing engine will probably work just fine without. Also, the drawing engine seems to be pretty much 2D only, z-buffer operations seem to be the only 3d-support present - maybe the DSP is supposed to do some higher level drawing operations.
What we know about the board is this:
  • it's got 8MB dual-ported framebuffer memory, 2MB z-buffer and 128kB DSP memory - quite a lot for a graphics board from 1990
  • there's a monochrome overlay plane and an enable plane for the overlay
  • there's an 8 bit WID plane and what appears to be a 256 entry WID LUT
  • the framebuffer can be used as 8bit, 24 bit single buffer or 2x 12bit with double buffering, the overlay/enable planes seem to be completely independent
  • apparently there is no support for a hardware sprite - I guess we're supposed to draw a cursor into the enable/overlay planes, that way at least it wouldn't interfere with the regular framebuffer
  • there's a DSP, we don't know what exactly it's supposed to do
  • the DACs seem to be regular 256 entry greyscale DACs working in lockstep to provide gamma table / palette support.
  • the drawing engine seems to be similar enough to older, documented Matrox designs - there might be a chance to get it going.

Even though the card is quite monstrous its heat output seems to be moderate at worst, it's certainly nowhere near as hot as a Leo or even an AG-10e.

Another kernel graphics driverAnother one bites the dust

Comments

Thabo Thabotizz Wednesday, June 2, 2010 5:25:35 PM

Wow, Macallan! This stuff is great! Give thanks to that kind soul bigsmile

Chase Rayfieldcb88 Tuesday, June 22, 2010 1:20:08 AM

heh sounds like a beast... I've gotten netbsd up and running on the SS5 with FVWM for 70Mhz it is actually still fairly usable dillo works pretty well for the basics pine for accessing my university mail. I plan on upgrading my SS10 to 4x142Mhz 1Mb (I wonder if that is 1Mb per CPU or 512 each on the wide ROSS part) cache system as soon as my reserves recover from buying an hp 50g calculator.

I really should get AFS running on these BOXes so I can actually do work for school from them :-D. I'm thinking of taking a symbolic programming class next semester I'd love to see the teachers face knowing the work was done on a machine from the early 90's.... AFS kinda mandates broadband though stuck in the dark dialup ages here still X.x

Blaz(ž) Pristavitalianjob44 Tuesday, August 3, 2010 12:34:10 PM

You write display drivers, hardcore man headbang

Chase Rayfieldcb88 Wednesday, November 9, 2011 5:31:28 PM

Have you read the leo reference? there is a ramdac section the only copies I have found though are in google cache which I stumbled upon.

Macallan Wednesday, November 9, 2011 6:48:51 PM

I have the Leo manual. The problem is, that many of the images are damaged or missing and the table that describes how WIDs are encoded is one of them. Unfortunately the encoding is non-trivial and just poking around got me nowhere.
( ok, I didn't try that hard, Leo is a monstrosity that's not very high on my todo list )

Chase Rayfieldcb88 Wednesday, November 9, 2011 10:25:08 PM

Ah that makes sense then. It is indeed a monstrosity... I might mess around with it at some point but it would be my first go at such a thing so don't expect much lol. It does look rather complex compared to the stuff I have done (PIC and Atmel mostly simple things)

Macallan Thursday, November 10, 2011 3:53:15 AM

For your first attempt on programming graphics hardware I'd be hard pressed to come up with something worse than Leo. The thing is overly complicated, quite different from more mainstream hardware, obscure, and the manual - what we have of it - is confusing to say the least. And then, it's not even very fast.

Write a comment

New comments have been disabled for this post.