The proprietary NVIDIA driver {{Pkg|nvidia}} does not support dynamic switching like the nouveau driver, and has several other disadvantages, but does allow use of the discrete GPU and has (as of October 2013) a marked edge in performance over the nouveau driver. To enable Optimus, you must install the modesetting video driver, the nvidia driver, and xrandr:

+

The proprietary NVIDIA driver ({{Pkg|nvidia}}) does not support dynamic switching like the nouveau driver (meaning it can only use one driver at a time), and has several other disadvantages, but does allow use of the discrete GPU and has (as of October 2013) a marked edge in performance over the nouveau driver. To enable Optimus, you must install the modesetting and nvidia drivers:

−

{{ic|# pacman -S xf86-video-modesetting nvidia xorg-xrandr}}

+

{{ic|# pacman -S xf86-video-modesetting nvidia}}

+

+

Then install {{ic|xrandr}}:

+

+

{{ic|# pacman -S xorg-xrandr}}

Next, you must create a custom {{ic|xorg.conf}}. You'll need to know the PCI address of the NVIDIA card, which you can find by issuing

Next, you must create a custom {{ic|xorg.conf}}. You'll need to know the PCI address of the NVIDIA card, which you can find by issuing

Line 69:

Line 73:

Driver "nvidia"

Driver "nvidia"

BusID "PCI:''PCI address determined earlier''"

BusID "PCI:''PCI address determined earlier''"

+

# e.g. BusID "PCI:1:0:0"

EndSection

EndSection

Line 93:

Line 98:

xrandr --auto}}

xrandr --auto}}

−

Now reboot to load the drivers, and X should start. If you get a black screen, make sure that there are no ampersands after the two {{ic|xrandr}} command in {{ic|~/.xinitrc}}; if there are ampersands, it appears that the window manager is run before the command finish executing, leading to the black screen.

+

Now reboot to load the drivers, and X should start.

+

+

If you get a black screen when starting X, make sure that there are no ampersands after the two {{ic|xrandr}} command in {{ic|~/.xinitrc}}; if there are ampersands, it seems that the window manager can run before the {{ic|xrandr}} commands finish executing, leading to the black screen.

−

As with the nouveau drivers, you can check if the NVIDIA graphics are being used by install {{Pkg|mesa-demos}} and running

+

As with the nouveau drivers, you can check if the NVIDIA graphics are being used by installing {{Pkg|mesa-demos}} and running

For more information, look at NVIDIA's official page on the topic [http://http.download.nvidia.com/XFree86/Linux-x86_64/319.23/README/randr14.html here].

Revision as of 02:46, 21 October 2013

NVIDIA Optimus is a technology that allows an Intel integrated GPU and discrete NVIDIA GPU to be built into and accessed by a laptop. Getting Optimus graphics to work on Arch Linux requires a few somewhat complicated steps, explained below. There are several methods.

Disabling switchable graphics

If you only care to use a certain GPU without switching, check your BIOS. There should be an option to disable one of the cards. Some laptops only allow disabling of the discrete card, or vice-versa, but it is worth checking if you only plan to use one of the cards. If you want to use both cards, or cannot disable the card you don't want, see the options below.

Using nouveau

The open-source NVIDIA driver (xf86-video-nouveau), allows for dynamic GPU switching using a technology called PRIME. First, install the Intel and nouveau drivers:

# pacman -S xf86-video-intel xf86-video-nouveau

Next, install xorg-xrandr, which allows setting the NVIDIA card as an offload sink of the Intel:

# pacman -S xorg-xrandr

Reboot to load the drivers. You should now be able to start X. The next step is to run the following xrandr command while X is running:

$ xrandr --setprovideroffloadsink nouveau Intel

You can now run programs with the NVIDIA card by adding DRI_PRIME=1 before a command; i.e.

$ DRI_PRIME=1 glxgears

To check if programs are using the NVIDIA graphics and not Intel, install mesa-demos and run

$ DRI_PRIME=1 glxinfo

You should see a line that says OpenGL vendor string: nouveau.

If you don't want to manually run the xrandr command every time you start X, you can add it at the beginning of your ~/.xinitrc. If you want to run every program using the NVIDIA graphics, you can add the line export DRI_PRIME=1 to your ~/.bashrc.

Using nvidia

The proprietary NVIDIA driver (nvidia) does not support dynamic switching like the nouveau driver (meaning it can only use one driver at a time), and has several other disadvantages, but does allow use of the discrete GPU and has (as of October 2013) a marked edge in performance over the nouveau driver. To enable Optimus, you must install the modesetting and nvidia drivers:

# pacman -S xf86-video-modesetting nvidia

Then install xrandr:

# pacman -S xorg-xrandr

Next, you must create a custom xorg.conf. You'll need to know the PCI address of the NVIDIA card, which you can find by issuing

$ lspci

The PCI address is the first 7 characters of the line that mentions NVIDIA. It will look something like 01:00.0. In the xorg.conf, you'll need to format it as #:#:#; e.g. 01:00.0 would be formatted as 1:0:0. Also, if the NVIDIA card has no display devices attached to it (all video goes through the Intel chip), uncomment the line that reads Option "UseDisplayDevice" "none".

Next, add the following two lines to the beginning of your ~/.xinitrc:

$ nano .xinitrc

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

Now reboot to load the drivers, and X should start.

If you get a black screen when starting X, make sure that there are no ampersands after the two xrandr command in ~/.xinitrc; if there are ampersands, it seems that the window manager can run before the xrandr commands finish executing, leading to the black screen.

As with the nouveau drivers, you can check if the NVIDIA graphics are being used by installing mesa-demos and running

$ glxinfo | grep NVIDIA

For more information, look at NVIDIA's official page on the topic here.