Optimus nVidia/Intel (MSI GL65) : unable to get dual screen to work

Hello ! I've been trying to get my dual screen setup to work on X (using XFCE) but no luck.
First, my setup : it's an MSI laptop Leopard GL65, with Intel Graphics (UHD630) and a nVidia GeForce RTX 2070 SUPER, running 14.0 RELEASE.

$ pciconf -lv|grep -B4 VGA
Code:
vgapci1@pci0:0:2:0:    class=0x030000 rev=0x05 hdr=0x00 vendor=0x8086 device=0x9bc4 subvendor=0x1462 subdevice=0x12b8
    vendor     = 'Intel Corporation'
    device     = 'CometLake-H GT2 [UHD Graphics]'
    class      = display
    subclass   = VGA
--
vgapci0@pci0:1:0:0:    class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1f14 subvendor=0x1462 subdevice=0x12b8
    vendor     = 'NVIDIA Corporation'
    device     = 'TU106M [GeForce RTX 2070 Mobile / Max-Q Refresh]'
    class      = display
    subclass   = VGA

The BIOS does not allow to disable the discrete CPU or the Intel Graphics.
On the hardware part, I have the laptop screen, a IIYAMA screen on HDMI port, and an empty DP. It looks like (stated in Windows 11 this way and it does look like this on FreeBSD) that the laptop screen is managed by the Intel UHD, but the HDMI and DP ports belong to the NVIDIA card.

Drivers used are i915kms (modeset) and the official NVIDIA driver, and it does work fine. There's nothing special in the logs, only these errors/warnings :
Code:
(WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
(!!) More than one possible primary device found
(WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
(WW) NVIDIA: No DRM device: Direct render devices found but none could be used.
(II) GLX: Another vendor is already registered for screen 0

Now, here is what happens : I can get both screens to work fine, but never on the same time. I do this by switching the Screen0 section from "nvidia" to "intel".
In my current setup (laptop on left, IIYAMA screen on right), I have the IIYAMA screen displaying my main screen ; the laptop screen is black, but activated (backlit) and I can smoothly put/move the pointer on it from the external screen to the internal one and vice-versa - the mouse does like if the Xinerama setup was working fine.
If I switch to a console (ie Crtl+Alt+F1), the IIYAMA screens shutdown (no signal detected), and the laptop screen gets the console display. Turning back to XFCE using CTRL+ALT+F9 works as the opposite - laptop screen turns black, and my IIYAMA turns back to XFCE.

At boot, the whole Vinit goes on the laptop screen, and it switches to the IIYAMA when SDDM is ready. Same thing when I shutdown from XFCE.

I did turn off Xinerama option for now, as it "looks to" work but it's unusable : the desktop looks to be streched correctly (no more desktop icons, my open windows are here but on the left, the mouse can be moved to the laptop screen BUT it's not appearing) but the laptop screen is still black so I can't see what I'm doing.


Using ARandR, with nVidia setup I have the following outputs : HDMI-0 (the screen I use), DP-0 and DP-1 (internal displayport), both disconnected. Booting with Intel driver (so I have the laptop screen but not the HDMI output), I only have eDP-1 output.
xrandr only list one provider, the NVIDIA or the Intel one.

Here are my relevant xorg.conf files :
(screen.conf)

Code:
Section "Screen"
    Identifier     "Screen0"
    Device         "nvidia" #Put intel to boot to the laptop screen (eDP-1)
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "intel"
    Monitor        "Monitor0" #Same result:Monitor1
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

(monitor.conf)
Code:
Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
    #Option        "LeftOf" "Monitor0"
EndSection

(intel.conf)
Code:
Section "Device"
        Identifier      "intel"
        Driver          "modesetting"
        BusID           "PCI:0:2:0"
        #Option         "PrimaryGPU" "yes" #Ignored
EndSection

(nvidia.conf)
Code:
Section "Device"
    Identifier     "nvidia" #Device0
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
EndSection

(layout.conf - file based on a generated one by nvidia-xconfig)
Code:
Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    Screen      1  "Screen1" LeftOf "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0" #1=External screen stretched to the laptop screen correctly, but unusable as the laptop screen is black
EndSection

It also doesn't work in NomadBSD, BUT the setup works out of the box if I run a Live Debian (also running XFCE). I've been testing NVIDIA secondary graphics, lots of this but nothing did the trick.

Do you think I'll be able to make this to work ? Thanks for any clue !!
 
Using ARandR, with nVidia setup I have the following outputs : HDMI-0 (the screen I use), DP-0 and DP-1 (internal displayport), both disconnected. Booting with Intel driver (so I have the laptop screen but not the HDMI output), I only have eDP-1 output.
Without AI-enhanced drivers, don't you think that you should let the drivers know which outputs should be assigned to which monitors?

See the xorg.conf specification:
With RandR 1.2-enabled drivers, monitor sections may be tied to specific outputs of the video card. Using the name of the output defined by the video driver plus the identifier of a monitor section, one associates a monitor section with an output by adding an option to the Device section in the following format:

Option "Monitor-outputname" "monitorsection"

(for example, Option "Monitor-VGA" "VGA monitor" for a VGA output)
 
Without AI-enhanced drivers, don't you think that you should let the drivers know which outputs should be assigned to which monitors?

See the xorg.conf specification:
Hi ! i had no time to reply to you, so I added on my intel.conf (Section "Device") the following option :
Code:
Option "Monitor-eDP-1"  "Monitor1"
I go slowly on it to avoid any error (that's why I haven't done the same yet for the nVidia card) and of course it had no effect.
But I do have lines on Xorg.0.log stating that the eDP-1 output is connected and probed (I only put here the relevant lines) :
Code:
(II) modeset(1): Output eDP-1 using monitor section Monitor1
(II) modeset(1): Output eDP-1 connected
(II) modeset(1): Using exact sizes for initial modes
(II) modeset(1): Output eDP-1 using initial mode 1920x1080 +0+0

xrandr still points only one provider.
I tested with Debian, and it states (as I said) 2 providers (provider 0 is id 0x44 with 3 outputs, provider 1 is id 0xfc, 4 outputs, name for both is modesetting), and the following outputs :
* eDP-1 (connected primary screen0)
* DP-2 (disconnected - never saw it on FreeBSD)
* HDMI-2 (disconnected, never saw it either)
* DP-1-1 (no state ?)
* HDMI-1-1 (connected, that's my external monitor).

I just notice that something generated a 20-nvidia-drm-outputclass.conf into the config dir (usr/local/share/X11/xorg.conf.d). I'll rename it to see what happens...
 
Are you sure that drm-kmod works in this configuration the way you want it to work (two different drivers, two different screens)?
I'm fairly certain that with i915kms, you're replacing the framebuffer driver in the kernel and that would ultimately stop you from using any Nvidia device in parallel.

Ah, strike that - I just realized you're using modesetting on i915kms; so that would stop you from loading the framebuffer code. Actually, it would stop i915kms from doing anything, because the driver bails out quite early if that is set, if I remember correctly
 
A
Ah, strike that - I just realized you're using modesetting on i915kms; so that would stop you from loading the framebuffer code. Actually, it would stop i915kms from doing anything, because the driver bails out quite early if that is set, if I remember correctly
Oh, that would be awesome!

If I understand you correctly, this would stop i915kms from usurping the video hardware, so that it no longer blocks other video hardware from coexisting.
In other words, cutting down the drm-kmod's bad behaviour, so using other manufacturers video hardware together in parallel with the onboard graphics is no longer blocked.

This might explain well why ditching the KMS crap is a gooood thing, because it makes possible to use nvidia together with xf86-video-intel :)
 
It might looks so cmoerz, maybe the drivers are fighting each other :p
So, here are some news :
As said, I added the Option "Monitor-eDP-1" to the Intel Device section, and the Option "Monitor-DFP-0" to my NVIDIA Device Section (it is named this way in Xorg logs when running from Intel driver and the IIYAMA is probed).
It does the exact opposite of what I had : the laptop screen is working, and my IIYAMA screen is black, but I can fly the mouse on it from the laptop screen and vice-versa with no problem at all. Same result if I put "HDMI-0" instead of "DFP-0" (HDMI-0 is the working output name when I'm running from the nvidia driver).
When I enable Xinerama, still the same thing : the IIYAMA turns on, works as an extended part of the main (laptop) screen, which is black (and the mouse is NOT visible).

I disabled the composite because the log stated that both Composite and Xinerama were enabled, but on the next boot with Xinerama enabled, the windows were all crashing/wrong buggy display, so I had to run Xterm from a user session using SDDM (toggling to console with Ctrl+Alt+FX gave an empty screen... ouch).

In the current setup, I'm running FreeBSD from my laptop's screen, the IIYAMA is black but on with the mouse I can move on, I have sound on the IIYAMA, only one provider from xrandr (1 output), but the NVIDIA X Server Settings does have 2 screens and detects perfectly the IIyama (as X Screen 1 on HDMI-0).

I keep confident but this one is tricky !!
 
...using SDDM (toggling to console with Ctrl+Alt+FX gave an empty screen... ouch). ...
Maybe you could, at least for the experimenting/diagnosing period, disable such login managers?
Just to rule out their side effects, respective problems they cause.
I'd really advise to use startx/xinit from console...
 
Maybe you could, at least for the experimenting/diagnosing period, disable such login managers?
Just to rule out their side effects, respective problems they cause.
I'd really advise to use startx/xinit from console...
I'll test this indeed and report 👍
 
Well, some news : nothing to say, it didn't work. Here some outputs, I removed the useless probes to keep it readable.

Code:
xrandr --query
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 476mm x 268mm
   1920x1080     60.00*+  74.97    59.94    50.00 
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)

xrandr --listmonitors
Monitors: 1
 0: +*HDMI-0 1920/476x1080/268+0+0  HDMI-0

xrandr --screen 0
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 476mm x 268mm
   1920x1080     60.00*+  74.97    59.94    50.00  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)

xrandr --screen 1
Screen 1: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1920x1080    144.03*+  60.01    59.97    59.96    60.00    59.93
 
Hi, feedback months later !
Still no luck, I removed nvidia-drm-510-kmod as it was useless (I run nvidia-driver) and tested some new things, but no luck. I might try again starting from the Intel to "expand" to the discreete card (as opposite of what I do now). Double checked in Windows, it does state the internal monitor goes to Intel UHD, and the HDMI goes to Nvidia.
Weird thing is, I was playing with VLC to test my libdvdcss port, I mistakenly double clicked for fullscreen, and the fullscreen went... on the internal monitor. The video was empty, but the VLC controls did display and reacted fine to my mouse. I then noticed in the seetings that the internal monitor was the default one for fullscreen (and it allows me to use both the internal or external monitors if I want).
That's just crazy !!
 
… BIOS does not allow to disable the discrete CPU or the Intel Graphics. …

That's unfortunate. (I do well with NVIDIA alone (Intel disabled) and a legacy driver.)

… removed nvidia-drm-510-kmod … (I run nvidia-driver) …

<https://www.freshports.org/graphics/nvidia-drm-kmod/#history> is very recently updated, however re: <https://forums.freebsd.org/posts/645663> you might like to await fixes (or workarounds) for some issues.
 
Hi, thanks for your reply !
Indeed, the nvidia-driver was updated (nvidia-driver: 535.146.02 -> 550.54.14).
Not rebooted yet, but I'll follow your link for issue :)
 
Back
Top