fglrx

From Gentoo-en
Jump to: navigation, search

Catalyst is the name of the proprietary driver for AMD/ATI based chipsets for Linux and Windows. It is also known as fglrx and x11-drivers/ati-drivers in the Portage tree.

Alternate Drivers

Before starting this guide, take a look at the other drivers available for your card.

Requirements

fglrx drivers require a DirectX 10 compatible processing unit or newer. These started with the R600 or Radeon HD 2000 series. Any older cards must be referred to the open source driver radeon.

In addition, any older Catalyst drivers or nVidia drivers should be removed, especially if they are proprietary. Open source drivers can sometimes co-exist, but this is not recommended.

Installing

Kernel Configuration

Ensure that any old kernel configurations which include DRI or KMS are disabled and the kernel is recompiled.

Linux Kernel Configuration: Enabling radeon driver and KMS
Device Drivers  --->
	Graphics support  --->
		< > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->

Configure /etc/make.conf

Set the VIDEO_CARDS variable to automatically pull the driver:

File: /etc/make.conf <-- this file is moved to /etc/portage/make.conf
...
VIDEO_CARDS="fglrx"
...

Install

Finally, rebuild xorg-server to pull in the new driver:

# emerge -av1 x11-base/xorg-drivers

Configure X

Using aticonfig

AMD ships fglrx with a free tool to quickly get a working xorg.conf, which can also be used to further tweak the configuration.

# /opt/bin/aticonfig --initial --input=/etc/X11/xorg.conf

This backups your xorg.conf and modifies it for fglrx. Eselect can be used to tell X.Org about fglrx:

# eselect opengl set ati

Fglrx also needs to know what xvmc implementation to use. If you haven't already installed the eselect module, emerge it now:

# emerge app-admin/eselect-xvmc

Finally select the ATI xvmc implementation:

# eselect xvmc set ati

Now you can (re)start X, and things should be fine. If not, continue to #Troubleshooting.

Manually

File: /etc/X11/xorg.conf
Section "Monitor"
    Identifier      "LCD"
EndSection
Section "Device"
    Identifier      "RadeonHD"
    Driver          "fglrx"
EndSection
Section "Screen"
    Identifier      "Primary Screen"
    Device          "RadeonHD"
    Monitor     "LCD"
    DefaultDepth    24
    SubSection "Display"
        Depth           24
        Modes   "1366x768"
    EndSubSection
EndSection


Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          "Primary Screen"
EndSection

Change Modes to the correct resolution for the connected panel. Multiple resolutions are ordered from highest to lowest, separated by a space.

Tweaks

Setting the following option fixes an issue with unfocused windows having black bars and boxes around them:

Option	    "XAANoOffscreenPixmaps" "true"

This option may improve video performance on older cards:

Option	    "TexturedVideo" "On"

Crossfire X

Crossfire (or lately CrossfireX) is AMD's branding for their multi-GPU solution similar in purpose to nvidia's SLI, primarily allowing use of multiple gfx cards to boost performance via AFR. Their various dual-GPU gfx cards (e.g. HD4870x2) usually present themselves on the system bus like two gfx cards with an always-enabled (or at least tricky to disable) Crossfire link - so bear in mind certain Crossfire-specific setup details can apply to them too, not just full multiple-gfx-cards-in-multiple-slots setups.

With aticonfig

FIXED

aticonfig --list-adapters
* 0. 03:00.0 ATI Mobility Radeon HD 3870 X2
  1. 06:00.0 ATI Mobility Radeon HD 3870 X2

* - Default adapter
aticonfig --lsch
 CrossFire chain for adapter 0, status: disabled
   0. 03:00.0 ATI Mobility Radeon HD 3870 X2
   1. 06:00.0 ATI Mobility Radeon HD 3870 X2
 
 CrossFire chain for adapter 1, status: enabled
   1. 06:00.0 ATI Mobility Radeon HD 3870 X2
   0. 03:00.0 ATI Mobility Radeon HD 3870 X2

Read

aticonfig --help

The section "Multiple display adapter options"

To create a Crossfire chain use:

 aticonfig --adapter=0,1 --cfa

To activate it use:

aticonfig --adapter=0,1 --crossfire=on

After this restart X.

Manually

FIXME

Crossfire Supported Applications

Even once "enabled", crossfire is actually only used "out-of-box" for a small set of officially tested and whitelisted programs on both windows and linux. The list is fairly short for windows, and tiny on linux. So you will not actually see any real speed-up for most programs on linux after setting up Crossfire unless you also unofficially tweak undocumented bitfields in /etc/ati/atiogl.xml to enable Crossfire on a program-by-program basis (it just matches on the program's names). If you do so, it's obviously not AMD-supported for programs not on the whitelist: there may be bearable minor or nasty major graphical glitches, great near-linear or no performance benefits or even performance degradation, maybe even segfaults, just depending on the program is structured and how it hits the gpu(s) - AMD provides guidance (1, 2) for developers on how best to structure rendering calls so that CrossFire works well, but of course not all programmers will have read it or care to take it into account, much less nudge AMD to have their programs tested and included on the official whitelist, so YMMV.

File: /etc/ati/atiogl.xml
<!-- Neverball -->
<profile exename="neverball">
  <CrossFireCaps>0x00000001</CrossFireCaps>
</profile>

<!-- Unigine Heaven Demo -->
<profile exename="Heaven_x64">
  <CrossFireCaps>0x00000001</CrossFireCaps>
</profile>

<!-- Sauerbraten -->
<profile exename="sauer_client">
  <CrossFireCaps>0x00000001</CrossFireCaps>
</profile>

Switchable Graphics

Switchable graphics are supported without special configuration. Simply launch the Catalyst Control Panel within X and navigate to that section to adjust settings. Unfortunately this setup cannot dynamically switch cards, X must be restarted.

Troubleshooting

Startup problems

AGP

By default, the driver uses the Internal AGPGART. Sometimes the internal one doesn't work, and you will have to use the one provided with the kernel. Search your xorg.conf for the line that has the option "UseInternalAGPGART." Simply change the "yes" to "no."

Note: If you can't find it, add it. In the Section "Device" right under Driver "fglrx"
File: /etc/X11/xorg.conf
...
        Option "UseInternalAGPGART" "no"
...

Now simply add the modules to /etc/modules.autoload.d/kernel-2.6.

File: /etc/modules.autoload.d/kernel-2.6
...
agpgart
intel-agp # change intel-agp to your chipset. eg: via-agp, nvidia-agp sis-agp.
fglrx
...

Finally, run

# update-modules

Then you can reboot and everything should work. If you are having problems, check dmesg and /var/log/Xorg.0.log for more info.

Unable to modprobe fglrx

If the module cannot be loaded ("operation not permitted"), check that the kernel's Direct Rendering Manager is disabled:

Linux Kernel Configuration:
Device Drivers  --->
    Graphics support  --->
        < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->

If you are using a precompiled kernel you can try to unload the dri and radeon module before modprobing fglrx.

# modprobe -r dri radeon # modprobe fglrx

PreInitDAL failed

This can happen if multiple monitors were detected, even though you don't have multiple monitors. To fix it, use aticonfig --enable-monitor and /opt/bin/aticonfig --force-monitor to specify which monitors you use. Example, if you have a VGA + DVI card, but only use your VGA connection:

# aticonfig --enable-monitor=crt1 --force-monitor=crt1,notmds1

Some had success with disabling framebuffer in kernelconfig, recompile, reboot! This happend as i upgraded from 8.28.8 to 8.32.5.

Cannot switch to better resolution / refresh rate on VGA connected display

Warning: newer ATI (AMD) video cards have a restriction of 60Hz. This cannot be overwriten. The method below is working with older cards (tested with Hd 4200). Because VGA does not have EDID, what is supposed to communicate with the display device, and ask for working display resolutions and refresh rates. Because the EDID is failed, ATI falls back some driver default settings, what are not too bad, but are not the best. First thing to do, is to count the resolutions and refresh rates you want to use, and your display is supporting. Get a software, that can calculate the exact refresh rates for you. If you are trying refresh rates / resolutions beyond your display's capacity, it can cause damage to your display. Look into the /var/log/Xorg.0.log, and find out, what display are Xorg is currently using (0-CRT / VGA-0), for some reason, my config was ignoring the correct name, so use, what Xorg (radeon) is trying to use.

File: /var/log/Xorg.0.log
...

[    26.726] (II) fglrx(0): Connected Display0: CRT1
[    26.726] (II) fglrx(0):  Display0: Failed to get EDID information. 
[    26.894] (II) fglrx(0): EDID for output DFP1
[    26.894] (II) fglrx(0): Cannot get EDID information for CRT1
[    26.894] (II) fglrx(0): EDID for output CRT1     <<< found device on VGA-0 named monitor

...

If you have the correct refresh rates, you need to edit the xorg.con like:

File: /etc/X11/xorg.conf
...
Section "Monitor"

##      This was an annoying mistake from aticonfig --initial :(
#       Identifier   "aticonfig-Monitor[0]-0"
        Identifier   "CRT1"              <<< this must be the same as the Xorg.0.log shows
        HorizSync    31.5 - 92.0
        VertRefresh  40.0 - 150.0
        ModeLine     "800x600_60.00" 38.2 800 832 912 1024 600 601 604 622 -hsync +vsync       <<< display mode timings, generated from resolution / refresh rate
        ModeLine     "800x600_75.00" 48.9 800 840 920 1040 600 601 604 627 -hsync +vsync
        ModeLine     "800x600_80.00" 53.1 800 840 928 1056 600 601 604 629 -hsync +vsync
        ModeLine     "800x600_85.00" 53.1 800 840 928 1056 600 601 604 629 -hsync +vsync
        ModeLine     "1024x768_60.00" 64.1 1024 1080 1184 1344 768 769 772 795 -hsync +vsync
        ModeLine     "1024x768_75.00" 81.8 1024 1080 1192 1360 768 769 772 802 -hsync +vsync
        ModeLine     "1024x768_80.00" 88.5 1024 1088 1200 1376 768 769 772 804 -hsync +vsync
        ModeLine     "1280x1024_60.00" 108.9 1280 1360 1496 1712 1024 1025 1028 1060 -hsync +vsync
        ModeLine     "1280x1024_75.00" 138.5 1280 1368 1504 1728 1024 1025 1028 1069 -hsync +vsync
        ModeLine     "1280x1024_80.00" 149.6 1280 1376 1512 1744 1024 1025 1028 1072 -hsync +vsync
        Option      "DefaultModes" "false"              <<< asking xorg, to use the custom refresh rates above
        Option      "VendorName" "ATI Proprietary Driver"
        Option      "ModelName" "Generic Autodetecting Monitor"
#       Option      "DPMS" "true"
        Option      "PreferredMode" "1280x1024"         <<< what resolution you prefer at Xorg start up
        Option      "TargetRefresh" "80"              <<< what refresh rate you prefer at Xorg start up 
        Option      "UseEDID" "false"                   <<< disabling EDID, important
EndSection
...

Section "Device"

#       Option      "UseFastTLS" "0"
#       Identifier  "aticonfig-Device[0]-0"
        Identifier  "Radeon"
#        Driver      "radeon"                     <<< with different monitor name (VGA-0) it seems to work with fglrx too
       Driver      "fglrx"
        Option      "DynamicClocks" "on"
        Option      "UseEDID" "false"
        Option      "Monitor-CRT1" "CRT1"      <<< redirect to the monitor's name
        BusID       "PCI:1:5:0"
EndSection

...

Remember, these are my settings, may not work for you. You must recalculate your display modes, this can cause permanent demage to your display!

Crashes/freezes

X crashes when playing a video using Xv

Even though Xv is scheduled for launch, the bindings don't work correctly yet. Add the following option to your Xorg.conf file in the device section:

File: /etc/X11/xorg.conf
...
 Option "TexturedVideo" "on"
...

System freezes after logout with GDM or KDM

If you use GDM modify /etc/X11/gdm/custom.conf

File: /etc/X11/gdm/custom.conf
...
[daemon]
AlwaysRestartServer=true

If you use KDM add to the [X-:*-Core] section the following

File: /usr/share/config/kdm/kdmrc
...
[X-:*-Core]
...
TerminateServer=true
...

Any 3D app crashes fglrx

If you are unable to use any 3d applications and get this error instead:

FGLTexMgr: open of shared memory object failed (Function not implemented)
__FGLTexMgrCreateObject: __FGLTexMgrSHMmalloc failed!!!
fglX11AllocateManagedSurface: __FGLTexMgrCreateObject failed!!
FGLTexMgr: open of shared memory object failed (Function not implemented)
__FGLTexMgrCreateObject: __FGLTexMgrSHMmalloc failed!!!
fglX11AllocateManagedSurface: __FGLTexMgrCreateObject failed!!
FGLTexMgr: open of shared memory object failed (Function not implemented)
__FGLTexMgrCreateObject: __FGLTexMgrSHMmalloc failed!!!

Then you do not have tmpfs mounted on /dev/shm, which the driver requires. To mount this, add to following line to /etc/fstab:

File: /etc/fstab
...
tmpfs     /dev/shm           tmpfs        defaults            0 0

Then just tell mount to update based on the new information:

# mount /dev/shm

Mplayer in full-screen

If you have problems with mplayer not playing in full screen, set

File: /etc/X11/xorg.conf
...
Option "VideoOverlay"       "on"
...

Into your device section.

Runtime warnings/errors

libGL: failed to open DRM

If you get this error (for example if you use glxgears):

libGL error: failed to open DRM

then you are trying to run as a user that doesn't have permission to use the DRI (root is the default allowed user). To let all users access the DRI, add the following section to your /etc/X11/xorg.conf:

File: /etc/X11/xorg.conf
...
Section "dri"
   Mode 0666
EndSection
...

Alternatively, you can use the group "video" to control access. If you want to do this, add the following section to your /etc/X11/xorg.conf:

File: /etc/X11/xorg.conf
...
Section "dri"
  Group "video"
  Mode 0660
EndSection
...

And then add the users which use X to the video group:

# gpasswd -a john video

No direct rendering

If fglrxinfo says "mesa3d.org" instead of "ATI" after A SUCCESSFUL modprobe of fglrx, for example like so:

display: :0.0 screen: 0
OpenGL vendor string: Mesa project: www.mesa3d.org
OpenGL renderer string: Mesa GLX Indirect
OpenGL version string: 1.2 (1.5 Mesa 6.2.1)

you may need to do

# emerge -av eselect-opengl # eselect opengl set ati # source /etc/profile

Also, make sure DRI is enabled and started with the proper permissions set in your xorg.conf as well, as explained in this section. A proper output looks like follows:

display: :0.0  screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: MOBILITY RADEON X300 Generic
OpenGL version string: 2.0.5695 (8.23.7)

OpenGL should work properly now with DRI enabled. Check with glxinfo.

ACPI script missing finger command

If you get the following errors in /var/log/acpid:

/etc/acpi/ati-powermode.sh: line 8: finger: command not found
/etc/acpi/ati-powermode.sh: line 10: finger: command not found

Install the netkit-fingerd package, which provides the finger command.

# emerge -av netkit-fingerd

Open ACPI failed (/var/run/acpid.socket) (No such file or directory)

ACPI service is probably not runing.

# /etc/init.d/acpid start

Failed to load module "dri2" (module does not exist, 0)

This is normal. Fglrx doesn't use the dri and dri2 modules.

amdcccle not starting (amdcccle already running!)

Try with:

# amdcccle -multiinstance

Slow window resizing and update

# rm /etc/ati/amdpcsdb

This is the Catalyst Control Center persistence. Sometimes (after downgrading ati-drivers?) this database can get messed up and cause major laggage, in particular for 2D operations like window resizing or window updates.

Scaling issues with multiple monitors

If you have two or more monitors with different size and/or resolution it may be, that the scaling value set in the Catalyst Control Center is not persistent and has to be reset after every time the XServer is started. To fix this, execute:

# aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0