Offloading to iGPU not working

Greetings,
I want to run apps like firefox, xorg, kwin, plasmashell ect. on my AMD iGPU to save on Vram, but prime has very poor documentation in terms of configuration and I need some assistance.
All monitors are connected to the Nvidia GPU and I have added the iGPU as a device to my xorg.conf file and now have it show up in xrandr --listproviders, but I get the error

xrandr --setprovideroffloadsink 0 1

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  34 (RRSetProviderOffloadSink)
  Value in failed request:  0x1b7
  Serial number of failed request:  16
  Current serial number in output stream:  17

The AMD GPU and the Prime options don’t show up in nvidia-settings.

I did work with prime in the past to make a monitor connected to the iGPU usable, and needed to add something about prime in xorg.conf, but I don’t remember what it was.

Here is the entire Xorg.conf file based on what nvidia-settings created:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
    Inactive       "Device1"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

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

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Acer KG282K"
    HorizSync       160.0 - 160.0
    VertRefresh     40.0 - 60.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    #MatchDriver    "nvidia-drm"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce RTX 3080"
    #BusID          "PCI:1:00.0"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "amdgpu"
    VendorName     "AMD"
    BoardName      "AMD integrated gpu"
    BusID          "PCI:10:00.0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DP-2"
    Option         "metamodes" "DP-4: nvidia-auto-select +3840+0 {AllowGSYNCCompatible=On}, DP-2: nvidia-auto-select +0+0 {AllowGSYNCCompatible=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Help would be greatly appreciated.

I’m not 100% but like at least 99% sure that PRIME is an Nvidia proprietary technology and you can use it only to offload to Nvidia GPUs (someone please correct me if I’m wrong). Perhaps there’s another way to do something similar on AMD, but I’m not aware.

Anyway, you definitely can do the opposite thing: start your X session on your AMD iGPU and offload tasks that you want to the Nvidia by setting __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia env vars for such tasks: see for example the Debian wiki for PRIME offloading (not sure which distro you are using, but it’s probably the same everywhere).

1 Like

Yeah, I already thought so. I don’t really want to/can connect my Monitors to my iGPU.
I will do some research and come back when I find a solution.

Okay, I did some research and AMD GPUs should work through the environment variable DRI_PRIME.
Meaning, in theory DRI_PRIME=1 [some app] would be executed on GPU 1, DRI_PRIME=0 [some app] on GPU 0 and so on.
Now the problem is that for both DRI_PRIME 1 and 0 it always falls back to the RTX Card. Using the BusID’s directly doesn’t change this behavior.

1 Like

just FYI in case you can’t get DRI_PRIME method to work: you can use monitors connected to one GPU while running X on another, by specifying the one providing additional monitors using GPUDevice in your Screen section. See " Running X11 on an eGPU" section of this wiki page for an example. So in your case your Screen would need to specify your AMD as Device and the Nvidia as GPUDevice.

Okay, after way too much research into the topic, the best solution would be to connect all my monitors to the iGPU with multistreamed displayport and set up prime like you would for a laptop.

The DRI_PRIME only works for open source drivers, and Nvidia drivers don’t seem to be set up to off load rendering to another GPU.

Okay, got it working the way I described above. I will leave this open, as it’s a missing feature in my opinion.