Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

Sharing - AMDgpu and Nvidia Hybrid

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
pd1986
Guru
Guru
Posts: 404
Joined: Sun Feb 19, 2012 9:38 am
Location: Paris

Sharing - AMDgpu and Nvidia Hybrid

  • Quote

Post by pd1986 » Sun Aug 02, 2020 4:49 am

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: 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-G0
Refer to the Nvidia instruction Chapter 33 and Chapter 34 and know how to run application with nvidia driver.

Code: Select all

less /usr/share/doc/nvidia-drivers-450.57/README.bz2 
/etc/module.d/blasklist

Code: Select all

blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset
/etc/X11/xorg.conf

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

/etc/sddm.conf

Code: Select all

[X11]
DisplayCommand=/etc/sddm/scripts/Xsetup
/etc/sddm/scripts/Xsetup

Code: Select all

xrandr --setprovideroutputsource 1 0
xrandr --auto
/etc/profile.d/99-nvidia.sh

Code: Select all

#!/bin/sh
modprobe nvidia
modprobe nvidia-drm
modprobe nvidia-uvm
Top
crazy-andi
n00b
n00b
Posts: 4
Joined: Thu Sep 12, 2019 8:15 am

Additional parameter for module amdgpu needed

  • Quote

Post by crazy-andi » Fri Dec 04, 2020 8:12 am

Hi folks!

It took me 3 hours to get my X11 working...
Above config now works nice - but i needed this:

Code: Select all

/etc/modprobe.d/amdgpu.conf
options amdgpu exp_hw_support=1

This is my hardware:

Code: Select all

lspci | grep VGA:
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2192 (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6)
Have some fun!
Es sagte einst ein weiser Mann : Da wo du hingehst - da bist du dann!
Top
crazy-andi
n00b
n00b
Posts: 4
Joined: Thu Sep 12, 2019 8:15 am

  • Quote

Post by crazy-andi » Mon Jan 18, 2021 7:46 am

Hi @all.

There was another challenge.

I got an portable external HDMI-Monitor an tried do get 'em acting as secondary monitor on my notebook.
Above config did not work, as the HDMI port is connected to the nvidia chip.

Playing around, I found this setup.
There's a caveat. As this setup uses the nvidia gpu as primary gpu, optimus takes no effekt. we will use the nvidia GPU all the time , so there are no powersavings...

If someone found a setup allowing to use external monitors with amdgpu as primary gpu AND functional OPTIMUS - PLEASE POST!

My Hardware
CPU : AMD Ryzen 7 4800H with Radeon Graphics
NVIDIA GPU : GeForce GTX 1650 Ti
The primary notebook monitor seems to be wired to the amdgpu. The external monitor connectors seem to be wired to the nvidia gpu.

Current Software:
Gentoo profile : default/linux/amd64/17.1
kernel : gentoo-sources-5.4.80
xorg-server : 1.20.10
mesa : 20.2.4
xf86-video-amdgpu : 19.1.0
nvidia-drivers : 460.27.04


xorg.conf using nvidia gpu as primary gpu but allow external monitors:

Code: Select all

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen         "Screen0" 0 0
    Inactive       "amdGPU"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "AllowNVIDIAGPUScreens"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "nvidiaGPU"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration" "True"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Section "Device"
    Identifier     "nvidiaGPU"
    Driver         "nvidia"
    VendorName     "AMD"
    BusID          "PCI:1:0:0"
    Option         "PrimaryGPU" "Yes"
EndSection
Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol"
    Option         "Device" "/dev/input/mice"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option         "AutoRepeat" "500 30"
    Option         "XkbRules" "xorg"
    Option         "XkbLayout" "de"
    Option         "XkbModel" "pc105"
    Option         "XkbOptions" "altwin:super_win"
EndSection


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

Section "Device"
    Identifier     "amdGPU"
    Driver         "modesetting"
    VendorName     "Unknown"
EndSection
this is not sufficient as now the external monitor is the primary monitor and notebooks monitor remains black...
we need to setup via xrandr...
you should setup your login manager to execute this on startup.

xrandr.setup:

Code: Select all

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --output eDP-1-1 --primary --auto --left-of HDMI-0
xrandr --output HDMI-0 --auto --right-of eDP-1-1
Have some fun!
Es sagte einst ein weiser Mann : Da wo du hingehst - da bist du dann!
Top
Post Reply

3 posts • Page 1 of 1

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic