Radeon KMS on Debian testing

The following guide was successfully tested on a Debian testing installation using a Radeon X1950 Pro PCI-Express card. Most of the information has been taken from this article on getting Radeon KMS working on Gentoo.

Kernel

You will need a kernel with KMS support. For “older” Radeon cards this means at least kernel version 2.6.31 (I’m currently using 2.6.31.4), for R600 or newer cards you will need kernel 2.6.32 or newer. Your kernel needs to have radeon modesetting (CONFIG_DRM_RADEON_KMS, under Drivers -> Staging drivers) enabled.

libdrm2

The current libdrm2 package doesn’t include Radeon KMS support. You can download modified packages from this page or, at your option, compile them yourself as follows.

First, get the packages required to build libdrm2:

$ sudo apt-get build-dep libdrm2

Now get the sources:

$ apt-get source libdrm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Need to get 937kB of source archives.
Get:1 http://debian.ethz.ch squeeze/main libdrm 2.4.14-1 (dsc) [1,369B]
Get:2 http://debian.ethz.ch squeeze/main libdrm 2.4.14-1 (tar) [535kB]
Get:3 http://debian.ethz.ch squeeze/main libdrm 2.4.14-1 (diff) [400kB]
Fetched 937kB in 1s (593kB/s)
dpkg-source: info: extracting libdrm in libdrm-2.4.14
dpkg-source: info: unpacking libdrm_2.4.14.orig.tar.gz
dpkg-source: info: applying libdrm_2.4.14-1.diff.gz

Then change to the newly created libdrm-2.4.14 directory and modify the configure call in debian/rules (line 51) to look like this:

../configure --prefix=/usr --mandir=\$${prefix}/share/man \
        --enable-radeon-experimental-api \
        --infodir=\$${prefix}/share/info \
        --enable-static=yes $(confflags) \
        CFLAGS="$(CFLAGS)"

In order to have the newly built additional libraries included in your packages, add the following line to debian/libdrm2.install:

usr/lib/libdrm_radeon.so.*

Now you will need to add some entries for the new symbols to debian/libdrm2.symbols:

libdrm_radeon.so.1 libdrm2 #MINVER#
 radeon_bo_manager_gem_ctor@Base 2.4.14
 radeon_bo_manager_gem_dtor@Base 2.4.14
 radeon_cs_manager_gem_ctor@Base 2.4.14
 radeon_cs_manager_gem_dtor@Base 2.4.14
 radeon_cs_space_add_persistent_bo@Base 2.4.14
 radeon_cs_space_check@Base 2.4.14
 radeon_cs_space_check_with_bo@Base 2.4.14
 radeon_cs_space_reset_bos@Base 2.4.14
 radeon_gem_get_kernel_name@Base 2.4.14
 radeon_gem_name_bo@Base 2.4.14
 radeon_gem_set_domain@Base 2.4.14
 radeon_track_add_event@Base 2.4.14
 radeon_tracker_add_track@Base 2.4.14
 radeon_tracker_print@Base 2.4.14
 radeon_tracker_remove_track@Base 2.4.14

To prevent your package from being overwritten with the next update, increment your package version by prepending the following lines to debian/changelog:

libdrm (2.4.14-999kms1) unstable; urgency=low

  * enable radeon experimental api

 -- Anonymous Coward <nobody@example.org>  Sat, 17 Oct 2009 03:30:29 +0200

And finally build the package:

$ debuild

You might be seeing some errors about signing the package. Don’t worry, that’s all right.

If everything worked, you will see the new packages in your parent directory:

$ ls ../libdrm*deb
../libdrm2_2.4.14-999kms1_amd64.deb
../libdrm2-dbg_2.4.14-999kms1_amd64.deb
../libdrm-dev_2.4.14-999kms1_amd64.deb
../libdrm-intel1_2.4.14-999kms1_amd64.deb
../libdrm-intel1-dbg_2.4.14-999kms1_amd64.deb

You will need to install libdrm2, libdrm-dev and libdrm-intel1 using dpkg -i.

Xorg driver

Unfortunately the current radeon driver debian package doesn’t include support for KMS either so you’ll have to build that one yourself, too (or, again, download it from here).

Since we’re being lazy here, we don’t build a proper debian package. We just build the driver and copy it to our hard drive. Be aware that as soon as your radeon driver package gets updated you will have to re-do the last step of this installation.

The following commands have basically been taken from a guide to build the intel xorg driver, replacing intel with ati:

$ sudo apt-get install git-core xutils-dev autoconf automake libtool
$ sudo apt-get build-dep xserver-xorg-video-ati
$ git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati
$ cd xf86-video-ati
$ ./autogen.sh --prefix=/usr
$ make

Now you will have to copy the new driver module to the right place. Be warned, though, that this will immediately crash your x server. You are strongly advised to shut it down first.

$ sudo cp src/.libs/radeon_drv.so /usr/lib/xorg/modules/drivers/radeon_drv.so

That’s it. Enjoy your kernel-based mode setting.

Last words

  • If you use multiple screens, there is an issue with a disappearing mouse pointer. See the linked bug report for a work-around.
  • Remove any vga= options from your kernel parameters (eg. in grub) or you won’t see anything.

Downloads

Debian packages

Xorg driver

  1. Marek Straka
    December 1st, 2009 at 02:32 | #1

    Hi. I made it as you described. Compiled kernel 2.6.32, libdrm 2.4.15 and radeon driver from GIT. But I think it is not complete. It runs already but I get
    $ glxinfo | grep OpenGL
    OpenGL renderer string: Software Rasterizer
    and in Xorg.log:
    (EE) RADEON(0): [dri] RADEONDRIGetVersion failed because of a version mismatch.
    [dri] radeon kernel module version is 2.0.0 but version 1.17.0 or newer is needed.
    [dri] Disabling DRI.

    Upon http://wiki.x.org/wiki/radeonBuildHowTo
    ẗhere should be also Mesa compiled. Coud you describe a debian way for it?

  2. December 2nd, 2009 at 12:48 | #2

    Hi

    AFAICT the “radeon kernel module version is 2.0.0 but version 1.17.0 or newer is needed” error means that x.org doesn’t use the driver you compiled from git. Did you copy it to the right place?

    Also, are you using testing/unstable?

  3. Marek Straka
    December 2nd, 2009 at 17:48 | #3

    I am using debian Squeeze.
    Look on the wiki “how to compile radeon” Section Troubleshooting KMS problems

    “your xorg.log has error ….”
    “You have not support for KMS, You have to rebuild it against libdrm_radeon and also to rebuild mesa against same new libdrm because mesa doesn’t have KMS support without libdrm_radeon either”

    I have tried to compile MESA but “make” stopped with error. Upon advices from radeon support forum there is necessary to have also drm from git.

    I stopped here:
    git clone –depth origin git://anongit.freedesktop.org/git/mesa/drm
    cd drm
    ./autogen.sh –prefix=/usr –enable-radeon-experimental-api
    … I am not sure here about parameters for debian.

  4. December 7th, 2009 at 03:43 | #4

    Okay, well basically if all you have to do is rebuild mesa, you can fetch the corresponding sources using apt-get source and then build the package using debuild. You’ll have to do that after building/installing libdrm2 (including the -dev package).

  5. Marek Straka
    February 18th, 2010 at 23:22 | #5

    I have compiled kernel 2.6.32.8 with KMS support, radeon driver from GIT and taken everything “mesa” from debian experimental. Now works my ATI mobility radeon X1800 after 4 Years I have buyed my laptop for the first time without problems.

  6. June 3rd, 2010 at 07:44 | #6

    Thanks for the page. I’m trying to resolve a black-screen problem with X on a Radeon RS780 (a.k.a. an ATI 790GX motherboard). See the Xorg mailing list, subject “could use help debugging black screen on RS780″

    When I get to your step of building a fresh libdrm2, it ends with
    dh_makeshlibs: dpkg-gensymbols -plibdrm2 -Idebian/libdrm2.symbols -Pdebian/libdrm2 -c4 returned exit code 1
    make: *** [binary-arch] Error 1
    A full log is at http://doolittle.icarus.com/~larry/libdrm-2.4.18-makelog
    Other than the scary word-length issues (this is a 64-bit build), does this problem have an obvious solution? The machine is a fresh squeeze install.

  1. No trackbacks yet.