Académique Documents
Professionnel Documents
Culture Documents
php/NVIDIA_Optimus
NVIDIA Optimus
From ArchWiki
using the oicial Optimus support included with the proprietary NVIDIA
driver, which oers the best NVIDIA performance but does not allow GPU
switching and can be more buggy than the open-source driver
Contents
1 Disabling switchable graphics
2 Using nvidia
2.1 Alternative conguration
2.2 Display Managers
2.2.1 LightDM
2.2.2 SDDM
2.2.3 GDM
2.3 Checking 3D
2.4 Further Information
3 Troubleshooting
3.1 Tearing/Broken VSync
1 of 8 5/16/17, 6:45 PM
NVIDIA Optimus - ArchWiki https://wiki.archlinux.org/index.php/NVIDIA_Optimus
3.2 Failed to initialize the NVIDIA GPU at PCI:1:0:0 (GPU fallen o the
bus / RmInitAdapter failed!)
3.3 Resolution, screen scan wrong. EDID errors in Xorg.log
3.4 Lockup issue (lspci hangs)
4 Using nouveau
5 Using Bumblebee
For another way see Hybrid graphics#Fully Power Down Discrete GPU.
If you want to use both cards, or cannot disable the card you do not want, see the
options below.
Using nvidia
The proprietary NVIDIA driver does not support dynamic switching like the
nouveau driver (meaning it can only use the NVIDIA device). It also has notable
screen-tearing issues that NVIDIA recognizes but has not xed. However, it does
allow use of the discrete GPU and has (as of October 2013) a marked edge in
performance over the nouveau driver.
The PCI address is the rst 7 characters of the line that mentions NVIDIA. It will
look something like 01:00.0 . In the xorg.conf , you will need to format it as #:#:# ;
e.g. 01:00.0 would be formatted as 1:0:0 .
Note: On some setups this setup breaks automatic detection of the values of the
display by the nvidia driver through the EDID le. As a work-around see
#Resolution, screen scan wrong. EDID errors in Xorg.log.
2 of 8 5/16/17, 6:45 PM
NVIDIA Optimus - ArchWiki https://wiki.archlinux.org/index.php/NVIDIA_Optimus
(http://us.download.nvidia.com/XFree86/Linux-x86/358.16/README
/randr14.html))
/etc/X11/xorg.conf
Section "Module"
Load "modesetting"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "<BusID for NVIDIA device here>"
Option "AllowEmptyInitialConfiguration"
EndSection
Next, add the following two lines to the beginning of your ~/.xinitrc :
~/.xinitrc
xrandr --dpi 96
If you get a black screen when starting X, make sure that there are no
ampersands after the two xrandr commands in ~/.xinitrc . If there are
ampersands, it seems that the window manager can run before the xrandr
commands nish executing, leading to a black screen.
Alternative conguration
# nano /etc/X11/xorg.conf
Section "Device"
Identifier "intel"
Driver "modesetting"
BusID "PCI:0:2:0"
3 of 8 5/16/17, 6:45 PM
NVIDIA Optimus - ArchWiki https://wiki.archlinux.org/index.php/NVIDIA_Optimus
As above, the BusID must match for the output of the lspci command. Search for
the line with "VGA compatible controller", that contains something Intel. For
example:
Tip: The three last commented out options may (without #) result in positive
eects on the tearing, but exchange for some performance cost. Note the
TearFree option may be used for "sna" acceleration only, see Intel graphics. You
can use either "sna" or "uxa" in "AccelMethod" option. For further experimenting,
a working xorg.conf from a Lenovo Ideapad Z50-70 59-432128 is here: [2]
(http://pastebin.com/tMtPz381).
/var/log/xorg.conf
If so, the problem may disappear when you change your ServerLayout section of
/etc/X11/xorg.conf :
/etc/X11/xorg.conf
Section "ServerLayout"
Identifier "layout"
Screen 1 "nvidia"
Inactive "intel"
EndSection
Display Managers
If you are using a display manager then you will need to create or edit a display
setup script for your display manager instead of using ~/.xinitrc .
LightDM
4 of 8 5/16/17, 6:45 PM
NVIDIA Optimus - ArchWiki https://wiki.archlinux.org/index.php/NVIDIA_Optimus
/etc/lightdm/display_setup.sh
#!/bin/sh
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
# chmod +x /etc/lightdm/display_setup.sh
Now congure lightdm to run the script by editing the [Seat:*] section in
/etc/lightdm/lightdm.conf :
/etc/lightdm/lightdm.conf
[Seat:*]
display-setup-script=/etc/lightdm/display_setup.sh
SDDM
/usr/share/sddm/scripts/Xsetup
GDM
For the GDM display manager create two new .desktop les:
/usr/share/gdm/greeter/autostart/optimus.desktop
/etc/xdg/autostart/optimus.desktop
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
Checking 3D
5 of 8 5/16/17, 6:45 PM
NVIDIA Optimus - ArchWiki https://wiki.archlinux.org/index.php/NVIDIA_Optimus
You can check if the NVIDIA graphics are being used by installing mesa-demos
(https://www.archlinux.org/packages/?name=mesa-demos) and running
Further Information
For more information, look at NVIDIA's oicial page on the topic [3]
(http://us.download.nvidia.com/XFree86/Linux-x86/370.28/README
/randr14.html).
Troubleshooting
Tearing/Broken VSync
This is due to the NVIDIA driver not detecting the EDID for the display. You need
to manually specify the path to an EDID le or provide the same information in a
similar way.
To provide the path to the EDID le edit the Device Section for the NVIDIA card
in Xorg.conf, adding these lines and changing parts to reect your own system:
/etc/X11/xorg.conf
Section "Device"
Option "ConnectedMonitor" "CRT-0"
6 of 8 5/16/17, 6:45 PM
NVIDIA Optimus - ArchWiki https://wiki.archlinux.org/index.php/NVIDIA_Optimus
If Xorg wont start try swapping out all references of CRT to DFB. card0 is the
identier for the intel card to which the display is connected via LVDS. The edid
binary is in this directory. If the hardware arrangement is dierent, the value for
CustomEDID might vary but yet this has to be conrmed. The path will start in
any case with /sys/class/drm.
Alternatively you can generate your edid with tools like read-edid
(https://www.archlinux.org/packages/?name=read-edid) and point the driver to this le.
Even modelines can be used, but then be sure to change "UseEDID" and
"IgnoreEDID".
Symptoms: lspci hangs, system suspend fails, shutdown hangs, optirun hangs.
Applies to: newer laptops with GTX 965M or alike when bbswitch (e.g. via
Bumblebee) or nouveau is in use.
When the dGPU power resource is turned on, it may fail to do so and hang in
ACPI code (kernel bug 156341 (https://bugzilla.kernel.org
/show_bug.cgi?id=156341)).
Using nouveau
The open-source nouveau driver (xf86-video-nouveau (https://www.archlinux.org/packages
/?name=xf86-video-nouveau)) can dynamically switch with the Intel driver ( xf86-
video-intel (https://www.archlinux.org/packages/?name=xf86-video-intel)) using a
technology called PRIME. For more information, see the wiki article on PRIME.
Using Bumblebee
If you wish to use Bumblebee, which will implement powersaving and some other
useful features, see the wiki article on Bumblebee.
7 of 8 5/16/17, 6:45 PM
NVIDIA Optimus - ArchWiki https://wiki.archlinux.org/index.php/NVIDIA_Optimus
Category: Graphics
8 of 8 5/16/17, 6:45 PM