Bug 483411 - KWin Wayland with Nvidia leads to weird shuttering for certain proton game (逆転裁判456 or Apollo Justice: Ace Attorney Trilogy)
Summary: KWin Wayland with Nvidia leads to weird shuttering for certain proton game (逆...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 6.0.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-03-13 08:21 UTC by Qu Wenruo
Modified: 2024-03-16 05:39 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Qu Wenruo 2024-03-13 08:21:57 UTC
SUMMARY
When using Kwin from 6.0.1, Wayland session, with Nvidia closed-source driver (tried both nvidia-open and nvidia) and high refresh rate monitors (no VRR, tried both 120hz and 165hz), the game 逆転裁判456 (Apollo Justice: Ace Attorney Trilogy) would shutter heavily.

On the other hand, if switching back to X11 session, the problem is just gone without any other setting change.


STEPS TO REPRODUCE
1. Install KDE 6.0.1
2. Use steam to lauch Apollo Justice: Ace Attorney Trilogy

OBSERVED RESULT
The game shutters heavily (looks like bad vsync, older frames can sometime show up) in Wayland session

EXPECTED RESULT
The game doesn't shutter at all in both Wayland and X11 sessions.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux KDE 6
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
It looks like using gamescope can solve the shuttering, but gamescope has its own bugs.

It looks like monitor refresh rate is not involved, 60Hz can still reproduce the bug.
Comment 1 Qu Wenruo 2024-03-13 08:31:36 UTC
Just to be extra safe, the game only supports borderless and windowed mode.
It should be unrelated to the Vsync change for full screen game.

Furthermore it should be a KWin wayland compositing Vsync bug, as nested gamescope compositor solves the shuttering completely in Wayland mode.
Comment 2 Qu Wenruo 2024-03-13 22:34:42 UTC
Retried on kwin 6.0.2, still the same result.
On X11 everything is fine, On Wayland the game shutters heavily.

So rollback to X11.

Just to mention, my memory may not be that accurate, but in Kwin 5.x wayland, it also seems to have some shuttering, but not as series.
Do no have the KDE 5 environment to retry X11/Wayland comparison though.

If there is certain graphic workload to reproduce, I'm pretty happy to try.
Comment 3 Zamundaaa 2024-03-13 23:37:02 UTC
This is https://gitlab.freedesktop.org/xorg/xserver/-/issues/1317
Comment 4 Qu Wenruo 2024-03-14 01:59:50 UTC
I'm not sure if it's the same bug of Xwayland.

As if I go with gamescope for the game, the shuttering is just gone.
Comment 5 Zamundaaa 2024-03-14 22:49:09 UTC
The issue is a race condition, it can be triggered or "fixed" by lots of factors, including using a different or nested compositor. Until it's fixed, all glitches with the proprietary NVidia driver can be assumed to be that problem
Comment 6 Qu Wenruo 2024-03-14 23:00:34 UTC
OK, that sounds reasonable.

I guess the best way I can go is never buy any laptops with NVidia dGPU any more.

Just curious, would going NVK be a way to solve it?
Comment 7 Zamundaaa 2024-03-15 00:36:39 UTC
Yes, Nouveau (and the new replacement for it) doesn't have this problem. It'll soon be fixed in the proprietary driver as well.
Comment 8 Qu Wenruo 2024-03-16 05:39:11 UTC
Just a final question.

My laptop has two USB-C with DisplayPort alt mode, one is wired to AMD iGPU, the other wired to Nvidia dGPU.
And all my previous report is using that Nvidia dGPU to render and output everything.

However today I switched to go back using that USB-C port wired to AMD iGPU, and the output and KWin are all handled by AMD iGPU
(nvidia-smi shows nothing when idle at desktop).

Then if I run the game again, the game shows up in nvidia-smi, so I believe it's rendered by NVidia dGPU but output still handled by iGPU (hybrid).
In that case I also see no shuttering at all.

Does the regressed NVidia closed-source bug can also explain this observation?