Help needed with dual GPU setup on my laptop

Hi folks,

I have a new laptop from work (a Lenovo Legion i5) with both the on-chip Intel video card and a nVidia dedicated GPU. I can’t use ‘prime-run’ to start any application, I always get this error :
prime-run glxgears X Error of failed request: BadValue (integer parameter out of range for operation)

I’ve tried reinstalling the drivers and different combinations of Kernels and or GPU drivers, no luck.

Below are some data :
inxi -F output:

    System:    Host: i-r-legion Kernel: 5.8.18-1-MANJARO x86_64 bits: 64 Desktop: KDE Plasma 5.20.2 Distro: Manjaro Linux 
Machine:   Type: Laptop System: LENOVO product: 82AU v: Lenovo Legion 5 15IMH05 serial: <superuser/root required> 
           Mobo: LENOVO model: LNVNB161216 v: NO DPK serial: <superuser/root required> UEFI: LENOVO v: EFCN31WW 
           date: 04/27/2020 
Battery:   ID-1: BAT0 charge: 78.8 Wh condition: 80.3/80.0 Wh (100%) 
CPU:       Info: 6-Core model: Intel Core i7-10750H bits: 64 type: MT MCP L2 cache: 12.0 MiB 
           Speed: 800 MHz min/max: 800/5000 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 
           9: 800 10: 800 11: 800 12: 800 
Graphics:  Device-1: Intel UHD Graphics driver: i915 v: kernel 
           Device-2: NVIDIA TU117M [GeForce GTX 1650 Ti Mobile] driver: nvidia v: 455.38 
           Device-3: IMC Networks Integrated Camera type: USB driver: uvcvideo 
           Display: x11 server: X.Org 1.20.9 driver: modesetting unloaded: nvidia resolution: 1920x1080 
           OpenGL: renderer: Mesa Intel UHD Graphics (CML GT2) v: 4.6 Mesa 20.2.1 
Audio:     Device-1: Intel Comet Lake PCH cAVS driver: snd_hda_intel 
           Sound Server: ALSA v: k5.8.18-1-MANJARO 
Network:   Device-1: Intel Wireless-AC 9462/9560 driver: iwlwifi 
           IF: wlp0s20f3 state: up mac: e4:5e:37:aa:0f:dc 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           IF: enp7s0 state: down mac: 00:2b:67:79:48:0b 
Drives:    Local Storage: total: 476.94 GiB used: 66.10 GiB (13.9%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLB512HBJQ-000L2 size: 476.94 GiB 
Partition: ID-1: / size: 434.35 GiB used: 66.10 GiB (15.2%) fs: ext4 dev: /dev/nvme0n1p2 
Swap:      ID-1: swap-1 type: partition size: 34.35 GiB used: 0 KiB (0.0%) dev: /dev/nvme0n1p3 
Sensors:   System Temperatures: cpu: 40.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 277 Uptime: 14m Memory: 31.23 GiB used: 1.83 GiB (5.8%) Shell: Bash inxi: 3.1.08

/etc/X11/mhwd.d/nvidia.conf contents:

`Section "Files"
    ModulePath "/usr/lib/xorg/modules"
    ModulePath "/usr/lib/nvidia/xorg"
EndSection

Section "ServerLayout"
        Identifier "layout"
        Screen 0 "iGPU"
        Inactive "nGPU"
        Option "AllowNVIDIAGPUScreens"
EndSection
 
Section "Device"
        Identifier "nGPU"
        Driver "nvidia"
        VendorName "NVIDIA Corporation"
        BoardName "GeForce GTX 1650 Ti Mobile"
        BusID "PCI:1:0:0"
EndSection

Section "Device"
        Identifier "iGPU" 
        Driver "modesetting"
        BusID "PCI:0:2:0"
        Option "DRI" "3"
EndSection

Section "Screen"
        Identifier "iGPU"
        Device "iGPU"
EndSection

Section "Screen"
        Identifier "nGPU"
        Device "nGPU"
EndSection`

I’ve added these in /etc/mkinitcpio.conf :
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

xrandr --listproviders output:

    Providers: number : 2
    Provider 0: id: 0x43 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 1 associated providers: 1 name:modesetting
    Provider 1: id: 0xcb cap: 0x2, Sink Output crtcs: 4 outputs: 3 associated providers: 1 name:modesetting

nvidia-smi output :

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.38       Driver Version: 455.38       CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 165...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   39C    P8     1W /  N/A |      6MiB /  3911MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

These are the drivers installed :

    video-hybrid-intel-nvidia-455xx-prime            2020.10.04               false            PCI
    video-modesetting            2020.01.13                true            PCI

Using 5.8.18-1-MANJARO Kernel (I saw that 5.9 has some issues with the nvidia driver)

Can anyone help ? Thanks

Cleaned up a bit the OP output text.

Hello,

And did you run, after that, this command ?
sudo mkinitcpio -P

Have you tried makeing use of Optimus-Manager ?

Greetings,

Thanks.
Yes, I’ve run sudo mkinitcpio -P after adding the modules.
Yes, I’ve tried it, but I ran into some issues with it : everytime I tried to switch graphics (regardless of the mode of switching) after logout the laptop fans would go to max, and after a couple of seconds of black screen the laptop would auto-shutdown.

I’ve managed to set it to Hybrid at some point and run with that … for a brief moment prime-run worked … but after reboot, it was back to this.

Ok. So I just tried again optimus-manager and at least in Hybrid mode it allows me to run ‘prime-run’ commands. I will leave it like this and hope the nVidia card gets powered down as it should (after following the instructions found here )

Thanks. Please mark the thread as solved

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.