You are not logged in.

#1 2025-08-17 19:24:14

Coffea
Member
Registered: 2024-07-26
Posts: 11

Render OpenGL on Secondary GPU (Wayland)

I have 2 nvidia GPU's installed (4080super & 1070ti,) both are seen in nvtop and I can use both to accelerate cycles blender.

DE is Wayland & Plasma (with no option to launch into X in SDDM).

Windows Nvdia drivers come with a context menu (& driver options) that allows a choice of OpenGL rendering device when launching an application, I find it especially useful to stick something like Second Life on the secondary GPU while I'm working in blender or playing an actual game on the main card, and I'm trying to accomplish a similar outcome..

I have tried messing with setting various command line variables and no matter what I try, the secondary GPU is never seen.

--> DRI_PRIME=0 glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 16376 MB
    Total available memory: 16376 MB
    Currently available dedicated video memory: 13932 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 580.76.05
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 580.76.05
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 580.76.05
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
--> DRI_PRIME=1 glxinfo -B

... identical output to above ...

Kinda at a loss here, any ideas?

Offline

#2 2025-08-18 12:19:02

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,574

Re: Render OpenGL on Secondary GPU (Wayland)

DE is Wayland & Plasma (with no option to launch into X in SDDM).

https://archlinux.org/news/plasma-640-w … re-on-x11/


glxinfo is meant for X and not very useful in wayland/xwayland .
Try running those commands with eglinfo .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2025-08-18 16:36:03

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

`--> eglinfo -B
GBM platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES 
OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 20.1.8, DRM 3.64, 6.16.1-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 25.1.7-arch1.1
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: AMD
OpenGL compatibility profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 20.1.8, DRM 3.64, 6.16.1-arch1-1)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 25.1.7-arch1.1
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: AMD
OpenGL ES profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 20.1.8, DRM 3.64, 6.16.1-arch1-1)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 25.1.7-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Wayland platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 580.76.05
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 580.76.05
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 580.76.05
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

X11 platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 580.76.05
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 580.76.05
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 580.76.05
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Surfaceless platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 580.76.05
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 580.76.05
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 580.76.05
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Device platform:
Device #0:

Platform Device platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 580.76.05
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 580.76.05
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 580.76.05
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Device #1:

Platform Device platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 580.76.05
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 580.76.05
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 580.76.05
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Device #2:

Platform Device platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES 
OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 20.1.8, DRM 3.64, 6.16.1-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 25.1.7-arch1.1
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: AMD
OpenGL compatibility profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 20.1.8, DRM 3.64, 6.16.1-arch1-1)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 25.1.7-arch1.1
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: AMD
OpenGL ES profile renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 20.1.8, DRM 3.64, 6.16.1-arch1-1)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 25.1.7-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Device #3:

Platform Device platform:
libEGL warning: egl: failed to create dri2 screen
libEGL warning: egl: failed to create dri2 screen
eglinfo: eglInitialize failed

Device #4:

Platform Device platform:
libEGL warning: egl: failed to create dri2 screen
libEGL warning: egl: failed to create dri2 screen
eglinfo: eglInitialize failed

Device #5:

Platform Device platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES 
OpenGL core profile vendor: Mesa
OpenGL core profile renderer: llvmpipe (LLVM 20.1.8, 256 bits)
OpenGL core profile version: 4.5 (Core Profile) Mesa 25.1.7-arch1.1
OpenGL core profile shading language version: 4.50
OpenGL compatibility profile vendor: Mesa
OpenGL compatibility profile renderer: llvmpipe (LLVM 20.1.8, 256 bits)
OpenGL compatibility profile version: 4.5 (Compatibility Profile) Mesa 25.1.7-arch1.1
OpenGL compatibility profile shading language version: 4.50
OpenGL ES profile vendor: Mesa
OpenGL ES profile renderer: llvmpipe (LLVM 20.1.8, 256 bits)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 25.1.7-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Ok this does correctly identify multiple GPUs .. so how do I run opengl applications on device 1

Offline

#4 2025-08-18 16:49:32

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

Ok .. after installing and switching to X11 I can get applications to run on the secondary GPU with

`--> __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia <command here>

Running the same command from a Wayland session sadly doesn't work and the application still launches on the primary GPU.

Going back to X11 full time is pretty much unthinkable at this point and not really a solution. It "works" but its a horrible experience.

Offline

#5 2025-08-19 10:12:27

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,574

Re: Render OpenGL on Secondary GPU (Wayland)

__GLX_VENDOR_LIBRARY_NAME and __NV_PRIME_RENDER_OFFLOAD are hacks to get nvidia on X to work with PRIME because nvidia din't support PRIME well in the past.

Try DRI_PRIME=1 your-application .
Note that apps using vulkan typically use a different mechanism to select a videocard to render on.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#6 2025-08-19 16:37:39

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

DRI_PRIME=1 does nothing / appears to be ignored, the application (opengl) still runs on primary GPU.

`--> DRI_PRIME=1 glxgears -info    
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
GL_RENDERER   = NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
GL_VERSION    = 4.6.0 NVIDIA 580.76.05

Offline

#7 2025-08-19 18:04:02

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,574

Re: Render OpenGL on Secondary GPU (Wayland)

glxgears is also a X application, just like glxinfo .

For clarity :
Are you trying to get wayland applications to use the secondary gpu OR are you trying to do that for X applications running on xwayland ?

Those 2 situations need very different approaches .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#8 2025-08-19 20:08:16

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

... identical output to above ...

Meaning you're running the session on the nvidia GPU, which is kinda not supposed to be the case.
Please post your complete system journal for the boot:

sudo journalctl -b | curl -F 'file=@-' 0x0.st

Offline

#9 2025-08-20 09:04:14

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,574

Re: Render OpenGL on Secondary GPU (Wayland)

Coffea wrote:

I have 2 nvidia GPU's installed (4080super & 1070ti,

So there should be 3 videocards : 1 amd & the 2 nvidia cards.
glxinfo / glxgears under xwayland only seem to see the nvidia 4080


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#10 2025-08-20 18:33:55

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

Lone_Wolf wrote:

glxgears is also a X application, just like glxinfo .

For clarity :
Are you trying to get wayland applications to use the secondary gpu OR are you trying to do that for X applications running on xwayland ?

Those 2 situations need very different approaches .

It's an X application and I am using Wayland.

Lone_Wolf wrote:

So there should be 3 videocards : 1 amd & the 2 nvidia cards.

There are 3 as the on CPU is enabled, it's not really relevant. This is a desktop.

0 Nvidia 4080
1 Nvidia 1070Ti
2 Whatever AMD thing came with the CPU that for some reason the BIOS enables.

DRI_PRIME=0 and DRI_PRIME=1 both result in the primary (4080) being used, seems it's the only GPU as far as xwayland is concerned

Offline

#11 2025-08-21 09:13:30

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,574

Re: Render OpenGL on Secondary GPU (Wayland)

xwayland doesn't seem to log much but there may be some logs in ~/.local/share/xorg .
Please post the content of the most recent log there .

Your journal could also help, run the command seth posted in #8 and post the link it outputs.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#12 2025-08-21 12:13:55

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

https://download.nvidia.com/XFree86/Lin … fload.html

xrandr --listproviders

The index you provide to __NV_PRIME_RENDER_OFFLOAD=<index> will matter, also because of "wayland™" see https://wiki.archlinux.org/title/PRIME# … rs_-_PRIME and select the GPU by its PCI Bus ID.

For more clarification: do /do/ intend to run the session on one of the nvidia GPUs and not  "Whatever AMD thing came with the CPU that for some reason the BIOS enables" but then want to run superturboturkeypuncher³ on the other GPU
Next to the journal certainly post your Xorg log, https://wiki.archlinux.org/title/Xorg#General - you might also want to completely disable the APU (in the OS if your BIOS doesn't offer such switch)

Offline

#13 2025-08-22 17:58:49

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

Journal after a fresh boot - http://0x0.st/KiV8.txt

Last XOrg log file from a few days ago - http://0x0.st/KiVq.txt

`--> xrandr --listproviders
Providers: number : 0

Offline

#14 2025-08-22 19:10:25

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

From the xorg log, outputs are only attached to the RTX 4080 and the server ran on that
=> do you intend to run the process on the 1070 ??

[   293.383] (==) Log file: "/home/coffea/.local/share/xorg/Xorg.0.log", Time: Mon Aug 18 13:24:57 2025

Was this a legit X11 server session, though?

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia DRI_PRIME=pci-0000_10_00_0 glxinfo -B

Though the empty provider list might be an issue.

qdbus6 org.kde.KWin /KWin supportInformation

Also: ready to try this on plasma/X11 (since we're dealing w/ an X11 client anyway)?

Offline

#15 2025-08-22 22:58:09

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

seth wrote:

From the xorg log, outputs are only attached to the RTX 4080 and the server ran on that
=> do you intend to run the process on the 1070 ??

Yes, there are no monitors attached to the 1070.

When running X11, I am able to use __NV_PRIME_RENDER_blahblahblah to have the application rendered by the 1070 and output displayed on any screen connected to the 4080. That works fine, it's just it's X11.

I have tried connecting a screen to the 1070 under wayland, the app always renders on the 4080 regardless of where the output is displayed.


seth wrote:

Was this a legit X11 server session, though?

I started plasma up on X11 from SDDM, so I would assume so.

qdbus6 org.kde.KWin /KWin supportInformation

Wayland -> https://0x0.st/KiyG.txt
X11 -> https://0x0.st/KitP.txt

Offline

#16 2025-08-23 06:42:11

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

That works fine, it's just it's X11.

Annoying, isn't? tongue

Try to force kwin to pick up the two nvidia GPUs in the right order: https://wiki.archlinux.org/title/KDE#Me … -specific)
Pay attention to the card order, it might not be deterministic between reboots.

Offline

#17 2025-08-23 21:29:59

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

seth wrote:

Try to force kwin to pick up the two nvidia GPUs in the right order: https://wiki.archlinux.org/title/KDE#Me … -specific)
Pay attention to the card order, it might not be deterministic between reboots.

Ok, I can use that to force the entire wayland desktop to render on a specific GPU, all applications launched follow and render on the same selected GPU, that part works as expected.

None of the command line stuff for launching an app once a wayland session has started allows me to put an application on a different GPU.

Offline

#18 2025-08-24 08:28:21

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

The idea is to add the two relevant GPUs there in desired order and then hope for prime-run to work on the other GPU.
And remember

That works fine, it's just it's X11.

wayland is the future, like, when we've flying cars and hoverboards and so tongue

Offline

#19 2025-08-24 22:26:16

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

seth wrote:

The idea is to add the two relevant GPUs there in desired order and then hope for prime-run to work on the other GPU.

Prim run is just a little bash glue, and it only works when running on X11.

/usr/bin/prime-run 
#!/bin/bash
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"

Nothing I do seems to work on Wayland.

Offline

#20 2025-08-25 07:52:06

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

I know what prime-run is.

Nothing I do seems to work on Wayland.

https://bbs.archlinux.org/viewtopic.php?id=57855

Again: the idea was to control what cards kwin_wayland utilizes and in what order (4080, 1070), did you do that (and what exactly)?
Then throw all the prime parameters at it.

Offline

#21 2025-08-25 18:38:58

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

seth wrote:

Again: the idea was to control what cards kwin_wayland utilizes and in what order (4080, 1070), did you do that (and what exactly)?
Then throw all the prime parameters at it.

As I said.

The instructions for kwin do work when setting up which GPU wayland is rendered using. I am able to use that to get my secondary card to do all the work while the output is displayed via the primary.

Once that's done, there is no way that I've found to get a specific application to run on a GPU other than the one rendering wayland.

If I use the kwin config, I can move everything to the secondary. Everything from that point then renders on that GPU, without exception.

All or nothing.

This is not what happens when running X11. But I'm not going to do that, because X11.

There are no further log files with differences to share as we have made no progress.

So unless there is some other way of accomplishing what prime-run does, I don't know how to proceed.

Offline

#22 2025-08-25 19:14:16

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

Don't paraphrase, actually read https://bbs.archlinux.org/viewtopic.php?id=57855
You're forcing everyone else to operate exclusively based on assumptions about what you do and see.

export KWIN_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0

should make the display server run on the 4080 (according to your previous xorg log)
From there

DRI_PRIME=pci-0000_10_00_0 foo

should™ run "foo" on the 1070 - at least for native wayland clients (which I'd test first)

So unless there is some other way of accomplishing what prime-run does, I don't know how to proceed.

But I'm not going to do that, because X11.

https://bbs.archlinux.org/viewtopic.php … 7#p2254777
Last paragraph.

Offline

#23 2025-08-26 01:58:20

Coffea
Member
Registered: 2024-07-26
Posts: 11

Re: Render OpenGL on Secondary GPU (Wayland)

While this specific GPU functionality seems to work under X11 it's not suitable for my use cases and not the problem I am having, I literally put Wayland in the title.



`--> lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation AD103 [GeForce RTX 4080 SUPER] (rev a1)
10:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070 Ti] (rev a1)
`--> cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status
active
`--> cat /sys/bus/pci/devices/0000:10:00.0/power/runtime_status 
active
`--> nvidia-smi         
Mon Aug 25 20:48:29 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.76.05              Driver Version: 580.76.05      CUDA Version: 13.0     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4080 ...    Off |   00000000:01:00.0  On |                  N/A |
|  0%   46C    P8             18W /  320W |    1972MiB /  16376MiB |     31%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA GeForce GTX 1070 Ti     Off |   00000000:10:00.0 Off |                  N/A |
|  0%   39C    P8              8W /  180W |       5MiB /   8192MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
--> ls -la ~/.config/plasma-workspace/env/gpu.sh 
-rwxr-xr-x 1 coffea coffea 66 Aug 25 20:38 /home/coffea/.config/plasma-workspace/env/gpu.sh
`--> cat ~/.config/plasma-workspace/env/gpu.sh 
#!/bin/bash
export KWIN_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0
`--> qdbus6 org.kde.KWin /KWin org.kde.KWin.supportInformation | grep renderer

OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
`--> DRI_PRIME=0 eglewinfo | grep Running
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation
DRI_PRIME=1 eglewinfo | grep Running
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation

`--> DRI_PRIME=pci-0000_01_00_0 eglewinfo | grep Running
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation
`--> DRI_PRIME=pci-0000_10_00_0 eglewinfo | grep Running 
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation

`-->  __NV_PRIME_RENDER_OFFLOAD=0 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia eglewinfo | grep Running 
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation
`-->  __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia eglewinfo | grep Running
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation
`--> DRI_PRIME=pci-0000_01_00_0 glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
`--> DRI_PRIME=pci-0000_10_00_0 glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2

`--> DRI_PRIME=0 glxinfo | grep renderer                                                       
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
`--> DRI_PRIME=1 glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2

`--> prime-run glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2

`--> __NV_PRIME_RENDER_OFFLOAD=0 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia  glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2
`--> __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia  glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2

If I switch KWIN_DRM_DEVICES around to push everything onto the 1070 ...

`--> cat ~/.config/plasma-workspace/env/gpu.sh 
#!/bin/bash
export KWIN_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1

This shows exactly the opposite results to the above test demonstrating that the KWIN_DRM_DEVICES is doing its part, but any attampts to do work on the other GPU (now the 4080), don't.

`--> qdbus6 org.kde.KWin /KWin org.kde.KWin.supportInformation | grep renderer

OpenGL renderer string: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2

Notable weirdness .. eglewinfo falsely reports the 4080 (got my hopes up for a second)

`--> DRI_PRIME=pci-0000_01_00_0 eglewinfo | grep Running                                                      
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation
`--> DRI_PRIME=pci-0000_10_00_0 eglewinfo | grep Running
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation

`--> DRI_PRIME=0 eglewinfo | grep Running
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation
`--> DRI_PRIME=1 eglewinfo | grep Running
Running on a NVIDIA GeForce RTX 4080 SUPER/PCIe/SSE2 from NVIDIA Corporation

However running both eglgears_wayland and eglgears_x11 they both actually render on the 1070, at no point does the 4080 show any load in either nvidia-smi or nvtop.

 Device 0 [NVIDIA GeForce RTX 4080 SUPER] PCIe GEN 1@16x RX: 1.106 GiB/s TX: 650.0 KiB/s
 GPU 210MHz  MEM 405MHz  TEMP  43°C  FAN   0%   POW  20 / 320 W
 GPU[                                    0%] MEM[|                     0.595Gi/15.992Gi]

 Device 1 [NVIDIA GeForce GTX 1070 Ti]    PCIe GEN 3@ 4x RX: 2.686 MiB/s TX: 854.1 MiB/s
 GPU 1873MHz MEM 4006MHz TEMP  55°C  FAN  50%   POW  50 / 180 W
 GPU[||||||||||||                       31%] MEM[||||||                 1.325Gi/8.000Gi]

eglewinfo weirdness aside, glxinfo correctly shows it's going to follow Wayland irrespective of any variables set.

`--> DRI_PRIME=pci-0000_01_00_0  glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
`--> DRI_PRIME=pci-0000_10_00_0  glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2

`--> DRI_PRIME=1 glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
`--> DRI_PRIME=0 glxinfo | grep renderer 
OpenGL renderer string: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2

`--> __NV_PRIME_RENDER_OFFLOAD=0 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia  glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
`--> __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia  glxinfo | grep renderer
OpenGL renderer string: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2


Rending anything on anything other than the GPU backing Wayland demonstrably isn't working.

Offline

#24 2025-08-26 09:34:02

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,574

Re: Render OpenGL on Secondary GPU (Wayland)

For clarity :

You're still trying to get X applications on xwayland to use a specific gpu ?

If so, have you tried running those apps in a 'rootfull' xwayland server ?

Check https://bennett.dev/rootful-xwayland/ and https://ofourdan.blogspot.com/2023/10/x … part1.html .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#25 2025-08-26 12:46:49

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,624

Re: Render OpenGL on Secondary GPU (Wayland)

DRI_PRIME=0! …
DRI_PRIME=1! …
DRI_PRIME=2! …

nb. the exclamation mark, but you'll simply have to file a bug against kwin_wayland for its incomplete/broken prime support if you insist on wayland for I'll just call religious reasons, notably since…

…apparently we're only concerned about xwayland anyway => I'd try reconfigure the X11 server
/etc/X11/xorg.conf

Section "ServerLayout"
        Identifier "layout"
        Screen 0 "nv1070"
        Inactive "nv4080"
        Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
        Identifier "nv1070"
        Driver "nvidia"
EndSection

Section "Screen"
        Identifier "nv1070"
        Device "nvidia"
        BusID "PCI:16:0:0"
EndSection

Section "Device"
        Identifier "nv4080"
        Driver "nvidia"
        BusID "PCI:1:0:0"
EndSection

Section "Screen"
        Identifier "nv4080"
        Device "nv4080"
EndSection

This should™ make the X11 server run on the 1070 and if xwayland picks that up it too will run on the 1070 - at this point make sure that no DRI_PRIME or whatever is leaking into the clients context.

Offline

Board footer

Powered by FluxBB