Glitches with nvidia driver 470 (optimus render offload) on xwayland with vulkan games

There is a problem while playing VULKAN (or dxvk) games with nvidia optimus render offload on xwayland.
When playing a game, if framerate does not keep up with vsync rate (60fps in my case), screen starts glitching by momentarily showing some frames that were rendered a little earlier.

Driver: 470.57.02
OS: Manjaro [testing branch]
Kernel: Linux 5.10.54-xanmod1-1-lts
Hardware: HP dc0019ur (Omen 15) Laptop with Intel UHD630 + Nvidia GTX1050 2GB
Relevant bleeding-edge packages installed (from AUR): xorg-xwayland-git, libdrm-git lib32-libdrm-git, xf86-video-intel-git. Installed these thinking it may resolve the issue. but it didn’t.

2 Likes

I can confirm this bug too.

2 Likes

in sway, change workspace(maybe also changed focus?), fix tear for me.
but need more test, to watch what happend

Cross-DE (and OS?) issue then. I use KDE Plasma 5.22.4, with vanilla KWin, not KwinFT (which is sway-based). Happy and sad at the same time that you confirmed the issue. What’s your OS, kernel and hardware?

The fix was temporary and the game started tearing again.
I think this is a bug in Xwayland or nvidia-driver.

I use Xwayland from xorg-master-branch (d83c84bd9dc7fbd3588ce70b0c8bf0f63ed29ff3).
and load nvidia module by:

    sudo modprobe nvidia
    sudo modprobe nvidia_drm modeset=1
    sudo modprobe nvidia_modeset
    sudo modprobe nvidia_uvm

Currently on driver version 470.63.01, issue still persists.

I can confirm this bug on ubuntu, pop os, manjaro, arch (basically every distro I have tested). The games work fine when launched in xorg.

Driver: 470.57 - 470.63
Hardware: Intel 1065G7 + Nvidia MX330

Nvidia driver 470.74, issue still persists.

Hey Guys, unfortunately it would seem that this still reproduces with the latest 495 beta driver. It’s not specific to Vulkan, OpenGL is affected too. I’ve started looking into it. Interestingly, as far as I can tell it doesn’t reproduce with full-screen applications with compositors that support direct scan-out (such as Weston or GNOME).

I checked with 495.29.05 and xserver:master(f37d11cd96ba15b40a497d4d7bdd14a77ea9b476).
sway(wlroots) still apears tearing.
weston is less but sometimes happes same glitch like tear.

for reference:
wlroots seems supports direct scan-out only on linux-dmabuf interface. (I’m not reading code but.)
[Support direct scanout for wl_drm · Issue #1836 · swaywm/wlroots · GitHub]

This is a driver bug. We weren’t synchronizing frame presentation with Xwayland correctly which could cause the visual artifacts you’ve been observing. I believe the direct scan-out thing mentioned above was just a coincidence in that it changes the timing of things which could mask the issue. I’ve got a candidate fix which I’m just finishing up testing, I’ll try to get it out as soon as possible. Thanks everyone who provided their data-points here.

3 Likes

Using nvidia 495.46-5, still not fixed.

1 Like

still not fixed at 510.39.01

1 Like

Eh. It’s been quite a while since we heard from the developer (and he/she seemed to be finishing up a fix). I can just hope that the fix lands soon and isn’t forgotten.
Can a developer confirm this is being worked on?