Bug 449958

Summary: Windowed Vulkan applications are limited to 58 FPS in XWayland
Product: [Plasma] kwin Reporter: oemshani
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: nate, xaver.hugl
Priority: NOR    
Version First Reported In: 5.24.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description oemshani 2022-02-10 17:53:41 UTC
SUMMARY
Windowed Vulkan applications don't go above 58FPS. You can temporarily circumvent this limit by playing around with the display settings while the application is running.


STEPS TO REPRODUCE
1. Login into a Wayland session
2. Start a Vulkan application (eg. vkcube) through XWayland with an FPS counter like MangoHud
3. In Windowed Mode: It only goes max 58FPS, switching to fullscreen the application will render at your monitors refreshrate (eg. 144hz->144fps, 165hz->165fps)

OBSERVED RESULT
Window does not render more than 58fps.

EXPECTED RESULT
Windows should render at about the same framerate as in fullscreen as seen in the X11 Session.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro Linux
(available in About System)
KDE Plasma Version: 5.24.0
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Mesa Version: 21.3.5
Xorg-XWayland Version: 21.1.4

CPU: Intel Core i5-9600k
RAM: 32GB
GPU: AMD Radeon RX 580
Comment 1 Zamundaaa 2022-02-13 22:03:39 UTC
Are native Wayland applications also affected? You could for example test Xonotic with 
$ GALLIUM_HUD=fps SDL_VIDEODRIVER=wayland xonotic-sdl
Comment 2 Zamundaaa 2022-02-13 22:04:15 UTC
Or does it really only affect Vulkan applications?
Comment 3 Zamundaaa 2022-02-13 23:01:00 UTC
Nevermind, I can reproduce. At least sort of - it works correctly on my 60Hz laptop (exactly 60fps) but on my desktop (120Hz display) I also only see 58-59Hz. Making the window fullscreen and back to windowed makes it work correctly as well though. When I resize the vkcube window it's random whether or not the refresh rate fits or not.

This 17ms constant is where the 58-59fps comes from: https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/hw/xwayland/xwayland-present.c#L47

So either Xwayland gets no frame callbacks or it ignores them. As glxgears is not affected (at least for me), I think it's safe to assume that the bug is in Xwayland. I opened https://gitlab.freedesktop.org/xorg/xserver/-/issues/1309, you can add your information there if you want