Sunday, August 30, 2009

Radeon KMS on Gentoo (really this time!)

Alright, so many thanks to FireBurn, who pointed out that the x11 overlay has all the packages necessary for KMS support. Here's what I had to do to get it working:

New kernel:

Needs to be from the 2.6.31 series or better. Using 2.6.31-rc8 right now. To enable KMS, you have to enable:

Device Drivers > Staging drivers > uncheck "Exclude staging drivers from being built"
Device Drivers > Staging drivers > Enable modesetting on radeon by default

Add the x11 overlay:

layman --add x11

Create ebuilds for some new packages (optional)
xf86-input-evdev and xorg-server have new beta versions that aren't in the tree or the x11 overlay yet. If you want to use these instead of live git ebuilds, make ebuilds for xf86-input-evdev-2.2.99.1 and xorg-server.1.6.99.900.

Unmask the necessary packages
Here's what I added to my package.unmask:
=x11-drivers/xf86-video-ati-9999

# make these =-9999 if you're not using the beta versions
<x11-base/xorg-server-9999
<x11-drivers/xf86-input-evdev-9999

<x11-proto/fixesproto-9999
<x11-proto/xextproto-9999
<x11-proto/renderproto-9999
<x11-proto/recordproto-9999
<x11-proto/inputproto-9999
<x11-proto/xineramaproto-9999
<x11-libs/libXext-9999
<x11-libs/libX11-9999
<x11-proto/xproto-9999
<x11-proto/xcb-proto-9999
<x11-libs/libXi-9999
<x11-libs/libXinerama-9999
<x11-libs/libxcb-9999
<x11-proto/bigreqsproto-9999
<x11-proto/xcmiscproto-9999

Note that most of them are "<package-9999", which will unmask all versioned versions, but not the live git version of the ebuild. Live ebuilds are a pain since you have to update them manually, so avoid them when possible.

Really long compile:

I think these need to be installed first, so let's make sure:
emerge -uav1 libdrm xorg-server mesa

Then:
emerge -uDNav world
revdep-rebuild

At this point, it should probably work - reboot into your new kernel and find out.

Caveats:

Some packages (pulseaudio, maybe others?) don't build against these versions of the X libraries. They fail with missing header errors, so I think it's probably just a build system issue, and they should both be relatively easy to fix. Still, you've been warned.

When I initially finished these steps, X wouldn't output anything when I tried to run it, and I had to ssh in to kill it. Also, I kept on getting strange errors in my /var/log/messages along the lines of:

Aug 30 11:32:01 3vil [drm:radeon_ib_schedule] *ERROR* radeon: couldn't schedule IB(5).
Aug 30 11:32:01 3vil [drm:radeon_cs_ioctl] *ERROR* Faild to schedule IB !

Depressingly enough, I have no idea what I did that fixed this. The problem persisted through several reboots, and then went away for no reason that I can discern. :(

Edit 8/31: Redo package.unmask.

Edit 9/10: kms USE flag is on by default now, so we don't have to enable that. Redo package.unmask again.

No comments: