Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Nvidia Optimus, W520, docking stn, multiple monitors[SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 747
Location: Queensland

PostPosted: Sat Jul 29, 2017 11:06 pm    Post subject: Nvidia Optimus, W520, docking stn, multiple monitors[SOLVED] Reply with quote

Hello, I've done many searches for terms such as Gentoo nvidia optimus and read-up on Bumblebee, card switching etc. but have been unable to solve my particular problem. The laptop is in a docking station or port replicator, which has two monitors attached via the DVI ports. The problem is that I cannot get a display on all three screens. It's always one or two out of the three, depending on the configuration, by which I mean mainly /etc/X11/xorg.conf but I've also played around with use flag +/- kms and other kernel options.

I've experimented with X -configure and nvidia-xconfig without success.

The closest I got was the two external monitors showing a desktop, then when I moved the mouse to the right, the pointer appeared on the otherwise black (i.e., no backdrop image etc.) built-in screen of the laptop, but as the 'hollow X' that is X's default mouse pointer.

Annoying, Windows 10 does use all three, but one of the two external monitors has to be connected by VGA, so the configuration under Windows is built in + external VGA + external DVI.

Tantalisingly, /var/log/Xorg.0.log actually lists all the attached monitors, as does the output of xrandr -q. Maybe it's necessary to encode that in /etc/X11/xorg.conf.

There are more relevant files here for anyone who has the time.

This article looks relevant but is out of date from the start: xinerama is no longer used; at least, setting it caused no re-emerging on emerge -quUDN @world.

Particularly helpful would be the /etc/X11/xorg.conf of someone who has already achieved this.
_________________
Michael Mounteney


Last edited by mounty1 on Sat Aug 05, 2017 6:55 am; edited 1 time in total
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 157

PostPosted: Tue Aug 01, 2017 8:05 am    Post subject: Reply with quote

You haven't configured your laptop to use PRIME at all. You're currently running a dual-gpu setup which won't really work.
One hardware related note first: one of your external displays is detected twice, once as vga and once as dvi. You're probably using a DVI-I cable. It's some Nvidia bug, might cause problems. Connect it either by VGA or use a DVI-D cable if that fits.
Now for software config:
Switch to Nvidia OpenGL
Code:

eselect opengl nvidia

Configure Xorg for offloading:
(You might have to alter this to fit your hardware)
Code:

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

Section "Monitor"
    Identifier     "Monitor0"
    Option         "enable" "true"
    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


Activate offloading:
Code:

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

This has to be done on every Xserver you're starting, depending on your DE the file to insert it differs.
e.g. for Gnome/GDM a .desktop file has to be created in /etc/xdg/autostart/ for the user session and in /usr/share/gdm/greeter/autostart/ for GDM
Read this for more info:
https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Display_Managers
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 157

PostPosted: Tue Aug 01, 2017 9:24 am    Post subject: Reply with quote

Just as a sidenote: your laptop supports switching to discrete in bios, meaning deactivating the intel gpu. If done, you can run without an xorg.conf or use nvidia-xconfig to create one, no offloading aka PRIME needed. eselect opengl nvidia has to be used in either case.
Back to top
View user's profile Send private message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 747
Location: Queensland

PostPosted: Thu Aug 03, 2017 11:23 am    Post subject: Reply with quote

hhfeuer wrote:
YOne hardware related note first: one of your external displays is detected twice, once as vga and once as dvi. You're probably using a DVI-I cable. It's some Nvidia bug, might cause problems. Connect it either by VGA or use a DVI-D cable if that fits.

Thanks so much for your reply. It very nearly works now except that the display only appears on the two external monitors, not on the laptop display. /var/log/Xorg.0.log doesn't give many hints about what might be wrong, except that there is that mysterious LVDS-1-1 display that never shows up to xrandr etc. You are right about the double-detection: one of the two external monitors was connected by both VGA and DVI cables, as I could only get Windows to work with the VGA.

I ran eselect opengl set nvidia and set up lightdm to run the two xrandr commands. However:
Code:
$ xrandr --setprovideroutputsource modesetting NVIDIA-0
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  139 (RANDR)
  Minor opcode of failed request:  35 (RRSetProviderOutputSource)
  Value in failed request:  0x313
  Serial number of failed request:  16
  Current serial number in output stream:  17
Maybe this is key? Maybe it's a hardware limitation and I have to run both cards?

Here's the current xorg.conf:
Code:
Section "ServerLayout"
        Identifier      "layout"
        Screen          0 "nvidia" 0 0
        Inactive        "intel"
EndSection

Section "Device"
        Identifier      "intel"
        Driver          "modesetting"
        Option          "AccelMethod" "none"
        BusID           "PCI:0:2:0"
EndSection

Section "Monitor"
        Identifier      "Monitor0"
        Option          "enable" "true"
        Modeline        "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
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"
EndSection
is as yours except for the modeline setting. All three displays (two external, one built-in to the laptop) are 1920x1080.

While I was surfing around I did see somewhere that the built-in screen can only be driven by the Intel driver. Windows Device Manager shows that it's running both cards when driving all three displays.

Thanks for your suggestion about discrete mode but I do want run in low-power mode on battery, so want to keep the switchability. I did try switching to discrete mode and running nvidia-xconfig but I think the further I got was two external monitors, no built-in---as now, in fact. According to this, you need optimus to run three screens.

Can you spot anything in the Xorg.0.log ? There are no (EE) lines at all.
_________________
Michael Mounteney


Last edited by mounty1 on Thu Aug 03, 2017 11:48 am; edited 1 time in total
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 157

PostPosted: Thu Aug 03, 2017 11:39 am    Post subject: Reply with quote

Your laptop has two modes switchable in bios, hybrid(optimus) and discrete.
In hybrid mode, the internal panel is connected to intel and (in your case) the external connectors to the nvidia gpu. In discrete mode, all are connected to nvidia.
In the hybrid case, you'll have to activat PRIME offload, everything is rendered on the nvidia gpu and then copied over to intel to have a display on the internal panel.
One thing I forgot: xorg-server has to be compiled with USE=glamor, what's the output of
Code:
emerge -vp xorg-server
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 157

PostPosted: Thu Aug 03, 2017 11:40 am    Post subject: Reply with quote

Forgot: the modeline for 192x1080 is not necessary, it's set up automatically. I have the 1280x720 just to have a lower resolution for gaming.
Back to top
View user's profile Send private message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 747
Location: Queensland

PostPosted: Thu Aug 03, 2017 12:12 pm    Post subject: Reply with quote

I tried setting discrete/no OS detection in the BIOS.

Now all three screens are detected but one of the externals is disabled. When I try to enable it in KDE's display manager:
Code:
Sorry, your configuration could not be applied.

Common reasons are that the overall screen size is too big, or you enabled more displays than supported by your GPU.
and
Code:
$ xrandr --auto
xrandr: cannot find crtc for output DP-2


Maybe this is why Windows does one display via VGA.
_________________
Michael Mounteney
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 157

PostPosted: Thu Aug 03, 2017 12:36 pm    Post subject: Reply with quote

And what about hybrid mode, did you check for glamor?
Back to top
View user's profile Send private message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 747
Location: Queensland

PostPosted: Thu Aug 03, 2017 12:48 pm    Post subject: Reply with quote

hhfeuer wrote:
And what about hybrid mode, did you check for glamor?
Yep, tried hybrid mode and USE=glamor is set on xorg-server.

The problem is that I keep trying so many combinations in the hope of hitting the magic one that it's difficult to keep notes on everything. The closest I got so far was running one of the external displays via VGA, when all three screens were detected. However, when I used KDE's display manager tool to enable them all, the enablement of the LVDS built-in screen was ignored; that is, when I hit Apply, the Enable check-box was cleared.
_________________
Michael Mounteney
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 157

PostPosted: Thu Aug 03, 2017 1:53 pm    Post subject: Reply with quote

When on hybrid, what does xrandr --listproviders give you?
Back to top
View user's profile Send private message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 747
Location: Queensland

PostPosted: Sat Aug 05, 2017 3:38 am    Post subject: It suddenly works Reply with quote

After two days of messing around trying lots of different combinations, your solution all at once started working. I have no idea why it didn't work from the first but it does now so you have my extreme gratitude.
_________________
Michael Mounteney
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum