You are not logged in.

#1 2021-10-16 10:06:11

michelesr
Member
Registered: 2016-02-04
Posts: 55

FPS half the refresh rate with Xwayland offloading (NVIDIA)

NVIDIA drivers recently introduced PRIME offloading support on XWayland. In practice, that means that you can run a Wayland compositor (such as Sway) with the iGPU and then use the discrete NVIDIA graphic card when launching X11 clients on XWayland (running them using the prime-run wrapper which sets relevant environment variables).

I'm using prime-run on Sway to run 3D applications with the NVIDIA card, however, when they are fullscreen, Sway uses direct scan-out, which from my understanding means disabling the composition and giving full control of the screen buffer to the application. If you have the nvidia_drm module loaded, that will attempt to perform vertical synchronization, removing tearing, but that seems to lock the framerate to half the screen refresh rate. Obvious workaround is not to run the app in fullscreen (and emulating fullscreen e.g. by hiding windows borders/decorations and tray bar). When the app is not fullscreen, the framerate is correctly capped to the screen refresh rate.

Another weird artifact I've sometimes noticed when running non fullscreen is a sort of diagonal tearing (a diagonal line diving the screen in half), so I thought somehow there something on the hardware/buffer level that is expecting half the rate to be properly synchronized?

Did someone experience this issue? Is it specific to Sway or other compositors with direct scan-out as well? Any solution?

EDIT: I tried to reproduce the issue on GNOME and KDE and I couldn't, even though on the paper they seem to support direct scan-out for fullscreen applications... so maybe it's Sway after all.

Last edited by michelesr (2021-10-16 11:05:12)

Offline

#2 2021-10-17 00:53:47

gnox
Member
Registered: 2013-05-18
Posts: 70

Re: FPS half the refresh rate with Xwayland offloading (NVIDIA)

What HW do you have? ..

I've got and amdgpu+nvidia laptop and my tests with Prime Offload are a bit different also using sway and kde:

- When I dont load the nvidia_drm only nvidia, nvidia_modeset, nvidia_uvm, the fps are 60-70% of what I expect running on xorg (reverse prime or prime-offload)
- If I load nvidia_drm I've got better fps and sync but  a lot of stutter or small corrupted glitches in the image

I think is not yet fully implemented the prime-offload on xwayland looking at this comments :
- This is not yet merged https://gitlab.freedesktop.org/xorg/xse … quests/766
- https://github.com/NVIDIA/egl-wayland/i … -931575699

Offline

#3 2021-10-25 00:01:00

michelesr
Member
Registered: 2016-02-04
Posts: 55

Re: FPS half the refresh rate with Xwayland offloading (NVIDIA)

gnox wrote:

What HW do you have? ..

Dell XPS 9570, Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz, Intel(R) UHD Graphics 630, NVIDIA GeForce GTX 1050 Ti

Offline

#4 2022-01-12 22:12:53

jotch
Member
Registered: 2022-01-12
Posts: 1

Re: FPS half the refresh rate with Xwayland offloading (NVIDIA)

After asking on the #sway IRC, I found a potential solution (works for me on a Dell XPS 9500, 1650 Ti): `max_render_time`. The man page for `sway-output` says to set it to 1 and increase until things run smoothly (testing via `swaymsg`). For me value of 5 had no dropped frames for windowed/fullscreen.

Offline

#5 2022-01-12 23:19:26

michelesr
Member
Registered: 2016-02-04
Posts: 55

Re: FPS half the refresh rate with Xwayland offloading (NVIDIA)

jotch wrote:

After asking on the #sway IRC, I found a potential solution (works for me on a Dell XPS 9500, 1650 Ti): `max_render_time`. The man page for `sway-output` says to set it to 1 and increase until things run smoothly (testing via `swaymsg`). For me value of 5 had no dropped frames for windowed/fullscreen.

Glad you managed to make it work. I was advised to do the same some time ago in the #sway IRC channel, but it didn't work for me.

I've run `prime-run glxgears` fullscreen and I still get 30 FPS, regardless of the value of `max_render_time` (60 FPS in windowed mode)

Just to double check:

- is sync enabled in your setup? (I think it's the nvidia_drm module providing the PRIME sync functionality, which in turns ensures FPS are in sync with refresh rate) 
- can you give me the exact steps to reproduce the issue and the workaround? (e.g. what you get before, and what you do, and what you get after)

Thanks for your help!

Offline

#6 2022-01-13 00:06:32

gnox
Member
Registered: 2013-05-18
Posts: 70

Re: FPS half the refresh rate with Xwayland offloading (NVIDIA)

its the driver: https://forums.developer.nvidia.com/t/g … /185278/13

Still not fixed with latest  beta driver 510.x ..

Offline

Board footer

Powered by FluxBB