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: Select all
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-G0Code: Select all
less /usr/share/doc/nvidia-drivers-450.57/README.bz2
Code: Select all
blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset
Code: Select all
# 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
Code: Select all
[X11]
DisplayCommand=/etc/sddm/scripts/Xsetup
Code: Select all
xrandr --setprovideroutputsource 1 0
xrandr --auto
Code: Select all
#!/bin/sh
modprobe nvidia
modprobe nvidia-drm
modprobe nvidia-uvm

