Wayland: massive flickering on xwayland / Java

Hello,
I’m experiencing massive flickering on xwayland while running Java applications, like Mediathekview or Hibiscus (I don’t use other java programs). There isn’t any problem running those programs natively in pure Xorg without any wayland involved.

Kernel: .5.15.32
nvidia: nvidiaG06-515.43.04
KDE: Plasma 5.24.5 / kwin5-5.24.5
Java: different versions, like Java 17 or 1.8 (both openjdk).
Xwayland: 22.1.1

0a:00.0 VGA compatible controller: NVIDIA Corporation GP108 [GeForce GT 1030] (rev a1) (prog-if 00 [VGA controller])

0a:00.0 0300: 10de:1d01 (rev a1) (prog-if 00 [VGA controller])
        Subsystem: 1043:85f4
        Flags: bus master, fast devsel, latency 0, IRQ 69
        Memory at f6000000 (32-bit, non-prefetchable) [size=16M]
        Memory at e0000000 (64-bit, prefetchable) [size=256M]
        Memory at f0000000 (64-bit, prefetchable) [size=32M]
        I/O ports at d000 [size=128]
        [virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
        Capabilities: [60] Power Management version 3
        Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [78] Express Legacy Endpoint, MSI 00
        Capabilities: [100] Virtual Channel
        Capabilities: [128] Power Budgeting <?>
        Capabilities: [420] Advanced Error Reporting
        Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
        Capabilities: [900] #19
        Kernel driver in use: nvidia
        Kernel modules: nvidia_drm, nvidia

nvidia-drm.modeset=1 is set.

This problem can be seen with previous versions, too. I’ve never seen it without massive flickering.

Is this a known problem? How can it be solved? Do you need any more information? Please feel free to ask!

Thanks!

Is this issue exclusive to Java + xwayland for you or does it also happen with other non-Java applications running through xwayland? I’ve seen “juddering” in Discord running through xwayland as if the frames are being displayed out of order, and this issue is most likely the culprit.

NVIDIA says “Xwayland does not provide a suitable mechanism for our driver to synchronize application rendering with presentation, which can cause visual corruption in some circumstances” on this topic they posted about NVIDIA + Wayland.

No, until now, I couldn’t see this massive flickering (it’s like a very fast blinking of parts of the (or even complete) window of the app) with other X-programs through Xwayland.

The only not Java X-program I used with Xwayland so far was smplayer / mpv. I could see effects there and I think those could be the effects you described above.

But those two effects I’m seeing here seem to be completely different to me.

Here you can see an example of the flickering in Java apps (please play it until end because there are different errors). You have to download it (“Herunterladen”) to play it!
At t this example, it looks like the problem seems to happen only if there are mouse movements - but that’s not true - the flickering may bee seen even without mouse movements - but that’s relatively seldom.