Subject: ATI Proprietary driver on X11 and NetBSD (was Re: Thinkpad T60 mostly works - trouble with wm(4))
To: Greg Troxel <gdt@ir.bbn.com>
From: Brian de Alwis <bsd@cs.ubc.ca>
List: port-i386
Date: 08/22/2006 16:36:52
> Someone (who I won't name unless they want to speak up
> in public) tells me they have a binary ATI driver working; they and I
> hope to get that into pkgsrc.

Well that'd be me.  And as I am on a hard paper deadline and then
travelling (not to mention that this was surprisingly easy), I'll
post what I've figured out so far.  Basically, it's possible to
get multi-screen/dual-head working using the XFree86 4.5.0 bundled
with NetBSD.  Haven't looked at the OpenGL or XVideo.


This was prompted by a FreeBSD port of an older set of the ATI
drivers by Chris Gilbert.  Looking through it, I realized that the
port involved only recompiling the user-land components, and that
he was able to use the ATI binary drivers as is.  He is currently
working on porting the kernel driver, though that's only appears
to be necessary for 3D.

So I fetched the latest ATI drivers (8.27.10) from

    www2.ati.com/drivers/linux/ati-driver-installer-8.27.10-x86.run

and extracted them:

    ./ati-driver-installer-8.27.10-x86.run --extract /var/tmp/ati-driver

This includes drivers for
  * XFree86 4.3.0 and later (in .../x430/)
  * X.Org 6.8.0 (x680/)
  * X.Org 6.9.0 (x690/)
  * X.Org 7.1.0 (x710/)
There are some helper programs in arch/x86/usr/X11R6/bin, particularly
aticonfig.

As I have the stock XFree86 4.5.0 provided with NetBSD, I then did:
    cp x430/usr/X11R6/lib/modules/drivers/fglrx_drv.o \
	/usr/X11R6/lib/modules/drivers/
    cp x430/usr/X11R6/lib/modules/linux/libfglrxdrm.a \
	/usr/X11R6/lib/modules/

Surprisingly, with an appropriately configured XF86Config, that's
enough to get it working.

You can use the aticonfig program to process and setup your XF86Config
file.  It does a mostly nice job.  Basically all you need is a
device section as follows:

    Section "Device"
	    Identifier  "fglrx0"
	    BusID       "PCI:1:0:0"
	    Driver      "fglrx"
	    VendorName  "ATI Technologies Inc"
	    BoardName   "firegl"

	    Option      "VideoOverlay" "on"
	    Option      "OpenGLOverlay" "off"
	    Option "EnablePrivateBackZ" "yes"
	    Option "no_dri" "on"
	    # Need to have SWCursor on to enable a real cursor on screen1,
	    # but leaves mouse turds on screen0.  Unfortunately can't
	    # configure to only use software cursor on driver 2. Sigh.
	    #Option "SWCursor" "on"
    EndSection

Apparently XVideo support is only available for the X.Org drivers.
I haven't installed X.Org to try yet.

You can play with ServerLayouts to try Dual-Head with Xinerama, or
setting up Multiple Screens.  I found I needed to toggle back to
to the console VT at least once for it to pick up the second monitor.
I've appended my XF86Config with two working layouts here.  Note
that this doesn't work perfectly:

  * without the SWCursor option, the cursor doesn't appear on the
    second screen;

  * with the SWCursor option, the mouse leaves little turds on both
    screens.

This is a known problem under Linux too, and is apparently fixed
by using the kernel module.

I found in my exploration that it was easy to get to a hosed state
where you are flying blind.  If you want to play with this, I'd
suggest having some way to restore your video; I saved a known
working XF86Config file somewhere and then set up a little script
to use it:

    #!/bin/sh
    X -xf86config /etc/X11/XF86Config.reset vt02 -nolisten tcp "$@"

Some useful sites:

    http://debian.wgdd.de/temp/fglrx_man/fglrx.4x.html
    http://gentoo-wiki.com/HOWTO_Dual_Monitors#With_the_proprietary_binary_d
river
    http://ati.cchtml.com

Brian.

-- 
Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
  "Amusement to an observing mind is study." - Benjamin Disraeli