Thursday, April 1, 2010

Hardware acceleration again lost... and found!

On my laptop I use mainly Kubuntu (love kde4) and I've a radeon r600 chipset, which by the moment of writing this is not completely supported: (K)Ubuntu 9.10 uses kernel 2.6.31 and the experimental dri drivers for hardware acceleration to run need kernel >= 2.6.32.
So to get hardware acceleration with r600 chipset I:
1. installed a 2.6.32 ubuntu kernel
2. added the proper apt repositories (for ubuntu karmic):

### ati open source bleeding edge drivers
deb http://ppa.launchpad.net/xorg-edgers/drivers-only/ubuntu karmic main
deb-src http://ppa.launchpad.net/xorg-edgers/drivers-only/ubuntu karmic main
deb http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu karmic main

3. aptitude update && aptitude safe-upgrade (visual via kpackagetkit is also possible)
4. reboot with the new kernel
... everything is fine now, I can now enable composite for kdm, the visual effects are running, great, I love it!

But somehow recently it got all messed up with an innocent update: After a reboot the gray kde bar told me composite was disabled. Xorg.0.log reported some ugly stuff about disabling dri:

(EE)RADEON(0):
[dri] RADEONDRIGetVersion failed because of a version mismatch.

[dri] This chipset requires a kernel module version of 1.17.0,
[dri] but the kernel reports a version of 2.0.0.
[dri] If using legacy modesetting, upgrade your kernel.
[dri] If using kernel modesetting, make sure your module is
[dri] loaded prior to starting X, and that this driver was built
[dri] with support for KMS.
[dri] Disabling DRI


After some googling around I found this where the exact same message is reported, together with some possible solutions, with didn't work for me. But what became clear is that maybe the problem was, as suggested by the message log message itself, that the kernel module was being loaded to late (somehow, after X was started).

The solution was quite simple. Just add to the /etc/modules file the lines:
drm
radeon modset=1

Why? Kubuntu 9.10 uses upstart as init daemon, and I found that /etc/init/module-init-tools.conf is the file responsible for loading all kernel modules listed in /etc/modules. So if this is executed (or read) before running the /etc/init/kdm.conf file than it should work, which it actually does.
But, to be honest, I'm not quite sure if it always would (run module-init-tools.conf before kdm.conf). So to really be sure, I modified my kdm.conf file, adding a line:
start on (filesystem
and started hal
and tty-device-added KERNEL=tty7
and started module-init-tools
and (graphics-device-added or stopped udevtrigger))

which now guarantees that kdm is not started until module-init-tools file has been run.

No comments: