It’s an Optimus system, you have to configure it to use PRIME:
http://us.download.nvidia.com/XFree86/Linux-x86/319.12/README/randr14.html
https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Display_Managers
In short, use a xorg.conf like this:
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia" 0 0
Inactive "intel"
EndSection
Section "Monitor"
Identifier "Monitor0"
Modeline "1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync
EndSection
Section "Device"
Identifier "intel"
Driver "modesetting"
Option "AccelMethod" "none"
BusID "PCI:0:2:0"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:1:0:0"
Option "AllowEmptyInitialConfiguration"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Monitor "Monitor0"
SubSection "Display"
Virtual 1920 1080
EndSubSection
EndSection
and set your DE to run this on startup:
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
e.g. from GDM/Gnome, create two files optimus.desktop in /etc/xdg/autostart/ and /usr/share/gdm/greeter/autostart/ containing
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
Here another user made a script to set everything up automatically on Debian:
https://devtalk.nvidia.com/default/topic/1024318/linux/-solved-nvidia-prime-on-dual-gpu-configuration-giving-a-blank-screen/post/5210971/#5210971
To get rid of tearing, use kernel parameter
nvidia-drm.modeset=1
In case of Ubuntu, you might have to add a file in /etc/modprobe.d/ containing
options nvidia_XXX_drm modeset=1
with XXX being the major version of the installed nvidia driver.
After that, run
sudo update-initramfs -u
and reboot.
sudo cat /sys/module/nvidia_drm/parameters/modeset
should return ‘Y’ if done right.