Page 1 of 1

Laptop Dell G5 with Optimus (Intel and Nvidia)

Posted: Sun Apr 11, 2021 11:27 pm
by programadorthi
This week I have switched from Windows 10 to MX-19.4 thinking that all things would works fine. But I had a big trouble with Dual Monitor and Dual GPU.
My laptop (Dell G5) has optimus graphic system where the default monitor using Intel UHD and HDMI ports are using Nvida card.
So after install the MX-19 only the laptop monitor was recognized. No one HDMI port was recognized.

Running: inxi -Gxx

Code: Select all

Graphics:  Device-1: Intel UHD Graphics 630 vendor: Dell driver: i915 v: kernel bus ID: 00:02.0 
           chip ID: 8086:3e9b 
           Device-2: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] vendor: Dell driver: nvidia 
           v: 450.80.02 bus ID: 01:00.0 chip ID: 10de:2191 
           Display: x11 server: X.Org 1.20.10 driver: modesetting,nvidia 
           unloaded: fbdev,nouveau,vesa alternate: nv resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.3.4 
           direct render: Yes
Running: xrandr

Code: Select all

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1920x1080     60.06*+  60.01    59.97    59.96    59.93    48.04  
   1680x1050     59.95    59.88  
   1600x1024     60.17  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1440x900      59.89  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1360x768      59.80    59.96  
   1280x800      59.99    59.97    59.81    59.91  
   1152x864      60.00  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   800x512       60.17  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   720x450       59.89  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   680x384       59.80    59.96  
   640x400       59.88    59.98  
   576x432       60.06  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
And checking for providers running: xrandr --listproviders

Code: Select all

Providers: number : 1
Provider 0: id: 0x47 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 5 associated providers: 0 name:modesetting
As you can see only one provider was found by xrandr. Nvidia provider was not detected.
My System Quick Info:

Code: Select all

System:    Host: <filter> Kernel: 5.10.0-5mx-amd64 x86_64 bits: 64 compiler: N/A 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.10.0-5mx-amd64 
           root=UUID=<filter> ro quiet splash 
           Desktop: Xfce 4.14.2 tk: Gtk 3.24.5 info: xfce4-panel wm: xfwm4 dm: LightDM 1.26.0 
           Distro: MX-19.4_ahs_x64 patito feo March 31  2021 base: Debian GNU/Linux 10 (buster) 
Machine:   Type: Laptop System: Dell product: G5 5590 v: N/A serial: <filter> Chassis: type: 10 
           serial: <filter> 
           Mobo: Dell model: 0CRKJ6 v: A00 serial: <filter> UEFI: Dell v: 1.14.0 
           date: 10/20/2020 
Battery:   ID-1: BAT0 charge: 58.0 Wh condition: 58.0/60.0 Wh (97%) volts: 17.0/15.2 
           model: BYD DELL HYWXJ01 type: Li-poly serial: <filter> status: Full 
CPU:       Topology: 6-Core model: Intel Core i7-9750H bits: 64 type: MT MCP arch: Kaby Lake 
           family: 6 model-id: 9E (158) stepping: A (10) microcode: DE L2 cache: 12.0 MiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 62399 
           Speed: 800 MHz min/max: 800/4500 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 
           5: 800 6: 801 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 
           Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: spec_store_bypass 
           mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, 
           STIBP: conditional, RSB filling 
           Type: srbds mitigation: Microcode 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel UHD Graphics 630 vendor: Dell driver: i915 v: kernel bus ID: 00:02.0 
           chip ID: 8086:3e9b 
           Device-2: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] vendor: Dell driver: nvidia 
           v: 450.80.02 bus ID: 01:00.0 chip ID: 10de:2191 
           Display: x11 server: X.Org 1.20.10 driver: modesetting,nvidia 
           unloaded: fbdev,nouveau,vesa alternate: nv resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.3.4 
           direct render: Yes 
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: Dell driver: snd_hda_intel v: kernel 
           bus ID: 00:1f.3 chip ID: 8086:a348 
           Device-2: NVIDIA TU116 High Definition Audio vendor: Dell driver: snd_hda_intel 
           v: kernel bus ID: 01:00.1 chip ID: 10de:1aeb 
           Sound Server: ALSA v: k5.10.0-5mx-amd64 
Network:   Device-1: Realtek vendor: Dell driver: r8169 v: kernel port: 3000 bus ID: 3c:00.0 
           chip ID: 10ec:2502 
           IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           Device-2: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter vendor: Dell 
           driver: ath10k_pci v: kernel port: 3000 bus ID: 3d:00.0 chip ID: 168c:003e 
           IF: wlan0 state: down mac: <filter> 
           Device-3: Qualcomm Atheros type: USB driver: btusb bus ID: 1-14:7 chip ID: 0cf3:e007 
Drives:    Local Storage: total: 1.38 TiB used: 20.59 GiB (1.5%) 
           ID-1: /dev/nvme0n1 vendor: A-Data model: IM2P33F3 NVMe ADATA 512GB size: 476.94 GiB 
           block size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: <filter> 
           rev: 91002105 scheme: GPT 
           ID-2: /dev/sda type: USB vendor: Samsung model: HN-M101XBB size: 931.51 GiB 
           block size: physical: 512 B logical: 512 B rotation: 5400 rpm serial: <filter> 
           scheme: MBR 
Partition: ID-1: / raw size: 125.00 GiB size: 122.54 GiB (98.03%) used: 9.01 GiB (7.4%) fs: ext4 
           dev: /dev/nvme0n1p2 
           ID-2: /home raw size: 341.80 GiB size: 335.43 GiB (98.14%) used: 11.58 GiB (3.5%) 
           fs: ext4 dev: /dev/nvme0n1p3 
           ID-3: swap-1 size: 9.64 GiB used: 0 KiB (0.0%) fs: swap swappiness: 15 (default 60) 
           cache pressure: 100 (default) dev: /dev/nvme0n1p4 
Sensors:   System Temperatures: cpu: 64.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Repos:     No active apt repos in: /etc/apt/sources.list 
           Active apt repos in: /etc/apt/sources.list.d/brave-browser-release.list 
           1: deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main
           Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list 
           1: deb http://deb.debian.org/debian buster-updates main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/debian.list 
           1: deb http://deb.debian.org/debian buster main contrib non-free
           2: deb http://deb.debian.org/debian-security buster/updates main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/google-chrome.list 
           1: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
           Active apt repos in: /etc/apt/sources.list.d/mx.list 
           1: deb http://mxrepo.com/mx/repo/ buster main non-free
           2: deb http://mxrepo.com/mx/repo/ buster ahs
           No active apt repos in: /etc/apt/sources.list.d/various.list 
           Active apt repos in: /etc/apt/sources.list.d/vscode.list 
           1: deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
Info:      Processes: 280 Uptime: 8m Memory: 31.18 GiB used: 1.01 GiB (3.2%) Init: SysVinit 
           v: 2.93 runlevel: 5 default: 5 Compilers: gcc: 8.3.0 alt: 7/8 Shell: quick-system-in 
           running in: quick-system-in inxi: 3.0.36 
In a next post I'll show how I solved this issue specific with optimus system.

Re: Laptop Dell G5 with Optimus (Intel and Nvidia)  [Solved]

Posted: Mon Apr 12, 2021 12:10 am
by programadorthi
I hope that solution helps other optimus users. I'm not a Linux expert just a curious

To avoid mistakes after each step below I restarted my laptop to efective the step instalations.

First of all I installed Nvidia proprietary drivers https://wiki.debian.org/NvidiaGraphicsDrivers from Debian Stable. In the MX-19.4 is Debian 10.
This step was mainly used to enable Nvidia provider as log below from xrandr --listproviders:

Code: Select all

Providers: number : 2
Provider 0: id: 0x47 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 5 associated providers: 0 name:modesetting
Provider 1: id: 0x24d cap: 0x2, Sink Output crtcs: 4 outputs: 3 associated providers: 0 name:NVIDIA-G0
I didn't used the Nvidia Driver Installer from MX. Using it was not enabling nvidia provider.

Second I disabled the Intel Graphics and enable Nvidia Graphics only because my laptop is always plugged in. So no Bumblebee, Primus or Nouveau is in usage, just graphic cards configurations. To do that, follow debian guide to enable Nvidia only https://wiki.debian.org/NVIDIA%20Optimu ... PrimaryGPU
After create a xorg.conf, apply the other configurations and reboot, maybe the second monitor works only or both works but the laptop monitor get a low resolution. As you saw in my first and previous post, my laptop monitor had a mode 1920x1080 but only 960x540 was loaded in my case.
My second monitor is a LG Ultra Wide 21:9 and it is working fine just enabling Nvidia only. See xrandr log:

Code: Select all

HDMI-0 connected 2560x1080+1920+0 (normal left inverted right x axis y axis) 673mm x 284mm
   2560x1080     60.00*+
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    59.93    59.94
Now, how to fix built-in laptop monitor resolution?
Well, I had followed xrandr ArchWiki guide https://wiki.archlinux.org/index.php/xr ... esolutions to test my previous 1920x1080 resolution and if I could enable without be automatically recognized.
After I saw that I can apply 1920x1080 mode with success, I moved my xorg.conf file to a 10-monitor.conf https://wiki.archlinux.org/index.php/xr ... esolutions and here is my final 10-monitor.conf file:

Code: Select all

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

Section "Device"
    Identifier "nvidia"
    Driver     "nvidia"
    BusID      "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device     "nvidia"
    Option     "AllowEmptyInitialConfiguration"
EndSection

Section "Monitor"
    Identifier "intel"
    Modeline   "1920x1080"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
    Option     "PreferredMode" "1920x1080"
    Option     "Primary" "true"
EndSection

Section "Screen"
    Identifier "intel"
    Monitor    "intel"
    DefaultDepth 24
    SubSection "Display"
        Modes "1920x1080"
    EndSubSection
EndSection

Section "Device"
    Identifier "intel"
    Driver     "modesetting"
    BusID      "PCI:0:2:0"
    Option     "AccelMethod" "none"
EndSection
And now dual monitor is working fine on my laptop. Both recognized, working in your max resolution mode and fresh rate with no leaks.
Fine tuning you can use xfce Display or ARandR as setting LeftOf/RightOf monitors.

I'm not an active user. I created account just to publish what I made to solve my issue. I hope that solve someone issue too.