Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Sharing - AMDgpu and Nvidia Hybrid
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 390
Location: Paris

PostPosted: Sun Aug 02, 2020 4:49 am    Post subject: Sharing - AMDgpu and Nvidia Hybrid Reply with quote

Hi, guys

I just bought a new laptop with AMD 4600H with NVIDIA GTX 1650. Gentoo is newly installed with KDE plasma5 and SDDM. Until now, I can run the system and application with amdgpu without any problem and run specific application with Nvidia property driver. The Nvidia/Optimus support hybrid of AMDgpu and Nvidia I don't know since when. Make sure the laptop boot up with option switchable graphic or hybrid option in BIOS, enable GPU swithing support in Kernel. Here below is what I did. Hope it can help people who have the same hardware

I use the Nvidia property driver, No try for nouveau. Use blacklist method in /etc/modprobe.d/blacklist.conf to block the nvidia modules by udev. Otherwise there is some error with udev to load nvidia property driver. Probably stuck in booting and shutdown during the udev to load/remove nvidia modules. Sometimes you may see message from dmesg like "udev timeout 'nvidia-udev.sh add". Looks like it's a bug and not fixed yet. You can search related discussion in the gentoo forum.

running nvidia-xconfig may not generate the xorg.conf configuration correctly. Need manually adjust it. see blow my configuration.
I use sddm as display manager. see page of Gentoo wiki Nvidia/Optimus
Nvidia modules need to be fully loaded before SDDM. Since it's blocked in udev, need to add a sh file in /etc/profile.d/99-nvidia.sh
after all done, run xrandr --listproviders and you will see the message below

Code:
xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x54 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 1 associated providers: 0 name:Unknown AMD Radeon GPU @ pci:0000:05:00.0
Provider 1: id: 0x1f6 cap: 0x2, Sink Output crtcs: 4 outputs: 4 associated providers: 0 name:NVIDIA-G0


Refer to the Nvidia instruction Chapter 33 and Chapter 34 and know how to run application with nvidia driver.
Code:
less /usr/share/doc/nvidia-drivers-450.57/README.bz2


/etc/module.d/blasklist
Code:

blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset


/etc/X11/xorg.conf
Code:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 450.57


Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "AMDgpu" 0 0
    Inactive       "nvidia"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "AllowNVIDIAGPUScreens"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from data in "/etc/conf.d/gpm"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol"
    Option         "Device" "/dev/input/mice"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "AMDgpu"
    Driver         "amdgpu"
    VendorName     "AMD"
    BusID          "PCI:5:0:0"
EndSection

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

Section "Screen"
    Identifier     "AMDgpu"
    Device         "AMDgpu"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection



/etc/sddm.conf
Code:
[X11]
DisplayCommand=/etc/sddm/scripts/Xsetup


/etc/sddm/scripts/Xsetup
Code:
xrandr --setprovideroutputsource 1 0
xrandr --auto


/etc/profile.d/99-nvidia.sh
Code:
#!/bin/sh
modprobe nvidia
modprobe nvidia-drm
modprobe nvidia-uvm
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments 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