Why does my KDE X11 run on Nvidia rather than my laptop's iGPU?

Hello everyone,

So today, I wanted to learn to use my laptop’s iGPU (AMD Ryzen) to render X11 and use my Nvidia GPU only when needed.

When I boot on my pc, Manjaro KDE, without anything running other than the desktop which loaded, I wrote the command: " inxi -G " and on the output that it gives:

inxi -G                                                                                                  ✔ 
Graphics:
  Device-1: NVIDIA GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB]
    driver: nvidia v: 525.89.02
  Device-2: AMD Cezanne [Radeon Vega Series / Radeon Mobile Series]
    driver: amdgpu v: kernel
  Display: x11 server: X.Org v: 21.1.7 driver: X: loaded: nvidia gpu: amdgpu
    resolution: 3440x1440~60Hz
  API: OpenGL v: 4.6.0 NVIDIA 525.89.02 renderer: NVIDIA GeForce RTX 3080
    Laptop GPU/PCIe/SSE2

So if I am not wrong, the system is detecting both of the GPUs but it is running on the Nvidia GPU, am I correct? In this case, how can I “force” my system to run the plasma desktop with my AMD GPU and run Nvidia only when needed to have less fan noise…etc?

Or this means that Nvidia drivers are loaded but it uses the AMD GPU at the moment?

I also have this info with the " inxi -Fyz " command if it helps. I guess that according to this, it is using the Nvidia:

 Monitor-1: eDP-1 mapped: HDMI-0 model: BOE Display 0x0985 built: 2020
    res: 3440x1440 hz: 60 dpi: 109 gamma: 1.2 size: 800x335mm (31.5x13.19")
    diag: 406mm (16") ratio: 16:10 modes: max: 2560x1600 min: 640x480
  API: OpenGL v: 4.6.0 NVIDIA 525.89.02 renderer: NVIDIA GeForce RTX 3080
    Laptop GPU/PCIe/SSE2 direct-render: Yes

Thank you in advance.

You can’t selectively select which GPU to use for your applications, it’s one GPU for everything that is using your GUI…

Because your GUI is showing the output of your applications on the screen.
It is not like show this video inside a box coming from another device.

Yes you can. These systems are called ‘dual-graphics’ … and the usual setup is the integrated gpu by default, then calling the dedicated card for intensive tasks such as 3D rendering, games, etc.

The modern way of doing this is by using PRIME.

@Astonish

What does mhwd respond?

mhwd -li

If it appears you have the right profile installed then maybe pacman too:

pacman -Qs 'nvidia|amd'

as well as also check xorg conf files:

ls /etc/X11/xorg.conf.d/

The page above should be enough … but it looks like there have been some changes with mhwd profiles that are not reflected there.

IIRC previously a user with a case like this (amdgpu+nvidia) would want to have both video-nvidia and video-linux installed (video-linux covers free drivers like intel and amd).
Then call the card using PRIME like so:

DRI_PRIME=1 command

But it seems there is a new profile video-hybrid-amd-nvidia-prime so you probably want to install that.

Please refer back to the wiki for managing drivers through mhwd, envoking prime, etc.

1 Like

Hello @cscs ,

Thank you for your detailed reply. I tried looking on google and forums about the prime and optimus but unfortunately the links I found were all gone or old. Also I found out about hybrid amd nvidia thing yesterday but pamac search didn’t give me any result and when I searched for it on google, it only led me to people who had problems with it instead of a guide which teaches how to install it, so I appreciate your reply. Here is the response of mhwd -li

mhwd -li                                                                                                 ✔ 
> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
          video-nvidia            2021.11.04               false            PCI


Warning: No installed USB configs! 

Here is the answer that I get from the " pacman -Qs ‘nvidia|amd’ "

pacman -Qs 'nvidia|amd'                                                                                  ✔ 
local/amd-ucode 20230210.bf4115c-1
    Microcode update image for AMD CPUs
local/egl-wayland 2:1.1.11-3
    EGLStream-based Wayland external platform
local/lib32-libvdpau 1.5-1
    Nvidia VDPAU library
local/lib32-nvidia-utils 525.89.02-1
    NVIDIA drivers utilities (32-bit)
local/libteam 1.31-7
    Library for controlling team network device
local/libvdpau 1.5-1
    Nvidia VDPAU library
local/libxnvctrl 525.89.02-1
    NVIDIA NV-CONTROL X extension
local/linux61-nvidia 525.89.02-11 (linux61-extramodules)
    NVIDIA drivers for linux
local/linux62-nvidia 525.89.02-9 (linux62-extramodules)
    NVIDIA drivers for linux
local/mhwd-amdgpu 19.1.0-1
    MHWD module-ids for amdgpu
local/mhwd-nvidia 525.89.02-1
    MHWD module-ids for nvidia 525.89.02
local/mhwd-nvidia-390xx 390.157-1
    MHWD module-ids for nvidia 390.157
local/mhwd-nvidia-470xx 470.161.03-2
    MHWD module-ids for nvidia 470.161.03
local/nvidia-prime 1.0-4
    NVIDIA Prime Render Offload configuration and utilities
local/nvidia-prime-select-git 20191010.902aa9a-1
    A collection of shell scripts that makes it possible to use the NVIDIA GPU on a Optimus Laptop, similar to the
    feature provided by the nvidia-prime package in Ubuntu. Forked by wildtruc
local/nvidia-utils 525.89.02-1
    NVIDIA drivers utilities

And the result of " ls /etc/X11/xorg.conf.d/ " :

ls /etc/X11/xorg.conf.d/                                                                                 ✔ 
00-keyboard.conf  30-touchpad.conf  90-mhwd.conf

So I suppose that it is missing something? When I go to the Manjaro Settings Manager > Hardware Settings , I see that there is check (installed) next to video-nvidia, video linux, video-modesetting and video-veso. Video-hybrid-amd-nvidia-prime and video-hybrid-amd-nvidia-470xx-prime is unchecked. Now I will try to right click on video-hybrid-amd-nvidia-prime and install it, to see if it helps.

Edit: Well, I tried, but it says that it conflicts with video-nvidia driver:

Starting

Error: config ‘video-hybrid-amd-nvidia-prime’ conflicts with config(s): video-nvidia "

This is what I get. So I guess that this is the opensource drivers. Instead of messing my system, now I will stop and wait for your inputs, thank you for your help and time!

I guess you can remove video-nvidia and install video-hybrid-amd-nvidia-prime to install the hybrid profile. In theory installing it will run the system on the low end video chipset, and you can then start an application with prime-run to use Nvidia.

1 Like

Hello @omano ,

Thank you for your reply! I thought about this. But I was curious, video-hybrid-amd-nvidia-prime is always proprietary driver or is it the open source driver?

Ok I deleted the video-nvidia from terminal and installed the amd hybride with the command - referred to the wiki page above - :

sudo mhwd -i pci video-hybrid-amd-nvidia-prime                                                                       ✔ 
> Installing video-hybrid-amd-nvidia-prime...
Sourcing /etc/mhwd-x86_64.conf
Has lib32 support: true
Sourcing /var/lib/mhwd/db/pci/graphic_drivers/hybrid-amd-nvidia-prime/MHWDCONFIG
Processing classid: 0300
Sourcing /var/lib/mhwd/scripts/include/0300
:: Synchronizing package databases...
 core downloading...
 extra downloading...
 community downloading...
 multilib downloading...
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: eglexternalplatform will be installed before its nvidia-utils dependency

Packages (8) egl-wayland-2:1.1.11-3  eglexternalplatform-1.1-2  libxnvctrl-525.89.02-1  lib32-nvidia-utils-525.89.02-1  linux61-nvidia-525.89.02-11  linux62-nvidia-525.89.02-9  nvidia-prime-1.0-4  nvidia-utils-525.89.02-1

Total Installed Size:  932,86 MiB

:: Proceed with installation? [Y/n] 
checking keyring...
checking package integrity...
loading package files...
checking for file conflicts...
checking available disk space...
:: Processing package changes...
installing eglexternalplatform...
installing egl-wayland...
installing libxnvctrl...
installing nvidia-utils...
If you run into trouble with CUDA not being available, run nvidia-modprobe first.
If you use GDM on Wayland, you might have to run systemctl enable --now nvidia-resume.service
Optional dependencies for nvidia-utils
    xorg-server-devel: nvidia-xconfig
    opencl-nvidia: OpenCL support
installing nvidia-prime...
installing lib32-nvidia-utils...
Optional dependencies for lib32-nvidia-utils
    lib32-opencl-nvidia
installing linux61-nvidia...
installing linux62-nvidia...
:: Running post-transaction hooks...
(1/9) Creating system user accounts...
(2/9) Reloading system manager configuration...
(3/9) Reloading device manager configuration...
(4/9) Arming ConditionNeedsUpdate...
(5/9) Updating module dependencies...
(6/9) Updating Kernel initcpios for Nvidia-DRM...
==> Building image from preset: /etc/mkinitcpio.d/linux61.preset: 'default'
  -> -k /boot/vmlinuz-6.1-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.1-x86_64.img
==> Starting build: 6.1.19-1-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [plymouth]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-6.1-x86_64.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux61.preset: 'fallback'
  -> -k /boot/vmlinuz-6.1-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.1-x86_64-fallback.img -S autodetect
==> Starting build: 6.1.19-1-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [plymouth]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-6.1-x86_64-fallback.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux62.preset: 'default'
  -> -k /boot/vmlinuz-6.2-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.2-x86_64.img
==> Starting build: 6.2.7-2-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [plymouth]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-6.2-x86_64.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux62.preset: 'fallback'
  -> -k /boot/vmlinuz-6.2-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.2-x86_64-fallback.img -S autodetect
==> Starting build: 6.2.7-2-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [plymouth]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-6.2-x86_64-fallback.img
==> Image generation successful
(7/9) Refreshing PackageKit...
(8/9) Reloading system bus configuration...
(9/9) Updating the desktop file MIME type cache...
nvidia-utils: install reason has been set to 'explicitly installed'
nvidia-prime: install reason has been set to 'explicitly installed'
lib32-nvidia-utils: install reason has been set to 'explicitly installed'
linux61-nvidia: install reason has been set to 'explicitly installed'
linux62-nvidia: install reason has been set to 'explicitly installed'
xorg configuration file: '/etc/X11/mhwd.d/nvidia.conf'
> Successfully installed video-hybrid-amd-nvidia-prime

After I restart, It still says Nvidia for renderer with the inxi -Fza command. Is it because I had those Warnings above about missing firmwares? So it means that it isn’t installed correctly?

The hybrid profile is the Nvidia proprietary drivers, bundled with configuration to work with AMD CPU video chipset, as an “on demand” setup for Nvidia.

To know the default renderer try glxinfo | grep renderer

1 Like

Hello! Thank you so much! Here’s the result I get:

glxinfo | grep renderer                                                                                              ✔ 
OpenGL renderer string: NVIDIA GeForce RTX 3080 Laptop GPU/PCIe/SSE2

And also those missing firmware warnings that I got while installing is a problem?

Unless you have the corresponding hardware and you’re actually missing these modules, no you’re good like 99.9% of the forum people :smiley:

Maybe you have a setting in BIOS to change the “main” video card.

Give a proper full inxi --admin --verbosity=7 --filter --width instead of the cut down version you posted earlier to know what we’re dealing with.

//EDIT: maybe you have a “special” hardware case and you’ll need to do manual “reverse prime” or something like that.

I guess that I found out the problem and it seems like it is “unfixable” because it is running how it is supposed to run. I found out that the hdmi port of my computer is connected directly to the Nvidia. So, while using the external monitor, it only runs on nvidia.

So, I was still curious to see, running on AMD iGPU if i could get some performance gains, I decided to disconnect my hdmi cable and start computer. Normally I have the internal monitor disabled but when I run my computer on Dynamic GPU mode (the name of the hybrid gpu setting in Bios ) , my external monitor works and the built-in display of the laptop is turned on but it is all black. On the display settings panel, I don’t see the built in monitor, it only shows the external one. On the other hand if i put the bios setting to the discrete graphic card setting, then kde display settings is detecting my built-in monitor, and I am able enable or disable it from the setting screen.

I even tried disabling the external monitor and enabling the built in monitor, then go to bios, change back again to the dynamic gpu mode (hybrid mode) and it again boots only with external monitor. Even if i disconnect the external screen, it will boot into a total black, but turned on, screen.

How come?

EDIT: Now I messed up something lol. I installed optimus-manager and optimus-manager-qt according to some forum thread that was given as the solution that solved the built-in screen problem, but when I did this, my computer was stuck on black screen while booting with dynamic graphic card and was getting stuck on boot with Legion logo on discrete graphic mode. Well… thanks to this, I learned logging in TTY mode with ctrl+alt+f3 and there I applied:

pamac remove optimus-manager optimus-manager-qt

then I did:

sudo mhwd -r pci video-hybrid-amd-nvidia-prime

then I did:

sudo mhw -i pci video-nvidia

To revert back all the settings. This way I was able to boot with the dynamic mode but when I try to boot with the discrete mode, since the dynamic mode seems useless since I can’t really use the iGPU on my external monitor, I get to the login screen, I put my password, click on sign in, then it goes to the desktop loading screen, when the loading finishes, it goes back to the back screen.

Hmm… I fixed something, but still, not completely. At least, for the first time, I was able to fix to a certain level without reinstalling the system. Last week, for the same problem, I would have reinstalled the system. :smiley:

i think this is causing you issues:

but first post output from:
ls /etc/modprobe.d
find /etc/X11/ -name "*.conf"

1 Like

Hello @brahma ,

Ok fixed the monitor issue. I logged in again with tty, then removed the video-linux reverting to how it was when I fist posted my output here. Then logged in to desktop. When my external monitor went black after logging in - loses connection - I unplugged the hdmi and it made the built-in monitor show the desktop and then I plugged back the hdmi cable and I re enabled the external monitor.

here is the output that you asked:

ls /etc/modprobe.d                                                                                                   ✔ 
find /etc/X11/ -name "*.conf"
mhwd-gpu.conf
/etc/X11/xorg.conf.d/30-touchpad.conf
/etc/X11/xorg.conf.d/90-mhwd.conf
/etc/X11/xorg.conf.d/00-keyboard.conf
/etc/X11/xorg.conf
/etc/X11/mhwd.d/nvidia.conf

thank you!

remove this:
sudo pacman -R nvidia-prime-select-git
remove the video nvidia:
sudo mhwd -r pci video-nvidia
remove the xorg config:
sudo rm /etc/X11/xorg.conf

install drivers:
sudo mhwd -a pci nonfree 0300
reboot

1 Like

Hello, I did it, here is the result:

pacman -Qs 'nvidia|amd'                                                                                              ✔ 
local/amd-ucode 20230210.bf4115c-1
    Microcode update image for AMD CPUs
local/egl-wayland 2:1.1.11-3
    EGLStream-based Wayland external platform
local/lib32-nvidia-utils 525.89.02-1
    NVIDIA drivers utilities (32-bit)
local/libteam 1.31-7
    Library for controlling team network device
local/libvdpau 1.5-1
    Nvidia VDPAU library
local/libxnvctrl 525.89.02-1
    NVIDIA NV-CONTROL X extension
local/linux61-nvidia 525.89.02-11 (linux61-extramodules)
    NVIDIA drivers for linux
local/linux62-nvidia 525.89.02-9 (linux62-extramodules)
    NVIDIA drivers for linux
local/mhwd-amdgpu 19.1.0-1
    MHWD module-ids for amdgpu
local/mhwd-nvidia 525.89.02-1
    MHWD module-ids for nvidia 525.89.02
local/mhwd-nvidia-390xx 390.157-1
    MHWD module-ids for nvidia 390.157
local/mhwd-nvidia-470xx 470.161.03-2
    MHWD module-ids for nvidia 470.161.03
local/nvidia-utils 525.89.02-1
    NVIDIA drivers utilities

and this:

inxi -G                                                                                                              ✔ 
Graphics:
  Device-1: NVIDIA GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB]
    driver: nvidia v: 525.89.02
  Display: x11 server: X.Org v: 21.1.7 driver: X: loaded: nvidia gpu: nvidia
    resolution: 1: N/A 2: 3440x1440~60Hz
  API: OpenGL v: 4.6.0 NVIDIA 525.89.02 renderer: NVIDIA GeForce RTX 3080
    Laptop GPU/PCIe/SSE2

Now I will try rebooting with built-in screen and report back if it works. On external monitor it will always work on Nvidia because an hour ago, I found out that the HDMI port is hardwired to the Nvidia GPU.

provide output from:
mhwd -l -li
it probably installed only nvidia since the amd is disabled in bios…

1 Like

I reactivated the amd gpu on bios with dynamic mode and rebooted. It still does not detect the built-in display, it only works on the external display and here is the output that you asked:

mhwd -l -li                                                                                                          ✔ 
> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
          video-nvidia            2021.11.04               false            PCI


Warning: No installed USB configs!
> 0000:03:00.0 (0200:10ec:8168) Network controller Realtek Semiconductor Co., Ltd.:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
         network-r8168            2016.04.20                true            PCI


> 0000:01:00.0 (0300:10de:24dc) Display controller nVidia Corporation:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-amd-nvidia-prime            2021.11.04               false            PCI
video-hybrid-amd-nvidia-470xx-prime            2021.11.04               false            PCI
          video-nvidia            2021.11.04               false            PCI
    video-nvidia-470xx            2021.11.04               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI


> 0000:05:00.0 (0300:1002:1638) Display controller ATI Technologies Inc:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-amd-nvidia-prime            2021.11.04               false            PCI
video-hybrid-amd-nvidia-470xx-prime            2021.11.04               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI



shall I repeat the previous process that you explained with this dynamic mode on?

so are you now in the dynamic(hybrid) mode?

1 Like

yes exactly, I have been switching back and forth to try them all, right now I am on dynamic mode. The built-in laptop monitor is on but with total black screen. The system doesn’t seem to detect it in dynamic mode, no way to enable or disable it in GUI, so just using the external monitor.

so now that you are in dynamic/hybrid mode do this:
remove the video nvidia:
sudo mhwd -r pci video-nvidia

install drivers:
sudo mhwd -a pci nonfree 0300

check with:
mhwd -li
and the video-hybrid-amd-nvidia-prime and video-linux drivers should be listed, if they are, reboot

Hello!

Now my built-in monitor works finaly! and the renderr is the AMD GPU! Thank you so much! But now I am unable to enable the external monitor lol. I see it in the Display Settings Window but when I enable or set it as primary, and apply, nothing happens. The built-in screen blinks once and that’s all. Most probably because it is using the AMD Gpu and the HDMI connection needs the Nvidia.

Now I will reboot in discrete mode to see if it works that way.