Kinoite: can't use dedicated GPU on a hybrid AMD/NVidia machine

Hello there,

After trying out some solutions that didn’t work I decided to write here.

I have a laptop with a hybrid AMD/NVidia config. Unfortunately, anecdotally (according to performance), the laptop is not using the discreet GPU card for graphically-demanding apps/games, incl. Steam (EDIT: it might be using the nouveau driver with NVidia instead, thus the abysmal performance).

My system is Fedora Kinoite with some layered packages: akmod-nvidia distrobox gcc latte-dock qjackctl tlp tlp-rdw xorg-x11-drv-nvidia.

When I go into system settings, in [About this system] it shows ‘AMD Radeon Graphics’ as the graphics processor. NVidia settings app also doesn’t state the GPU. GreenWithEnvy app states it can’t find the NVidia card.

EDIT: tried running __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears -info | grep GL_RENDERER but it prints out an error:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  150 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  26
  Current serial number in output stream:  27

While running the same thing without forcing the discrete GPU turns out just fine:

GL_RENDERER   = AMD Radeon Graphics (renoir, LLVM 16.0.4, DRM 3.52, 6.3.4-201.fc38.x86_64)

Running DRI_PRIME=1 with glxgears prints out GL_RENDERER = NV176. Unfortunately, can’t start Steam (Flatpak) with it:

SteamUpdateUI: An X Error occurred
X Error of failed request:  BadAlloc (insufficient resources for operation)

However, when I do lspci | grep VGA it outputs:

01:00.0 VGA compatible controller: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (rev c5)

So, it does recognise the discreet GPU. Tried layering nvidia-prime, prime-render, nvidia-dkms, hybrid-amd-nvidia-prime, video-hybrid-amd-nvidia-prime, but none of these exist in the repos and can’t be installed. Do I need to add a repo!?

The question is now why [About this system] doesn’t recognise it, and more importantly, how to utilise the NVidia GPU? Any ideas?

Thanks,

  • A

Another weird thing: lspci -n -n -k | grep -A 2 -e VGA -e 3D prints out:

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] [redacted] (rev a1)
        Subsystem: Lenovo Device [redacted]
        Kernel driver in use: nouveau
--
05:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [redacted] (rev c5)
        Subsystem: Lenovo Device [redacted]
        Kernel driver in use: amdgpu

Why does it use the nouveau driver?!?

Nouveau seems unable to use the hardware acceleration on nvidia GPUs. That seems one of the features that has not been reverse engineered with the open source driver. As a result, anything that requires a lot of graphic output uses the CPU and is drastically slower.

Now we need to determine why the system is not using the nvidia drivers.

  1. Is the nvidia driver installed?
    dnf list installed '*nvidia*' should tell us that.
    Please post that output so we know the current status.
  2. is secure boot enabled?
    mokutil --sb-state should tell us that.
    If secure boot is enabled and the driver modules are not signed the kernel cannot load the drivers
  3. If secure boot is enabled then the modules may be signed by following the instructions in /usr/share/doc/akmods/README.secureboot. Once that is completed then the modules must be recompiled with the signing key included
    dnf remove kmod-nvidia-* followed by akmods --force should rebuild the modules and another reboot should then load them.
    Alternatively one may simply disable secure boot within the bios settings.

Note that this is predicated upon having the drivers installed from rpmfusion and may be different if installed from a different source.

EDIT
Sorry, I noticed just now that you are using kinoite. The installation and other actions are different than the above which is based upon a workstation install.

Thanks Jeff. Yes, I am using Kinoite.

  1. As far as packages installed / layered, these are: akmod-nvidia xorg-x11-drv-nvidia. Maybe I need to layer additional / other ones?

  2. mokutil --state-sb prints: mokutil: unrecognized option '--state-sb'. Run with --sb-state instead prints: SecureBoot enabled.

  3. Is this really necessary? Would running the drivers be possible only if they are signed? Asking because a) I am a newbie, and b) Kinoite / Silverblue are a bit picky regarding these things.

Using the drivers is possible in 2 ways.
Unsigned drivers require secure boot to be disabled
With secure boot enabled the drivers must be signed.

I do not use kinoite or silverblue so have no experience there on how to manage that, but the requirement for signed drivers is uefi secure boot & kernel controlled and not related to any specific OS.

Thanks Jeff, yes, SB was the culprit – which is unfortunate as I want to have it enabled. Will search for a way to sign the drivers and load them in Kinoite.

Now DRI_PRIME=1 lspci -n -n -k | grep -A 2 -e VGA -e 3D prints:

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] [redacted] (rev a1)
        Subsystem: Lenovo Device [redacted]
        Kernel driver in use: nvidia
--
05:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [redacted] (rev c5)
        Subsystem: Lenovo Device [redacted]
        Kernel driver in use: amdgpu

which is great.

I still can’t get apps to actually use the discrete GPU. On GNOME there was a [Run with discrete GPU] option by right-clicking. KDE doesn’t seem to have such.