Subject: Re: Help?
To: Michael Hertrick <m.hertrick@neovera.com>
From: Eduardo Horvath <eeh@NetBSD.org>
List: port-sparc64
Date: 07/23/2004 23:37:10
On Fri, Jul 23, 2004 at 05:41:48PM -0400, Michael Hertrick wrote:
> I installed the latest release of OpenBSD on my Ultra 5, but did not get 
> X to work in the 20 minutes I played with it.  If it does work, it 
> wasn't obvious how the XF86Config needs tweaked for it to work.  Also, 
> OpenBSD's support of the ATI Mach64 was just as slow, if not slower than 
> NetBSD's on the console... and the console display size, at least 

AFAIK, the OpenBSD console uses the ATI as a dumb framebuffer console.
That's why the console is so slow.  When I looked at their X server
implementation I don't recall it being accelerated either.

> out-of-the-box, was not as big as the screen.  I think OpenBSD's support 
> for this video needs a lot of work... it just doesn't seem to be very 
> good especially compared to Linux' support of the same hardware.
> 
> X on Linux (Debian stable sparc64 dist.) worked right away without any 
> trouble.  Also, the console was high-res and filled up the whole screen 
> without any tweaking.  It was very fast, too...  and white on black.  
> Maybe that's why it was so fast... could black on white be too intensive?

Linux uses a kernel driver for the ATI chipset.  NetBSD should also have
a machfb driver.  Are you using that or the pcons driver that calls into
the OBP?  I would have thought the machfb driver would be as fast as the
Linux one.

> I gather that if I want it done I'd either have to loan my hardware out 
> to a stranger or do it myself.... hmmmm.....
> 
> I've not really worked on a driver before... where would one begin? 
> Would I need to get "specs" from ATI or Sun? 

ATI.

> How hard is it to get such information from a vendor/manufacturer? 

Hard.

> How does one go about getting the info.?   Does it ever cost money?

Try contacting ATI.  (They probably won't help.)

> Or are there ways of properly writing the driver with only the hardware 
> and a brain? 
> Is it all C, or would some assembly be required, too? 
> Would the SPARCv9 architecture manual be handy? (I bought it a year or 
> two ago to fulfill my curiosity of the SPARC)   
> How much time do you think would be reqired for someone with my lack of 
> driver experience to get it working?  Less than a couple months?  I'm a 
> good self-starter, just not a good self-finisher.... in fact, most 
> things I start do not get finished so if one might consider this a 
> long-term project, I'd better not bother.

XFree86 almost certainly has a driver for that specific ATI Mach64
card.  All you need to do is to get it to attach to that frame buffer.

Sounds simple?  Well, it isn't.  But I won't bore you with an extended
treatise on the lousy design of XFree86 and how it should be done properly.
Instead I'll try to be somewhat helpful.

Here are a few of the issues you will need to resolve:

1) XF86 likes to probe the PCI bus by issuing config space reads.  You can
probably cobble something together with /dev/pci

2) XF86 does not know how to configure the display.  It has problems
switching display modes or simply turning the device on.  This needs to
be done by either the firmware or kernel driver.  machfb should be able
to do this.  I had it working at one time on a blade100.

3) XF86 likes to make BIOS calls.  Dunno how to fix this.  SPARCs don't
have BIOS, although there does seem to be some sort of firmware property
on the device node.  Dunno what to do with that either.


Another option (one I personally prefer) is to use the kdrive X server.
This is a different X server written by Keith Packard.  It's (IMHO) a
much better design than XF86 and also appears to have a mach64 driver.

Here what I would do is create a set of netbsd routines that interface
with either the Sun devices the way XSun does or use the wscons 
devices and interface.  (N.B. wscons may require some enhancement.)  
Look at the XSun server for some clues about how to get frame buffer
dimentions and depth, set the cursor and colormap, map in the device
registers and frame buffer, etc.

Good luck.

Eduardo