HowTo: RadeonHD 4550, Gallium3D, UT2004

Time for a quick status report on the latest git checkout of the FOSS xf86-video-ati driver for my RadeonHD 4550. It’s also a guide to getting the same free software stack working on your machine!

Open source drivers: then

I stopped using the open source Radeon driver some months ago, because I started playing Unreal Tournament 2004 again. At the time, the FOSS drivers were completely unusable. I had to lower the game’s resolution and detail to the point that my eyes hurt; the screen was a blurry, pixelated mess. That was back when the “classic” Mesa stack, which I was using, offered better performance than the Gallium3D code. I switched to the proprietary fglrx driver (Catalyst 10 and 11 series). Using this driver meant reinstalling the it for every kernel rebuild, giving up the flicker-KMS boot experience, viewing low-resolution consoles, and dealing with all the 2D lag in regular desktop use that the proprietary ATI driver is justly famous for.

Last year, the FOSS Radeon driver was good enough to run World of Goo and ioQuake engine-based games, but not much else. Sure, 2D desktop compositing performance was stellar, but there was no possibility of running more demanding OpenGL games like UT2004 or even Aquaria without significant stutter, lag, and low framerates. There was no real power management implemented, so my video card ran hotter all the time. There was also no hardware acceleration for video playback (DVDs, etc.) or Flash, though that’s probably still the case today.

Open source drivers: now

Everything has changed. The “classic” Mesa code has been obsoleted in favor of the Gallium3D stack, which offers superior performance. I can play Unreal Tournament 2004 with all detail settings maxed, at 1440×900 resolution, on an older RadeonHD 4550.

Before I could try UT2004 with the open drivers, it required preparing my system. Here’s how you can do it!

Switching to the open source drivers

For reference, my current working software versions:

(All git checkouts from May 13, 2011)
Mesa git: ac85ab066b7e3a7ee818849491b97a499038190b
libdrm git: ba11501bb9f5bd98110dfe1385b4501c0a9a643a
xf86-video-ati git: f83d58cf5b33686139067f8f898b8e566ba5c253
xorg-server: 1.9.5
kernel: 2.6.38.4

Assuming you already have the FOSS Radeon driver installed, you’ll need to update your git checkouts; emerge will do this for you. Git ebuilds are available in my overlay, and the X11 overlay. This is to get the latest code that hasn’t yet been released in official packages; there are several recent commits that have vastly improved 3D performance. Be sure to add required ~arch packages to /etc/portage/package.accept_keywords.

Configure the compile variables

Gallium3D is where all the hot driver action is these days for R600 cards, so make sure it’s in your compilation variables:

$ grep VIDEO_CARDS /etc/make.conf
VIDEO_CARDS="r600 fglrx"

Note: I left in fglrx, that way it’s still available as an option should you decide to switch back, and you won’t need to recompile anything to do so.

Make sure that you’ve got gallium enabled in your USE flags for media-libs/mesa, and that radeon is turned off. Why off? This code is the classic code for old devices; we don’t need it, since we’re only building for an R600 card. This saves you a considerable amount of compilation time.

$ grep mesa /etc/portage/package.use
media-libs/mesa -video_cards_radeon gallium gles

Compile and install the FOSS drivers

You’ll need to emerge mesa, xf86-video-ati, libdrm, and xorg-server. Once everything is installed, you’ll need to tell your system which driver stack it will be using.

Specify the open source stack

First, select the right OpenGL provider:

# eselect opengl list
Available OpenGL implementations:
  [1]   ati *
  [2]   xorg-x11
# eselect opengl set 2

Now that you’re using mesa, make sure to select the gallium options:

# eselect mesa list
64bit r600 (Radeon R600-R700, Evergreen, Northern Islands)
  [1]   classic
  [2]   gallium *
64bit sw (Software renderer)
  [1]   classic
  [2]   gallium *

Configuring kernel modules

If you haven’t already, you need reconfigure your kernel and add support for the new Direct Rendering Manager code to get hardware acceleration.

# cd /usr/src/linux
# make menuconfig
Device Drivers  --->
  Graphics support  --->
   Direct Rendering Manager --->
     ATI Radeon
  [*]     Enable modesetting on radeon by default

Save your kernel configuration, build, and install the kernel. Here’s my one-liner:

# make -j4 & make modules_install && make install

Next, make sure that only the radeon module is loaded at boot. Comment out the fglrx entry:

# nano -w /etc/modules.autoload.d/kernel-2.6

radeon
##fglrx

Note:I’m still using baselayout-1; baselayout-2/OpenRC users should look in /etc/conf.d/modules.

Blacklist the fglrx module so that it never loads:

# echo "fglrx" >> /etc/modprobe.d/blacklist.conf

Configure X11

If you use /etc/X11/xorg.conf (or /etc/X11/xorg.conf.d/), configure X to use the radeon driver:

# nano -w /etc/X11/xorg.conf
Section  "Device"
  Identifier "RadeonHD 4550"
  Driver "radeon"
EndSection
Section "dri"
  Mode 0666
EndSection

I don’t have any other optimizations in xorg.conf. No additional parameters or heat/power management, mostly because I can’t find what options still exist for those. Anyone know? Any additional tips on getting more performance and less power usage from X11?

That should be it! Now all you have to do is reboot into your new open source software stack, and start having some fun.

Performance notes

World of Goo: no change. It’s just as fast as ever. No hitches or slow framerates.
UT2004: Playable. No real complaints. A few things to be aware of, however . . .

I played a few maps, and noticed some moments of slowdown and lower frames. This mostly occurs on very large, detailed maps, or when the whole map is onscreen at once, such as in the Spectator view. Framerates are usually in the 40-60 FPS range, up to the cap at 140FPS. It all depends on how much is being drawn on the screen. More players, weapons, vehicles, monsters, effects, and action can add up to lower framerates.

Still, it was quite playable, never venturing below 30 FPS. Once I got into framerates in the 40s, there was some slight, noticeable stutter, but not enough to ruin my shots against AI monsters. Against lots of human players, you might need to lower the screen detail or resolution to deliver smooth framerates at all times.

Here’s a screenshot of a fairly busy map (about 20 simultaneous human players, plus dozens of monsters), with a crazy, GPU-crunching shimmery golden force field effect wall at the far end. Note the framerates displayed in the upper right corner.

UT2004 on Linux

UT2004 on Linux. Map: "The End"

14 thoughts on “HowTo: RadeonHD 4550, Gallium3D, UT2004

  1. Is there a way to also build the 32bit version for those of us on AMD64 wanting to use this with WINE or with other 32 bit binaries?

    I had ran into this trying nouveau for an nvidia card in one of my boxes.

    • There are plenty of tutorials out there for building 32-bit binpkgs, usually with chroots. You already have 32-bit versions of the regular, stable libraries installed, as long as you built emul-linux-x86-xlibs with +opengl.

  2. Thanks for the guide. It misses one important thing though. The firmware blob:

    emerge x11-drivers/radeon-ucode

    Then you need to configure the kernel to embed the firmware binary during building. The setting is in “Device Drivers->Generic Driver Options”:

    [*] Include in-kernel firmware blobs in kernel binary
    (radeon/R700_rlc.bin) External firmware blobs to build into the kernel binary
    (/lib/firmware) Firmware blobs root directory

    We are not done yet. Games and application that make use of S3TC (S3 texture compression) don’t work, or work slower. To fix this, we need to install libtxc_dxtn. Sadly, it’s not in portage. But an ebuild can be found here: http://bugs.gentoo.org/show_bug.cgi?id=65607

    After installing libtxc_dxtn, we need to tell the r600 Gallium driver to use it. This is done by an env var. Edit your /etc/env.d/99local and append this:

    R600_ENABLE_S3TC=1

    Now run ‘env-update’ and restart X. S3TC should now be supported. Here for example, if I run VMWare Workstation and have Windows Vista or 7 installed in it as a guest, I can now activate Aero and it will work. Many games that previously only ran with fglrx under Wine will now also work with the FOSS driver.

    We’re not done yet. Mesa does not support floating point textures. But if you use mesa-9999, it does. But you need to build it with the “bindist” USE flag disabled. In other words, in your package.use:

    media-libs/mesa -bindist

    After you rebuild mesa, floating point textures will be supported. That means even more games in Wine should work, as we now have much better OpenGL conformance.

  3. PS:
    To verify that S3TC and FP textures are supported, this command:

    glxinfo | grep 'float\|s3tc'

    Should print:

    GL_NV_texgen_reflection, GL_NV_texture_env_combine4, GL_S3_s3tc,
    GL_EXT_texture_compression_s3tc, GL_EXT_texture_env_dot3,
    GL_ATI_draw_buffers, GL_ATI_texture_env_combine3, GL_ATI_texture_float,
    GL_ARB_half_float_pixel, GL_ARB_occlusion_query2, GL_ARB_point_sprite,
    GL_ARB_texture_float, GL_ARB_texture_rectangle,
    GL_ATI_texture_compression_3dc, GL_EXT_packed_float,
    GL_ARB_half_float_vertex, GL_ARB_instanced_arrays,

  4. You are wrong in the -video_cards_radeon useflag…
    It just enables global support for all radeon families where you can finegrain it later by using r600.

    Gallium useflag control building of the gallium infrastructure, where classic useflag enables the old mesa code.

    Also for best performance llvm useflag should be seriously turned ON.
    32b libraries are handled in the package masked opengl package, where they should use latest trunk instead of the stable stuff.

    For the xorg.conf you should have EMPTY xorg.conf completely and just use xorg.conf.d for your special input device options if you need so.

    Also i wrote nice guide howto migrate from fglrx to radeon and it is on x11 project page.

    Those are just my 2c :)

    • Last I checked, all the radeon code for <r600g was still built when it wasn't explicitly disabled. I had multiple entries in the 'eselect mesa' output that I didn't need, so there was some hidden build going on, even when I only wanted the gallium/r600 code enabled.

    • An xorg.conf does indeed not exist at all here. And the “Mode 0666″ thingy is only needed for fglrx (and I’m not sure if it’s still needed anyway with latest fglrx versions.)

  5. My first reply some hours ago seems to have disappeared without ever appearing…

    Re: options that still work:

    See the recently updated radeon (4) manpage. It now has separate sections for kms, ums, and both, so it’s clear what options apply to each. It doesn’t appear to make a distinction between gallium and classic drm, however. Maybe the options listed apply to the ddx (which is still Driver “radeon”) regardless of which OpenGL driver, classic or gallium, is used? As for kms, there’s rather fewer options than ums, but that’s to be expected since kms is newer and doesn’t have the number of corner-cases to configure for, and also because with kms some of the options are kernel or module command-line options, now.

    Re: power management:

    With recent kernels (IIRC starting around 2.6.35 but that’s just a guess, and you’re talking .38, which should certainly have it), that can be configured “live” by poking the relevant sysfs files:

    /sys/class/drm/card0/device/power_*

    There are two files of interest, power_method and power_profile.

    power_method: two possible values:
    profile (default), dynpm (card hardware pm).

    If profile is set, then the power_profile file comes into play: four possible values:
    default
    low
    high
    auto (low/high depends on ac/batt).

    The defaults were formerly hardcoded to default profile.

    dynpm wasn’t considered stable as of first introduction, I believe because there were still assumptions in the code that the clock rate was under software control, so having the hardware change it out from under the software wasn’t yet the stablest option, but that’s probably improved some by now, and may at some point be the default at least for some chips.

    Obviously gamers may wish to set high for gaming, while laptop users and those worried about fan noise or overheating may prefer low.

    FWIW, I mainly use OpenGL for kde’s visual effects. I experimented a bit but eventually commented the entries I had in the script I was running (from local) at startup. But I left it and the comments I had explaining it to myself there for reference and referred to it for the explanation above.

    @ Cynyr: Yes, there’s a way to build the 32-bit on 64-bit. There might be an easier way, I’m not sure, but certainly, the 32-bit chroot method should work. Follow the links to the documentation for it from amd.gentoo.org . That’s probably overkill if that’s /all/ you want to do, but it’s certainly /possible/, and quite well documented, as well. I use a slight modification of that idea for the 32-bit chroot build-image for my netbook, which is then rsynced over so the netbook does no building or package installation at all. =:^)

    Duncan

  6. Nothing to add that hasn’t already been said, but I’ve found fglrx hates my ~amd64 + zen-sources setup, so I’ve been using the open driver for months anyway. It’s fast enough to play minecraft + ut2k4 decently and that’s good enough for me (60fps would be nice though…)

  7. “… slowdown and lower frames. This mostly occurs on very large, detailed maps…”
    I also noticed this when I tried UT2004 for a first time and I also noticed that under Windows same levels run a lot more smoother. (Running nvidia card at the time, so almost same speed with both OpenGL drivers).

    With little experimenting I seemed to had it figured out. You need to enable
    UseVBO=1 in the OpenGL section of ~/.ut2004/System/UT2004.ini .
    If I understand correctly this is used for vertex shaders.
    It have probably been disabled as some drivers may hang when using it, so you’ve been warned.

    (Yes, I know this post is one year old. Still, it may be useful.)

Comments are closed.