# How to setup DRI with radeonhd Please note that there is **only very experimental [[3D support for r6xx based cards|radeonhd:experimental_3D]]** so far! There is also a [[3D bringup tool|radeonhd:r600_demo]] available that is already capable of rendering textured triangles. Additionally, there is also EXA and Xv acceleration in master. Both the demo program, the EXA/Xv support, and the experimental 3D driver require a drm built from the r6xx-r7xx branch of mesa/drm (or, for Linux, drm-next is preferable) in order to operate. The RS6xx IGP parts have a 2D engine and a 3D engine from the R4xx family so do not require "R6xx support". The rest of this page relates only to R5xx or RS690 for now. So in order to enable DRI on your r5xx card or 690-based motherboard you need * Recent DRM kernel module + libdrm * Recent Mesa (7.2 should suffice) * Recent Xserver (for i386 1.3.0 is enough, x86_64 needs 1.5.0 or later) * Recent radeonhd (version 1.2.2 or later - earlier versions did not allow 2D and 3D at the same time) [[!toc 2]] ## Known Issues * x86_64 is only working correctly with a current Xserver (1.4.99.x) * Mipmap textures are broken * Texture upload after suspend to disk is partially broken * Movewindow support is missing (partially superfluous) * googleearth doesn't render anything. Apparently it falls back into a slow path (antialiased lines), but that is probably only part of the story. ## Building It's a smart idea to pull all this source down into it's own self contained area, in case you need to blow it all away cleanly and redo the git clone, builds, etc. So in this case we'll use /var/tmp/radeonhd-dri as the main area. Don't use /tmp, this is cleared on reboot on some distributions. [[!format txt """ SRC="/var/tmp/radeonhd-dri" mkdir $SRC cd $SRC """]] Please note that the following information is quite Linux-centric at the moment. ### Sources If you want to test the bleeding edge for the main components, we suggest using the git heads, because there are probably still bugs lurking somewhere. [[!format txt """ git clone git://anongit.freedesktop.org/git/mesa/drm git clone git://anongit.freedesktop.org/git/mesa/mesa git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-radeonhd #git clone git://anongit.freedesktop.org/git/xorg/xserver """]] Apparently you need to fetch and build the Xserver only on x86_64, and only if you don't have 1.5.0 or higher - don't update if not necessary, this is painful! ### Preconditions You will stumble upon some preconditions, the following should help here (using released versions whenever possible). You can unpack the released versions with `tar xvfj` . If they don't work, try the according git tree, you can find the path to the git repository on the [[gitweb page|http://gitweb.freedesktop.org/]]. Mesa needs dri2proto: * [[ftp://ftp.freedesktop.org/pub/individual/proto/dri2proto-1.1.tar.bz2|ftp://ftp.freedesktop.org/pub/individual/proto/dri2proto-1.1.tar.bz2]] When building a newer Xserver you will have to fetch and install a number of newer prototypes and libraries. This includes: * [[ftp://ftp.freedesktop.org/pub/individual/proto/xextproto-7.0.3.tar.bz2|ftp://ftp.freedesktop.org/pub/individual/proto/xextproto-7.0.3.tar.bz2]] * [[ftp://ftp.freedesktop.org/pub/individual/proto/xproto-7.0.13.tar.bz2|ftp://ftp.freedesktop.org/pub/individual/proto/xproto-7.0.13.tar.bz2]] * `git clone git://anongit.freedesktop.org/git/xorg/proto/inputproto` * [[ftp://ftp.freedesktop.org/pub/individual/lib/pixman-0.10.0.tar.bz2|ftp://ftp.freedesktop.org/pub/individual/lib/pixman-0.10.0.tar.bz2]] Also, after building the Xserver you have to build and install all input drivers you are using as well. Apparently, you need the very latest bits for them to be compilable, and they have to be compiled against the new ABI of the Xserver. At least this includes: * `git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-input-mouse` * `git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-input-keyboard` * **or** ` git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-input-evdev` Also, for the DRM kernel modules you need the kernel sources of your running kernel installed in /usr/src - all major distributions do this correctly nowadays if kernel sources are installed from your distribution. You may also run into a problem where your libpciaccess it out of date and you need to pull down the latest from git: * `git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess` and build it with the usual manner. This seems to show up on x86_64 builds when the xf86-video-radeonhd build croaks. ### Installation The drm package contains two subsystems, which have to be built and installed separately at the beginning. There's no reason to actually build all the _other vendor_ drm modules, so we'll just build the one we're interested in. In order to make sure that the correct module is loaded check that `extra` is part of the `search` list in `/etc/depmod.conf` - in Ubuntu this typically isn't. [[!format txt """ cd $SRC/drm ./autogen.sh --prefix=/usr make make install (as root) cd linux-core make DRM_MODULES="radeon" make install (as root) depmod -a (as root) """]] After that, all other subsystems have to be built and installed in the same way, in the order mentioned below: [[!format txt """ cd $SRC/ ./autogen.sh --prefix=/usr make make install (as root) """]] If using a released package (a `.tar.bz2`), there is no `autogen.sh`. In that case (and _only_ in that case) you have to call `./configure` with the same arguments. Depending on your distro, you might want to add `--libdir /usr/lib64` to `./autogen.sh`. The subsystems have to be built and installed in the following order: * dri2proto * mesa (add `--with-dri-drivers=radeon,r300,swrast` to `./autogen.sh` to speed up the build considerably) * Xserver: only if there is need to build the xserver, which is quite painful: * xextproto * xproto (is named x11proto in the git repository) * inputproto * pixman * xserver * xf86-input-mouse * xf86-input-keyboard * xf86-input-evdev (if used) * radeonhd ### Notes for Experienced Users If you have a little experience with building and installing foreign packages, you might want to use a different `--prefix` in order to not override your installed configuration. In that case you will have to additionally set [[!format txt """ export ACLOCAL="aclocal -I $PREFIX/share/aclocal" export PKG_CONFIG_PATH=$PREFIX/$LIB/pkgconfig" export LD_LIBRARY_PATH=$PREFIX/$LIB export PATH=$PREFIX/bin:$PATH """]] with `$PREFIX` being the directory to be installed to and `$LIB` being "lib" on i386 and "lib64" on x86_64 (might be distribution dependent). You can also use build dirs for all subsystems (except for the kernel module and the Mesa subsystem, which uses autoconf, but not automake) by creating a `build` directory, changing into that directory and calling `../autogen.sh [args]`. This has the advantage that the source directory remains untouched. Again, this doesn't work for Mesa and the drm kernel module. ## Configuration DRI is inactive by default. In order to activate DRI, you have to add [[!format txt """ Option "DRI" """]] to the driver section of your `xorg.conf`. ## Troubleshooting, Q & A ### Only the first invocation of a OpenGL program works as expected You're probably running an older Xserver (< 1.4.99.x) on an x86_64 machine. This is known to exhibit this bug. ### I only get "Error: coudn't get an RGB, Double-buffered visual." Same as above. Xserver is too old.