Ubuntu – How to run both Intel and Nvidia graphics card driver on dual monitor setup

driversintel graphicsmultiple-monitorsnvidiaxorg

I'm trying to get Intel and Nvidia graphics card working together with two monitors. One monitor should use the Intel card and the other the Nvidia card. Of course, I want to use only one keyboard and one mouse to switch between both screens. Bumblebee didn't work for me.

I don't want to use the xserver-xorg-video-all package because I need the Nvidia card for gaming and I can't use only one graphics card because I need one for KVM virtualisation and the other one for my Linux desktop

So I tried to install the drivers and to configure the Xserver manually. The Nvidia driver is working and I get a video output. But I don't get a video output with the Intel card.

I followed the instructions in this blog post

The config files:

/etc/X11/xorg.conf.nvidia
/etc/X11/xorg.conf.intel
/etc/lightdm/lightdm.conf

Here's a related StackOveflow post

Best Answer

It is possible since 2013 using graphics offloading (see http://us.download.nvidia.com/XFree86/Linux-x86/319.12/README/randr14.html)

The following uses the free drivers (nouveau) and won't work using nvidia's proprietary ones.

I've been using this for a few months and it works well enough for me. Here's my setup :

 __nvidia__ __intel___ __nvidia__
|          |          |          |
|  DVI-I-1 |   VGA-1  |  DVI-D-1 |
|__________|__________|__________|

Here's what you should use if you're running off an nvidia card and would like to output a third screen via the embeded graphics (intel) :

Xorg.conf

# Discrete Card as Primary GPU

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

Section "Device"
    Identifier  "nouveau"
    Driver      "nouveau"
    BusID       "PCI:1:0:0" # see man lspci
EndSection

Section "Screen"
    Identifier "nouveau"
    Device "nouveau"
EndSection

Section "Device"
    Identifier  "intel"
    Driver      "modesetting"
EndSection

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

Now add this to your session manager startup script :

xrandr --setprovideroutputsource modesetting nouveau
xrandr --output VGA-1 --mode 1920x1080
sleep 1s
xrandr --output VGA-1 --mode 1920x1080 --pos 1920x0 --rotate normal --output DVI-D-1 --mode 1920x1080 --pos 3840x0 --output DVI-I-1 --mode 1920x1080 --pos 0x0

Those pastes come from my own config and should be tweaked to fit your own use case. The full documentation is available here : http://us.download.nvidia.com/XFree86/Linux-x86/319.12/README/randr14.html

In this configuration, the nvidia GPU does all the rendering work. The Intel iGPU simply displays whatever the main GPU sends to it. Please note that the nvidia GPU is totally unaware of the state of the iGPU when it sends frames to display. That means there may be a fair amount of tearing (horizontally AND diagonaly !). For those who may wanna tru it, you can't use the "TearFree" option in your Xorg.conf.

Related Question