Thursday, 31 May 2012

Debian Testing/Unstable: FGLRX Just Broke!

I know. Annoying, isn't it?

The X server has just been upgraded to 1.12 in wheezy and sid. Unfortunately, this version uses a new interface which is incompatible with fglrx at present. In other words, you can't install fglrx in wheezy or sid without downgrading (and, I would suggest, pinning) the xserver version.

The next proprietary fglrx driver version, 12.5, is supposed to support the new X.

Meanwhile, over in the land of stable, Squeeze is fine; that's still on 1.7.

Update 4 Jun 2012: AMD announced they're changing their driver release schedule, so they have fewer releases: hence a 12.5 version is no longer on the cards. Thanks AMD. I just tried the 12.6 beta driver (curiously labelled as 8.98), and xserver 1.12 is still broken. However, there are people claiming that it works on 32-bit Debian and all architectures of ArchLinux.

Update 5 Jun 2012: I've just tested Fedora 17 with Xorg server 1.12, and here the Catalyst 12.6 beta driver is working fine.

$ yum info xorg-x11-server-Xorg | grep Version
Version     : 1.12.0

There's only one catch; the *@$%@rds wise overlords at AMD decided it would be a spiffing jibe to take the only working driver and plaster a bold "AMD Testing use only" watermark over the bottom right hand corner of every display.

Thankfully, there's a simple script to hack the fglrx module binary and remove the EnableLogo calls. It just warrants an elementary tweak to correct the module location for Fedora 17, and also to backup the original binary first. The resulting shell script, to be saved, exec perm'd, and run as root, is:

cp $DRIVER ${DRIVER}.original
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER

If you'd like to get a feel for what that does, run the following:

$ objdump -d /usr/lib64/xorg/modules/drivers/ | grep EnableLogo

The callp lines shown there invoke AMD's wonderful EnableLogo function. To get around this, the awk code in the script is getting those callp lines, and returning the hex for those calls. sed is replacing it with  a series of 0x90 commands - i.e. NOPs.

Quite a neat solution to a messy problem, eh? Thanks go to Kano (post 2).

Update 30 Jun 2012: A kernel update broke my 12.6 beta, forcing me to revert to the OS driver. I tried installing the 12.6 final release from AMD, which claims to support 3.4 kernels. However, building the kernel module failed with "'cpu_possible_map' undeclared" - an error which apparently stems from the 12.4 release. Applying this patch seemed to do the trick.

0. Install 12.6
1. Apply the changes to /usr/lib/modules/fglrx/build_mod/*
2. Run /lib/modules/fglrx/build_mod/ as root
3. Run /lib/modules/fglrx/ as root
4. Reboot