protonscr

Halved refresh rate in some situations in Cyberpunk 2077

vkd3dclosed
HansKristian-Work/vkd3d-proton#1926 · opened 2024-03-04 by shmerl · updated 2024-08-18 · 16 comments · github
Sshmerl 2024-03-04 github

When running Cyberpunk 2077, 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.

  • GPU: AMD RX 7900 XTX
  • Display: LG Ultragear 27GP850-B (2560x1440 / 180 Hz adaptive sync) connected with DisplayPort.
  • DE: KDE Plasma 5.27.10 (Wayland session)
  • Wine: 9.3 + esync
  • vkd3d-proton: git-3d6aef38c6
  • Mesa / radv: git-7ba43413b9
  • Kernel / amdgpu: 6.7.8

I measure game framerate with MangoHud and monitor's refresh rate with on-screen OSD. They match most of the time, but sometimes refresh rate is halved. So for example the game would have 176 fps and OSD will show 88 Hz and so on. This happens with Wine XWayland and Wine Wayland both, but somehow more often with the latter.

Not sure if the issue is with Kwin, vkd3d-proton or radv. Could be on any level so I'm opening a bug here just in case.

I opened Wine bug first (https://bugs.winehq.org/show_bug.cgi?id=56002) thinking it's Wine-Wayland issue, but now I see it's not really limited to it so opening lower level bugs. I can open a radv or amdgpu bug as well if you recommend it.

And just to exclude this detail - it happens without mangohud too, so it's not the HUD interference if anything.

See attached video for the example of this

halved_refresh_rate.webm

GGrabbenD 2024-03-04 github

Same issue can be observed in Dead Island 2 (with Sway 1.9 meaning it's not specific to WM/DE)

For reference: drm/amd/-/issues/3166

Sshmerl 2024-03-04 github

Well, in my case I don't get flicker. In fact, refresh rate is exactly half of game's framerate when it dips, so I guess it's still aligned somewhat. But still it's an incorrect behavior.

Mmbriar 2024-03-04 github

Was reported before, apparently using vsync/fifo fixes it: https://github.com/HansKristian-Work/vkd3d-proton/issues/1911
More likely something going wrong in kwin or the mesa wsi than vkd3d-proton.

GGrabbenD 2024-03-04 github

VSYNC (FIFO_KHR) is the only working sync method on my end, otherwise refresh rate is exactly half of game's framerate like @shmerl said

Sshmerl 2024-03-04 github

Hm, yes, I can confirm that setting vsync in the game (to 180 for me) this problem goes away. But I assumed fifo in general is not optimal and mailbox is as a more advanced option. It's still weird that when vsync option in the game is not enabled it behaves incorrectly. Is it a bug with the game itself or with Kwin or Mesa? Kwin developers didn't think it's a Kwin issue btw.

GGrabbenD 2024-03-04 github

@shmerl It can't be KWIN issue since Wlroots (Sway) has the exact same issue

Sshmerl 2024-03-04 github

Should I open a radv bug?

GGrabbenD 2024-03-04 github

Kwin developers didn't think it's a Kwin issue btw.

By the way, can you drop a link to the KWIN issue report here? I'm trying to keep track of similar issues drm/amd/-/issues/3166#note_2277191

Should I open a radv bug?

Sounds like a good idea!

Sshmerl 2024-03-04 github

It wasn't reported, just a comment from one of the kwin developers. So I haven't opened the issue.

Mmbriar 2024-03-04 github

fifo in general is not optimal and mailbox is as a more advanced option.

If you don't want framerates much higher than the monitor's refresh rate there is not much reason to use mailbox with vrr. Mailbox is probably rather less optimal because it requires a huge amount of swapchain images which require more memory and can maybe even increase latency.

HHansKristian-Work maintainer 2024-03-05 github

This cannot be a vkd3d-proton bug. Looks more like a DE bug. Closing unless there is actual proof this is vkd3d-proton's issue.

Sshmerl 2024-07-04 github

FYI, now it got bad even with fifo. Still waiting for Plasma 6 to be packaged for Debian to confirm it works better with it.

Sshmerl 2024-07-07 github

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.

Sshmerl 2024-08-13 github

Just switched to plasma 6.1.3. This halving issue seems to be gone, but now there is another adaptive sync problem - sometimes refresh rate just goes to max (180 Hz for me) and sticks there for a while, despite framerate being lower and variable. This is probably and amdgpu bug, so I'll open a new one there.

Sshmerl 2024-08-18 github