[Nix-dev] How to unleash your ATI graphics card on NixOS

Peter Simons simons at cryp.to
Thu Jul 14 22:30:51 CEST 2011


The radeon driver used in Linux by default does not support 3D hardware
rendering on modern ATI chips, like RS880 (Radeon HD 4250). Everything
seems to works fine, but 3D graphics are slow, because rendering actually
takes place on the CPU:

  $ glxinfo | grep renderer
  OpenGL renderer string: Software Rasterizer

Now, to improve graphics performance a *lot*, you need to enable the new
radeon driver in your kernel by setting CONFIG_DRM_RADEON_KMS=y. A kernel
that has been built with that feature is already included in nixpkgs; just
add the lines

  boot.kernelPackages = pkgs.linuxPackages_2_6_38_ati;
  hardware.firmware = [ pkgs.radeonR600 pkgs.radeonR700 ];

to your /etc/nixos/configuration.nix file. You might also want to set:

   services.xserver.videoDrivers = [ "ati" ];

That is not necessary, but this change disables all other video drivers,
and thus saves you some build time and disk space.

Any user who wants to perform hardware rendering must be a member of the
'video' group

  groupmems -g video -a your_username_here

..., otherwise they won't be able to read/write the devices in /etc/dri/.

After you've made those changes, run "nixos-rebuild boot", and reboot. Now
you'll see:

  $ glxinfo | grep renderer
  OpenGL renderer string: Mesa DRI R600 (RS880 9715) 20090101  TCL DRI2

..., or maybe even:

  $ glxinfo | grep renderer
  OpenGL renderer string: Gallium 0.4 on AMD RS880

Now, run some 3D software like stellarium or gravit, and you'll notice the
difference. :-)

If you're still stuck with software rendering even after making those
changes, a good place to check for error messages is /var/log/slim.log.

Last but not least, it might also be a good idea to set the overrides

  {
    packageOverrides = pkgs:
    {
      linux = pkgs.linux_2_6_38_ati;
      linuxPackages = pkgs.linuxPackages_2_6_38_ati;
    };
  }

in ~/.nixpkgs/config.nix, if you have such a file, to ensure that your
user builds use the same kernel the system does.

Have fun.




More information about the nix-dev mailing list