Graphics drivers

From Gentoo-en
Jump to: navigation, search

X.Org TOC

Hardware Discovery

What driver you need depends on the chipset and graphics card you're using. So the first thing you'll need to do now is to identify these. To identify the bus chipset and graphic card, you use lspci(part of sys-apps/pciutils). In the example below, we use grep to filter for all AGP, PCI-e buses and all VGA and Display controllers.

/usr/sbin/lspci | egrep "AGP|PCI Express|VGA|Display"

For a more verbose output you can run,

/usr/sbin/lspci -vvv | egrep "AGP|PCI Express|VGA|Display"

The resulting output of lspci would be something like:

00:1e.0 PCI bridge: nVidia Corporation nForce2 AGP (rev c1)
03:00.0 VGA compatible controller: ATI Technologies Inc RV535 [Radeon X1650 Series] (rev 9e)
03:00.1 Display controller: ATI Technologies Inc RV535 [Radeon X1650 Series] (rev 9e)

The second line is interesting: apparently, this PC uses a Radeon X1650 GPU, which has an RV535 chipset. Also note that, based on the information on the first line, this is an AGP card.

If you get less useful output from lspci, your hardware may be newer the available PCI information database. If you have an internet connection, you can fix this by running
update-pciids

Choosing a Graphics Driver

Once you know what card you have, you should probably follow a more specific guide than this (if one exists). All of the major graphics card drivers have an article on this wiki, just select the one that is the most appropriate for your use. If your driver doesn't have a specific guide, continue to follow this guide.

AMD/ATI

As of 2011-11, you have two drivers to choose between, the closed-source official driver and the open-source alternative. For an in-depth comparison across 40 cards from 2011-10, read this phoronix article.

radeon (x11-drivers/xf86-video-ati)
The radeon driver is an open-source driver for AMD/ATI graphics cards. See radeon for further instructions. If your card is pre-DirectX 10, you will need to use this driver.
ATI Catalyst / fglrx (x11-drivers/ati-drivers)
The proprietary binary driver for AMD/ATI graphics cards. See fglrx for full instructions. This driver no longer supports pre-DirectX 10 cards, but does support Crossfire.
RadeonHD (Obsolete)
This is an obsolete branch of the radeon driver which has since been merged into radeon. If you see a guide recommending that you use the radeonhd driver, please ask the author to update it.

Intel

intel
The intel driver is for most Intel on-board graphic adapters, of the 'Intel Graphic Media Accelerator' series. Set VIDEO_CARDS to intel in /etc/make.conf. The package is named x11-drivers/xf86-video-intel in Portage. See Intel GMA for further instructions.

nVidia

See Nvidia_Drivers for more detailed explanations of nVidia drivers and supported models for each.

nouveau
Nouveau is a reverse engineered open source driver for nVidia chips. Set VIDEO_CARDS to nouveau in /etc/make.conf. The package is named x11-drivers/xf86-video-nouveau in Portage. See Nouveau for further instructions.
nv
nv is the official open source driver for nVidia chips. Set VIDEO_CARDS to nv in /etc/make.conf. The package is named x11-drivers/xf86-video-nv in Portage.
nvidia
nvidia is the proprietary driver for nVidia chips. Set VIDEO_CARDS to nvidia in /etc/make.conf. The package is named x11-drivers/nvidia-drivers in Portage. See nvidia for further instructions.

Trident

trident
Trident video cards are found in many laptop computers, mostly the of the Trident CyberBlade family chipset. Set VIDEO_CARDS to trident in /etc/make.conf. The package is named x11-drivers/xf86-video-trident in Portage.

VIA

openchrome
openChrome is an open-source graphics driver for some VIA IGPs. Set VIDEO_CARDS to via in /etc/make.conf. The package is named x11-drivers/xf86-video-openchrome in Portage.

Kernel Configuration

Graphics Bus

First, enable support for your graphics bus, either AGP, PCI or PCI-E. Some graphics card options will not appear until you do this.

PCI-Express

If your graphics card sits on a PCI-e bus, you'll need to enable PCI Express support.

Linux Kernel Configuration: Enable PCI-Express
Bus options (PCI etc.)  --->
    [*] PCI Express support

AGP Cards

Linux Kernel Configuration: Enable AGP chipset
Device Drivers  --->
    Graphics support  --->
        <M> /dev/agpgart (AGP Support)  --->

Direct Rendering

If your graphics driver supports it, you should enable the DRM module in your kernel configuration, and a corresponding kernel DRM driver. The various DRM modules are listed under Direct Rendering Manager (XFree86 4.1.0 and higher DRI support). If you are unsure what driver supports what card, highlight the option and press h to see the help screen.

Lastly, enable your graphics cards DRM module under Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> if available:

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


VIDEO_CARDS

VIDEO_CARDS is an USE flag alias for graphics cards. When x11-base/xorg-drivers gets emerged, the VIDEO_CARDS variable causes the appropriate x11-drivers/xf86-video-* drivers to be pulled-in. So an emerge of xorg-server will pull in x11-base/xorg-drivers), and with VIDEO_CARDS="radeon", this will pull in x11-drivers/xf86-video-radeon.

VIDEO_CARDS also affects media-libs/mesa, where it acts as an ordinary USE flag and causes chipset-specific code to be built. So setting VIDEO_CARDS="radeon" will when mesa is emerged also build its radeon DRI specific libraries. These libraries must be available to the X server if you want direct rendering to work.

You should set your VIDEO_CARDS variable to contain every driver that you intend to use, separated by spaces.

To see your options, you can run:

emerge -pv xorg-drivers

and look at the the output following VIDEO_CARDS,

[ebuild  N    ] x11-base/xorg-drivers-...VIDEO_CARDS="..."...

Add the VIDEO_CARDS variable with the driver you want in /etc/make.conf,

File: /etc/make.conf
...
VIDEO_CARDS="nvidia nv"
...

Then, you should update your system for the new driver to be taken into account:

emerge -aDNv system

Direct & Indirect Rendering

X can handle graphics in two different ways, indirect and direct. If you are operating a normal desktop or laptop, you most likely want Direct Rendering, as this is faster. X will try to enable both hardware-accelerated indirect rendering (AIGLX) and Direct Rendering if they are both supported by your driver, card, and your build-options (USE flags).

Direct Rendering

With Direct Rendering, applications bypass the X protocol and talks to the hardware drivers directly. This has the benefit of being faster as it skips the middleman, but avoids the X servers network abstraction model. With buggy drivers, this may make your system more unstable, but is generally no loss if you never intend to use X to display remotely. To have the X server allow for direct rendering you'll need to have the DRI extension enabled, so make sure you emerged x11-base/xorg-server with the -minimal USE-flag disabled.

It's also possible that the driver your VIDEO_CARDS variable pulled in carries the dri USE-flag, if so, enable it.

File: /etc/make.conf
...
USE="$USE dri"
...
File: /etc/portage/package.use
...
x11-base/xorg-server -minimal
...
Then run
emerge -DNv xorg-server

Now check if direct rendering is working.

emerge -v x11-apps/mesa-progs

glxinfo,

glxinfo | grep "direct rendering"

This should output:

direct rendering: Yes

A user who wants Direct Rendering must be in the video group:

gpasswd -a <USER> video

Indirect Rendering

The indirect method is when an application talks to the the X server, which in turn conveys this to the hardware drivers and then returns to the application through the X server. An extension to the X server called GLX with AIGLX enabled allows for the indirect rendering to be hardware accelerated. This requires that x11-base/xorg-server was emerged with -minimal and your graphics drivers actually do hardware acceleration. To check if your X server is AIGLX enabled, run:

grep "AIGLX enabled" /var/log/Xorg.0.log

This should output:

(==) AIGLX enabled


2D Rendering

2D rendering is done through the driver architectures XAA, EXA or UXA, allowing for 2D drawing like lines, glyphs, etc. XAA is the oldest driver architecture and is support by almost all drivers. EXA, superseding XAA, uses the X Render extension(RENDER) which, depending on driver support, gives the X server greater features and performance. UXA, which is set to supersede EXA is basically EXA reimplemented utilizing the GEM memory manager. To see what renderer the X driver uses, run:

grep "acceleration architecture" /var/log/Xorg.0.log

This should tell you what architecture your driver is using. Example:

(**) RADEON(0): Using EXA acceleration architecture

If you want to change the architectures used, you'll need to set the "AccelMethod" option under your graphics cards "Device" section:

File: /etc/xorg.conf
...
Section "Device"
    ...
    Option    "AccelMethod" "EXA"
    ...
EndSection
...

See your graphics driver man page for more information. They are usually named like the driver, i.e, radeon or intel.

Framebuffer

Framebuffer allows for high resolutions during boot and on your terminals. Please follow the Framebuffer guide for information.