Booting with non-free on a hybrid laptop and it works

@joekamprad I have been spending sometime testing out somethings with endeavour for my hybrid laptop. On my finally install after testing configurations with sddm and gdm. I selected the non-free option in the installer to see what would actually happen if I did. Well it booted right up with a prime render offload configuration. Not sure why this happened or how, because it does say not for hybrid laptops. For some reason it actually worked. I have not gone in and tried to configure anything graphically, I will post both my inxi -Fxxxa and inxi -Gxxxa below. If there is any other information you need me to pull let me know.

Here is my system info

inxi -Fxxxa --no-host
System:    Kernel: 5.8.11-arch1-1 x86_64 bits: 64 compiler: N/A 
           parameters: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=4dcaff95-de36-4cf1-b5a4-b9bb20355a97 rw quiet 
           resume=UUID=8d79b824-03d9-491b-a455-6c71d9166032 loglevel=3 nowatchdog 
           Desktop: Cinnamon 4.6.7 tk: GTK 3.24.23 dm: LightDM 1.30.0 Distro: EndeavourOS 
Machine:   Type: Laptop System: ASUSTeK product: Zephyrus G GU502DU_GA502DU v: 1.0 serial: <superuser/root required> 
           Mobo: ASUSTeK model: GU502DU v: 1.0 serial: <superuser/root required> UEFI: American Megatrends v: GU502DU.302 
           date: 03/26/2020 
Battery:   ID-1: BAT0 charge: 64.8 Wh condition: 64.8/76.0 Wh (85%) volts: 15.8/15.8 model: ASUSTeK ASUS Battery type: Li-ion 
           serial: N/A status: Not charging 
CPU:       Info: Quad Core model: AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx bits: 64 type: MT MCP arch: Zen+ 
           family: 17 (23) model-id: 18 (24) stepping: 1 microcode: 8108102 L2 cache: 2048 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 36750 
           Speed: 1222 MHz min/max: 1400/2300 MHz boost: enabled Core speeds (MHz): 1: 1352 2: 1436 3: 1358 4: 1353 5: 1239 
           6: 1203 7: 1223 8: 1200 
           Vulnerabilities: Type: itlb_multihit status: Not affected 
           Type: l1tf status: Not affected 
           Type: mds status: Not affected 
           Type: meltdown status: Not affected 
           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 AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling 
           Type: srbds status: Not affected 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] vendor: ASUSTeK driver: nvidia v: 455.23.04 
           alternate: nouveau,nvidia_drm bus ID: 01:00.0 chip ID: 10de:2191 
           Device-2: Advanced Micro Devices [AMD/ATI] Picasso vendor: ASUSTeK driver: amdgpu v: kernel bus ID: 06:00.0 
           chip ID: 1002:15d8 
           Display: x11 server: X.Org 1.20.9 driver: amdgpu,ati,nvidia unloaded: fbdev,modesetting,vesa alternate: nouveau,nv 
           display ID: :0 screens: 1 
           Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9") 
           Monitor-1: eDP res: 1920x1080 hz: 120 dpi: 142 size: 344x194mm (13.5x7.6") diag: 395mm (15.5") 
           Message: Unable to show advanced data. Required tool glxinfo missing. 
Audio:     Device-1: NVIDIA TU116 High Definition Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 01:00.1 
           chip ID: 10de:1aeb 
           Device-2: Advanced Micro Devices [AMD/ATI] Raven/Raven2/Fenghuang HDMI/DP Audio vendor: ASUSTeK 
           driver: snd_hda_intel v: kernel bus ID: 06:00.1 chip ID: 1002:15de 
           Device-3: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel 
           bus ID: 06:00.6 chip ID: 1022:15e3 
           Sound Server: ALSA v: k5.8.11-arch1-1 
Network:   Device-1: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter vendor: AzureWave driver: rtl8821ce v: N/A 
           modules: 8821ce port: e000 bus ID: 03:00.0 chip ID: 10ec:c821 
           IF: wlan0 state: down mac: a2:a6:ea:5e:71:e5 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK driver: r8169 v: kernel 
           modules: r8168 port: d000 bus ID: 04:00.0 chip ID: 10ec:8168 
           IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: 04:d4:c4:6e:4a:b5 
Drives:    Local Storage: total: 942.70 GiB used: 7.79 GiB (0.8%) 
           SMART Message: Unable to run smartctl. Root privileges required. 
           ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKNW512G8 size: 476.94 GiB block size: physical: 512 B logical: 512 B 
           speed: 31.6 Gb/s lanes: 4 serial: BTNH90150CPB512A rev: 002C scheme: GPT 
           ID-2: /dev/nvme1n1 vendor: Western Digital model: WDBRPG5000ANC-WRSN size: 465.76 GiB block size: physical: 512 B 
           logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: 1940D3800853 rev: 102000WD scheme: GPT 
Partition: ID-1: / raw size: 456.66 GiB size: 448.50 GiB (98.21%) used: 7.79 GiB (1.7%) fs: ext4 dev: /dev/nvme1n1p2 
Swap:      Kernel: swappiness: 60 (default) cache pressure: 100 (default) 
           ID-1: swap-1 type: partition size: 8.80 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/nvme1n1p3 
Sensors:   System Temperatures: cpu: 49.5 C mobo: N/A gpu: amdgpu temp: 49.0 C 
           Fan Speeds (RPM): cpu: 4000 
Info:      Processes: 250 Uptime: 8m Memory: 15.38 GiB used: 1.44 GiB (9.4%) Init: systemd v: 246 Compilers: gcc: 10.2.0 
           clang: 10.0.1 Packages: pacman: 828 lib: 232 Shell: Bash v: 5.0.18 running in: gnome-terminal inxi: 3.1.06
inxi -Gxxxa
Graphics:  Device-1: NVIDIA TU116M [GeForce GTX 1660 Ti Mobile] vendor: ASUSTeK driver: nvidia v: 455.23.04 
           alternate: nouveau,nvidia_drm bus ID: 01:00.0 chip ID: 10de:2191 
           Device-2: Advanced Micro Devices [AMD/ATI] Picasso vendor: ASUSTeK driver: amdgpu v: kernel bus ID: 06:00.0 
           chip ID: 1002:15d8 
           Display: x11 server: X.Org 1.20.9 driver: amdgpu,ati,nvidia unloaded: fbdev,modesetting,vesa alternate: nouveau,nv 
           display ID: :0 screens: 1 
           Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9") 
           Monitor-1: eDP res: 1920x1080 hz: 120 dpi: 142 size: 344x194mm (13.5x7.6") diag: 395mm (15.5") 
           Message: Unable to show advanced data. Required tool glxinfo missing. 
4 Likes

So are you able to switch back and forth?

There is a specific method to get switching to work. I will be posting about that, I just thought this was interesting that the non-free option automatically configures prime render on my hybrid laptop. It is working as intended with prime render offload, here is my nvidia-smi output after running the command to start glxgears using the nvidia card.

nvidia-smi
Sat Sep 26 16:58:37 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.23.04    Driver Version: 455.23.04    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 166...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   36C    P8     8W /  N/A |     10MiB /  5944MiB |     21%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       823      G   /usr/lib/Xorg                       6MiB |
|    0   N/A  N/A     17846      G   glxgears                            2MiB |
+-----------------------------------------------------------------------------+

The NVIDIA driver has supported render offload since 435xx so this is not surprising.

If you want to run applications using the dGPU then you can use the prime-run wrapper (from the nvidia-prime package).

Edit: Can confirm that the nvidia-prime package does indeed work.

I will take a look at the nvidia-prime package, generally anything that was made for the hybrid/optimus laptops was all based on intel/nvidia. Optimus Switch and Bumblebee both don’t work for ryzen/nvidia setups. I just setup a couple of alias’s in my bashrc to run the offload commands.

alias nvr="__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
alias vkr="__NV_PRIME_RENDER_OFFLOAD=1"

The surprising part is that you generally need a specific nvidia.conf to get it to work properly. Otherwise my system will default to amd only. Seeing as how I haven’t added a prime render conf to

/etc/X11/xorg.conf.d/

its a bit surprising that it just works. Its definitely a great thing and means that hardware support for hybrids is getting better and better. On a fresh install there is no nvidia.conf at /etc/X11/xorg.conf.d/. However there is one at

/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf

and its contents are

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

The nvidia.conf I use on my systems from render offload is the following

Section "ServerLayout"
    Identifier "layout"
    Option "AllowNVIDIAGPUScreens"
EndSection

Section "OutputClass"
    Identifier "AMDgpu"
    MatchDriver "amdgpu"
    Driver "amdgpu"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection
1 Like

exactly that, when we do start with nvidia option this was not inside, and it will not work for older optimus systems (as far as i know) we do still not have updated the wiki as it will need testing by someone with that hardware … dev team do not have this.

1 Like

It’s great to see someone doing this because there are many new laptops with Ryzen CPU/AMD Graphics and Nvdia Dedicated cards. I think these will be way better combo than the Intel/Nvidia currently.

2 Likes

I was going to say the only downside to these is no synchronization with and ryzen/nvidia setup. I guess with one of the latest nvidia updates they brought synchronization support to these setups! Still not sure if you can plug the computer into an external dispaly using prime render. I know that you weren’t able to do it, but nvidia may have added that ability as well.

Just fyi, -xxxa is exactly the same as -a.

-a triggers -xxx automatically. --admin/-a basically means, show it all to me, plus the admin level stuff in addition.