https://bugs.winehq.org/show_bug.cgi?id=56002
Bug ID: 56002 Summary: Adaptive sync results in transient halved refresh rate with winewayland Product: Wine Version: 9.0-rc1 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: shtetldik@gmail.com Distribution: ---
Component: winewayland.drv
When running Cyberpunk 2077 using winewayland (vkd3d-proton/dxvk's dxgi set up in the prefix with Wine 9.0-rc1 + esync), there is a transient issue when monitor's refresh rate drops to half of the game framerate instead of matching it as adaptive sync should do.
DE: KDE Plasma 5.27.9.
I measure game framerate with MangoHud and monitor's refresh rate with on-screen OSD. With winex11 they match, with winewayland they match most of the time, but sometimes refresh rate is halved. So for example the game would have 128 fps and OSD will show 64 Hz.
Since it only happens with winewayland, there must be something specific going on with it.
KWin developers suggested it could have something to do with some additional subsurfaces preventing direct scanout for example.
https://bugs.winehq.org/show_bug.cgi?id=56002
alexandros.frantzis@collabora.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alexandros.frantzis@collabo | |ra.com
--- Comment #1 from alexandros.frantzis@collabora.com --- We are using a subsurface for the Vulkan contents, but since this is fullscreen the compositor should normally be able to scan it out directly. The Mesa Vulkan WSI also handles dmabuf-feedback and should use the best format/modifiers to accommodate scanout, if the compositor provides such information.
The glitch you see could be caused by any component in the path winewayland -> Mesa (Vulkan Wayland WSI) -> Compositor. Have you tried with a different compositor to see if you can reproduce the behavior?
Also, if you can provide one, a log of the problem with "WAYLAND_DEBUG=1 WINEDEBUG=+timestamp,+pid,+tid,+waylanddrv,+vulkan" could perhaps help shed a bit of light.
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #2 from Shmerl shtetldik@gmail.com --- I don't have a set up with other compositor handy to test (I might look into that), but I'll attach the log. The dip in refresh rate happens towards the end.
Test configuration:
KDE/Kwin: 5.27.9 Linux/amdgpu: 6.6.5 Mesa/radv 24.0.0-devel (git-d11c9f9836) vkd3d-proton: master (git-c4e6ec186a) GPU: Sapphire Nitro+ RX 7900 XTX
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #3 from Shmerl shtetldik@gmail.com --- Can't add full log attachment (10 MB size limit). I uploaded it here:
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #4 from Shmerl shtetldik@gmail.com --- Another detail worth mentioning that vkd3d-proton developers pointed out (it's not necessarily the root cause for this):
There is non-optimal fallback path in vkd3d-proton on Wayland currently, because it needs VK_KHR_present_wait to properly implement d3d12 swapchains, and that's only exposed by mesa if the wayland wsi can't be used at all. Unless you force it via driconf, but that only works correctly if the compositor implements the wayland present_time extension, which kwin doesn't:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19279
This can be forced with
vk_khr_present_wait=true
As long as compositor supports it. Kwin will support it in 6.0.
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #5 from Shmerl shtetldik@gmail.com --- Created attachment 75942 --> https://bugs.winehq.org/attachment.cgi?id=75942 Cyberpunk 2077 save file with locationt that triggers the issue
Found a location in Cyberpunk 2077 where this halved refresh rate is very reliably reproducible for me.
https://bugs.winehq.org/show_bug.cgi?id=56002
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |winewayland
https://bugs.winehq.org/show_bug.cgi?id=56002
GrabbenD grabbend@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |grabbend@hotmail.com
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #6 from Shmerl shtetldik@gmail.com --- Looks like now I'm hitting this halved refresh rate even with XWayland Wine. So I wonder if the bug is somewhere else?
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #7 from Shmerl shtetldik@gmail.com --- Vkd3d-proton bug just in case: https://github.com/HansKristian-Work/vkd3d-proton/issues/1926
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #8 from Shmerl shtetldik@gmail.com --- So far the working combination for me was like this (still stuck with Plasma 5 but Plasma 6 is coming to Debian soon so I'll retest):
Run the game in Wine-Wayland mode (no XWayland) Enable in-game vsync setting
With XWayaland it's worse, no matter what setting this bug pops up.
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #9 from Shmerl shtetldik@gmail.com --- I just upgraded to Plasma 6.1.4 and this halved issue isn't happening anymore, though there are other anomalies like refresh rate periodically jumping to max (180 Hz for me) instead of staying variable despite framreate never going that high.
It's probably not an issue with the wayland driver but rather with amdgpu or possibly somewhere in between (like radv or kwin may be?).
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #10 from Shmerl shtetldik@gmail.com --- Actually - correction. I just re-tested it with winex11 (XWayland) path and this is not happening with it!
It's pretty confusing. So not sure what to blame then. May be it is a legit issue with winewayland? Please advise how I can narrow it down or test better.
Can you reproduce such kind of issue on your end?
https://bugs.winehq.org/show_bug.cgi?id=56002
Shmerl shtetldik@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Adaptive sync results in |Adaptive sync / VRR results |transient halved refresh |in mismatch between refresh |rate with winewayland |rate and framerate with | |winewayland
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #11 from Shmerl shtetldik@gmail.com --- This issue is very visible especially in Star Citizen (Vulkan renderer).
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #12 from Shmerl shtetldik@gmail.com --- Created attachment 76953 --> https://bugs.winehq.org/attachment.cgi?id=76953 Flaky adaptive sync / VRR
See attached video snippet that shows monitor's refresh rate jump to max (180 Hz) even though refresh rate never reached that.
https://bugs.winehq.org/show_bug.cgi?id=56002
--- Comment #13 from Shmerl shtetldik@gmail.com --- Opened new radv issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11732
https://bugs.winehq.org/show_bug.cgi?id=56002
Shmerl shtetldik@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WORKSFORME Status|UNCONFIRMED |RESOLVED
--- Comment #14 from Shmerl shtetldik@gmail.com --- I don't have this issue anymore, so it can be closed, but if anyone experiences something similar, feel free to open a new one.
One note:
Some adaptive sync issues similar to this are caused by Firefox opened in the background.
See some details here: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11732#note_2572633
The way to avoid them is to minimize offending Firefox windows.