Differences between revisions 33 and 34
Revision 33 as of 2020-06-04 13:49:42
Size: 9499
Editor: ?DenisPopov
Comment: Add "PRIME synchronization" subsection
Revision 34 as of 2020-06-04 14:25:41
Size: 9523
Editor: ?DenisPopov
Comment: Add some formatting
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
The instructions on this page apply to Debian Wheezy and newer.

{{{#!wiki note
Line 8: Line 11:

The instructions on this page apply to Debian Wheezy and newer.
}}}
Line 39: Line 41:
1. Install the [[NvidiaGraphicsDrivers|NVIDIA driver]] and xrandr: 1. Install the [[NvidiaGraphicsDrivers|NVIDIA driver]] and `xrandr`:
Line 90: Line 92:
{{{#!wiki note {{{#!wiki tip
Line 164: Line 166:
PRIME synchronization will be enabled automatically after you enable [[https://en.wikipedia.org/wiki/Mode_setting|KMS]] for nvidia-drm module. PRIME synchronization will be enabled automatically after you enable [[https://en.wikipedia.org/wiki/Mode_setting|KMS]] for `nvidia-drm` module.
Line 177: Line 179:
3. The "modesetting" driver for an Intel GPU loads a module called
"glamor", which [[http://us.download.nvidia.com/XFree86/Linux-x86/390.116/README/randr14.html#caveats|conflicts]] with the NVIDIA GLX implementation. To disable "glamor" [[https://forums.developer.nvidia.com/t/xorg-server-1-17-on-optimus-laptop-doesnt-start-when-nvidia-opengl-implementation-is-selected/36773/5|uncomment]] this line in /etc/X11/xorg.conf:
3. The `modesetting` driver for an Intel GPU loads a module called
`glamor`, which [[http://us.download.nvidia.com/XFree86/Linux-x86/390.116/README/randr14.html#caveats|conflicts]] with the NVIDIA GLX implementation. To disable `glamor` [[https://forums.developer.nvidia.com/t/xorg-server-1-17-on-optimus-laptop-doesnt-start-when-nvidia-opengl-implementation-is-selected/36773/5|uncomment]] this line in /etc/X11/xorg.conf:

Translation(s): English - español - Polski


This page describes how to identify, configure and troubleshoot NVIDIA Optimus enabled systems for Debian. NVIDIA Optimus is a technology that enables dynamic, switchable graphics between the central processing unit's (CPU) embedded graphics capability and the discrete graphics processing unit (GPU) card. Due to the nature of this technology, various software components must be aware of, and configured for, the proper output of the display based on the user's desired configuration.

The instructions on this page apply to Debian Wheezy and newer.

NVIDIA has recently laid the groundwork for easy switchable graphics in the proprietary driver without most of the fiddling that has traditionally been required. This needs, at minimum, NVIDIA 435.17 or newer, and X.Org Server 1.21 or newer. The Nvidia driver version 440.82 is currently packaged in the following repositories: the Debian Unstable repo, the Debian Testing repo as well the backports repo for Buster Backports. X.Org 1.21 is currently unreleased and unpackaged. You can find more information on this bleeding-edge functionality on the NVIDIA website in their official driver documentation. Until these are available, or if you're on an older version of Debian that doesn't yet have the necessary versions, the rest of this page may be very useful.

Installation of Proprietary Graphics Driver Required

The instructions on this page assume that your system has already had the NVIDIA proprietary graphics drivers installed using the instructions, here: Driver Installation.

Identification

The quickest method to determine if your device uses an Optimus card is to search against the documented list on NVIDIA's website. Obtain the NVIDIA GPU identifier of your card with:

$ lspci | grep -E "VGA|3D"

Compare the identifier (i.e. GeForce 7XXM, 8XXM, 9XXM) with the list, here: http://www.geforce.com/hardware/technology/optimus/supported-gpus

Also note the PCI identifier of the card, which is the 5-digit ID at the beginning of the previous command's output, XX:XX.X.

Configuration

Configuration of an NVIDIA Optimus enabled system can be somewhat complex, depending upon the desired end state. This section mentions and details a few of the more common configuration scenarios and how to adjust your Debian installation, accordingly.

Using only one GPU

Rather than enabling the power saving features of dynamic, "switchable" graphics, one can simply configure the system to output to the local display using only a single graphics provider.

The simplest method of setting the graphics provider, if your hardware supports it, is to manually select the embedded CPU or NVIDIA GPU as the display provider in the system's BIOS. Of course, this is vendor specific and you must consult your hardware manufacturer's documentation for further detail.

Using NVIDIA GPU as the primary GPU

You can use PRIME to render an X screen using an NVIDIA GPU while display it on monitors connected to an Intel integrated GPU. While this configuration does not take advantage of Optimus' power saving features, it provides maximum performance.

1. Install the NVIDIA driver and xrandr:

# apt install x11-xserver-utils

2. Place the following in /etc/X11/xorg.conf:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "<BusID for NVIDIA device here>" # e.g. PCI:1:0:0
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "<BusID for Intel device here>" # e.g. PCI:0:2:0
    #Option "AccelMethod" "none"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

You can find the BusID for your graphic devices by running the lspci command. For example, if the output of the command was "01:00.0", you would set BusID to "PCI:1:0:0".

3. Place the following commands to the beginning of your X session startup scripts (e.g., ~/.xsessionrc or ~/.xinitrc):

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
xrandr --dpi 96

and make these scripts executable.

The DPI setting, (--dpi) should be fine for most screens; however, this may need to be adjusted for newer high density pixel screens. Systems with HiDPI screens likely will want to set this to 192. Consult your hardware manufacturer's specification for the appropriate setting.

Display managers

If you are using a display manager then you will also need to configure it to run above xrandr commands during display setup.

LightDM

1. Create a display setup script /etc/lightdm/display_setup.sh:

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
xrandr --dpi 96

and make it executable:

# chmod +x /etc/lightdm/display_setup.sh

2. Configure lightdm to run the script by editing (or adding) the SeatDefaults section in /etc/lightdm/lightdm.conf:

[SeatDefaults]
display-setup-script=/etc/lightdm/display_setup.sh

3. Restart lightdm:

# systemctl restart lightdm.service

Simple Desktop Display Manager (SDDM)

1. Place the following commands to /usr/share/sddm/scripts/Xsetup:

# Xsetup - run as root before the login dialog appears
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
xrandr --dpi 96

2. Restart SDDM:

# systemctl restart sddm

GNOME Display Manager (GDM)

1. Create two new .desktop files /usr/share/gdm/greeter/autostart/optimus.desktop and /etc/xdg/autostart/optimus.desktop with the following content:

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

2. Restart GDM:

# systemctl restart gdm3.service

3. If NVIDIA driver still won't working, you can try use GNOME on Wayland display manager.

PRIME synchronization

You can enable PRIME synchronization to prevent screen tearing. It requires:

  • Linux kernel 4.5 or higher;
  • X server 1.19 or higher;
  • NVIDIA driver 370.23 or higher.

PRIME synchronization will be enabled automatically after you enable KMS for nvidia-drm module.

1. Add this line to the end of /etc/modprobe.d/nvidia.conf:

options nvidia-drm modeset=1

2. Regenerate your initramfs image by running:

# update-initramfs -u

3. The modesetting driver for an Intel GPU loads a module called glamor, which conflicts with the NVIDIA GLX implementation. To disable glamor uncomment this line in /etc/X11/xorg.conf:

Option "AccelMethod" "none"

4. Reboot.

Using Nvidia-xrun

See Nvidia-xrun.

Using Bumblebee

The proprietary NVIDIA graphics driver can also be used to enable dynamic graphics switching between the embedded and discrete graphics providers through the use of Bumblebee. This method takes advantage of Optimus' power saving features, but can be more complex to successfully enable offloaded 3D applications.

Using nouveau

See nouveau.

Checking drivers

You can check if installed drivers support 3D OpenGL graphics by executing following command:

$ glxinfo | grep OpenGL

Hybrid GPUs

If you have a hybrid GPU and installed bumblebee driver you can check it for Intel:

$ glxinfo | grep OpenGL

And for NVIDIA:

$ optirun glxinfo | grep OpenGL

Also very recommended is checking displaying 3D OpenGL graphics by running glxgears program.

Troubleshooting

TODO

See also


CategoryHardware | GraphicsCard | NvidiaGraphicsDrivers