In this tutorial I am going to show you how to configure two graphic card – Intel and Amd – on most laptops using proprietary and open source drivers and how to switch between them.

Overview

Most of current laptops include two graphic cards with different abilities and power consumptions – often known as hybrid graphic.

The fist one – IDG – integrated graphic – allow power save to safe our battery and low-end 3D rendering. Often it is using for daily work.

The second one – DDG – dedicated graphic -major power consumption with high 3D rendering performance, ussually suitable for playing games, 3D graphic, rendering etc.

This model gives to user the possibility of choice the graphic card he need. ….doplnit

In this article I will show you how to successfully install INTEL/ATI proprietary and open-source drivers.

Open-source drivers

The best and easy way is to use open-source drivers. It need not any invention. Only if you want to specify some device details.

So install ati and intel drivers and you are done

# pacman -Sy xf86-video-ati xf86-video-intel

By default, without any xorg.conf file the system starts with intel driver. To use radeon card you have two possibilities:

1. Using conf file

If you want manual configuration, create /etc/X11/xorg.conf.d/20-radeon.conf , and add the following:

Section "Device" Identifier "Radeon" Driver "radeon" EndSection

To this file you can specify more options of course.

2. Using PRIME

PRIME is one of the method to switch between IDG and DDG. For me it works fine so this is my choice.

Firstly we need to find our graphic card:

$ xrandr --listproviders

you can see two graphic card

Providers: number : 2 Provider 0: id: 0x7d cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 4 associated providers: 1 name:Intel Provider 1: id: 0x56 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 1 associated providers: 1 name:radeon

The command xrandr --setprovideroffloadsink provider sink can be used to make a render offload provider send its output to the sink provider (the provider which has a display connected). The provider and sink identifiers can be numeric (0x7d, 0x56) or a case-sensitive name (Intel, radeon).

$ xrandr --setprovideroutputsource radeon Intel or

$ xrandr --setprovideroutputsource 0x7d 0x56

Now, you can choose your discrete card for the applications who need it the most ( 3D modellers, games …) by prepending the DRI_PRIME=1 environment variable:

$ DRI_PRIME=1 your_progam

For example:

$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"

gives the output:

OpenGL renderer string: Gallium 0.4 on AMD TURKS

compare with

$ glxinfo | grep "OpenGL renderer" OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile

I suppose it is trivial to run xrandr –setprovideroutputsource radeon Intel

during the DE starts – KDE, GNOME, XFCE4 ….

Proprietary drivers

This method is more difficult and need more user inventions. The catalyst drivers, because of their slow development, are not at official repository, we have to build it form AUR.

The best way is to install catalyst-total package which include the driver, the kernel utilities and the 32 bit kernel utilities.

$ yaourt -S catalyst-total

The second problem we have to solve – catalyst drivers needs xorg up to version 1.17, so we have to downgrade xorg server.

Using Vi0L0’s repository it is easy. Add the repository above all other repositories in pacman.conf

[xorg117] Server = http://catalyst.wirephire.com/repo/xorg117/$arch ## Mirrors, if the primary server does not work or is too slow: #Server = http://mirror.hactar.bz/Vi0L0/xorg117/$arch

Upgrade system, dont afraid to remove all conflict packages

# pacman -Syuu

After this it is necessary to configure Xorg – create /etc/X11/xorg.conf file. For this we can use aticonfig:

# aticonfig --initial

We can check and correct the config file . For example:

Section "ServerLayout" Identifier "aticonfig Layout" Screen 0 "aticonfig-Screen[0]-0" 0 0 EndSection Section "Module" # This loads the DRI/GLX modules Load "glx" Load "dri" Load "dri3" Load "GLcore" Load "dbe" Load "extmod" EndSection Section "ServerFlags" # Option "AutoAddDevices" "False" Option "AllowEmptyInput" "no" EndSection Section "Monitor" Identifier "aticonfig-Monitor[0]-0" Option "VendorName" "ATI Proprietary Driver" Option "ModelName" "Generic Autodetecting Monitor" Option "DPMS" "true" EndSection Section "Device" Identifier "aticonfig-Device[0]-0" Driver "fglrx" Option "TexturedXrender" "true" Option "UseFastTLS" "0" Option "OpenGLOverlay" "0" Option "XaaNoOffscreenPixmaps" "false" BusID "PCI:1:0:0" // sometimes this parametr need to be corrected - try check with lspci EndSection Section "Screen" Identifier "aticonfig-Screen[0]-0" Device "aticonfig-Device[0]-0" Monitor "aticonfig-Monitor[0]-0" DefaultDepth 24 EndSection Section "DRI" Mode 0666 # May help enable direct rendering. EndSection

To switch between graphical cards we can use PowerXpress support.

PowerXpress technology allows switching notebooks with dual-graphic capability from integrated graphics (IGP) to discrete graphics either to increase battery life or to achieve better 3D rendering capabilities.

The easiest way is to use pxp_switch_catalyst switching script that will perform some additional usefull operations:

Switching xorg.conf – it will rename xorg.conf into xorg.conf.cat (if there is fglrx inside) or xorg.conf.oth (if there is intel inside) and then it will create a symlink to xorg.conf , depending on what you chose.

– it will rename into (if there is fglrx inside) or (if there is intel inside) and then it will create a symlink to , depending on what you chose. Running aticonfig --px-Xgpu .

. Running switchlibGL .

. Adding/removing fglrx into/from /etc/modules-load.d/catalyst.conf .

Usage:

# pxp_switch_catalyst amd # pxp_switch_catalyst intel

and restart the X server

Another posibility is to have one X server runnig with IDG (Intel) and more consumable programs runs at second X server. Boot your DE with ATI config then rename xorg.conf

# mv /etc/X11/xorg.xonf /etc/X11/xorg.conf.ati

and restart X server. Tt will use the Intel driver by default instead of fglrx. To start the second X server with fglrx (ATI) driver:

method – To start the second X server using fglrx, simply move xorg.conf back to the proper place ( /etc/X11/xorg.conf ) before starting second X session. # mv /etc/X11/xorg.xonf.ati /etc/X11/xorg.conf This method even allows you to switch between running X sessions. When you are done using fglrx, move xorg.conf again. method – using xrun xcript

this method is almost the same as the first one, but instead of copying xorg.conf back to proper place it is possible to run script and inside it specify the location of xorg.conf file

– make executable script – for example xrun

# nano /usr/bin/xrun

#!/bin/bash # calculate first available VT LVT=`fgconsole --next-available` # calculate first usable display XNUM="-1" SOCK="something" while [ ! -z "$SOCK" ] do XNUM=$(( $XNUM + 1 )) SOCK=$(ls -A -1 /tmp/.X11-unix | grep "X$XNUM" ) done NEWDISP=":$XNUM" if [ ! -z "$*" ] # generate exec line if arguments are given then # test if executable exists if [ ! -x "$(which $1 2> /dev/null)" ] then echo "$1: No such executable!" # if running from X, display zenity dialog: [ -z "$DISPLAY" ] || zenity --error --text="$1: No such executable!" 2> /dev/null exit 127 fi # generate exec line EXECL="$(which $1)" shift 1 EXECL="$EXECL $*" EXECPH="" # prepare to start new X sessions if no arguments passed else EXECL="" EXECPH="New X session" fi # if runing from X, display zenity dialog: [ -z "$DISPLAY" ] || zenity --question --title "Launch?" --text="Will launch \"$EXECL$EXECPH\" tty$LVT X display $NEWDISP Continue?" 2> /dev/null || exit 1 echo "Will launch \"$EXECL$EXECPH\" on tty$LVT, X display $NEWDISP..." [ -z "$DISPLAY" ] && sleep 1s # This flag is used for indication of unaccessible or broken DRI. # It is set, for example, when using fglrx+compiz-manager. # Some games will refuse to start if it is set. # Unsetting it should not do any harm, and can be useful. unset LIBGL_ALWAYS_INDIRECT ########################################################## # main execution xinit $EXECL -- $NEWDISP vt$LVT -config xorg1.conf -nolisten tcp -br & ########################################################## # set our new dislplay DISPLAY=$NEWDISP # wait some time for X to load sleep 4s # then we set useful parameters # disable non-linear mouse acceleration xset m 1 0 # disable hard-coded default 10m screensaver xset s 0 0 # while X is running, persistently do something useful # i.e. prevent apps from enabling mouse acceleration and screensaver while xset -q > /dev/null do xset m 1 0 xset s 0 0 sleep 3s done wait sleep 5

Make it executable

# chmod +x /usr/bin/xrun

For the second X session I am using separate config file –xorg1.conf because I had problem with keyboard and mouse on the second screen:

Section "ServerLayout" Identifier "aticonfig Layout" Screen 0 "aticonfig-Screen[0]-0" 0 0 EndSection Section "Module" # This loads the DRI/GLX modules Load "glx" Load "dri" Load "dri3" Load "GLcore" Load "dbe" Load "extmod" EndSection Section "Monitor" Identifier "aticonfig-Monitor[0]-0" Option "VendorName" "ATI Proprietary Driver" Option "ModelName" "Generic Autodetecting Monitor" Option "DPMS" "true" EndSection Section "Device" Identifier "aticonfig-Device[0]-0" Driver "fglrx" Option "TexturedXrender" "true" Option "UseFastTLS" "0" Option "OpenGLOverlay" "0" Option "XaaNoOffscreenPixmaps" "false" BusID "PCI:1:0:0" EndSection Section "Screen" Identifier "aticonfig-Screen[0]-0" Device "aticonfig-Device[0]-0" Monitor "aticonfig-Monitor[0]-0" DefaultDepth 24 EndSection Section "DRI" # May help enable direct rendering. Mode 0666 EndSection Section "ServerFlags" # enable keyboard and mouse Option "AutoAddDevices" "False" Option "AllowEmptyInput" "no" EndSection

The usage of this is quite simple – if you want to run program using powerful graphics card (fglrx) just run it on the second screen using xrun

$ xrun glxgears

The only disadvantage of these two methods is not having 3D acceleration using the Intel driver. 2D acceleration, however, is fully functional.

Conclusion

In this tutorial I’ve showed you possible ways how to use hybrid graphic card in your laptop. I’ve use both method. Today I am using proprietary drivers because of better game performance so everything is tested and working fine.

References

AMD – catalyst on Arch Wiki

https://wiki.archlinux.org/index.php/AMD_Catalyst

AMD – open source drivers – Arch Wiki

https://wiki.archlinux.org/index.php/ATI

Hybrid graphic card – Arch wiki

https://wiki.archlinux.org/index.php/hybrid_graphics

Intel graphic card – Arch Wiki

https://wiki.archlinux.org/index.php/Intel_graphics