ValveSoftware / Source-1-Games

Source 1 based games such as TF2 and Counter-Strike: Source
642 stars 74 forks source link

[TF2] [Linux] - Weird Dropping and Stuttering of Frames In OpenGL and DXVK #5630

Closed HurricanePootis closed 6 months ago

HurricanePootis commented 6 months ago

System Information

Arch Linux Radeon RX 6800 AMD Ryzen 5 5600X mesa 24.0.5 144hz Monitor with FreeSync KDE 6.0.4 Wayland Latest Steam Runtime Running game with: ~/.local/share/Steam/ubuntu12_32/steam-runtime/run.sh /run/media/hurricane/superssd/SteamLibrary/steamapps/common/SteamLinuxRuntime_sniper/run -- ./tf.sh -game tf

Problem

Whenever I first launched the game without mangohud attached to it, I could immediately tell that there was something wrong with the game. The smoothness was gone, and it was as if I was "dropping" frames, or experiencing micro stutters. I recorded videos at 144hz, sent to the my friends, and they see the issue too. This happens both on the OpenGL and DXVK renderers.

vulkan2.webm

vulkan.webm

opengl.webm

DonKatsu commented 6 months ago

This looks like what I'm experiencing as well. With TF2 set to fullscreen, I get that stutter with mangohud's reported FPS rapidly switching between 0 and the set FPS limit. My monitor OSD shows the refresh rate rapidly switching between 72Hz and 144Hz when Adaptive sync is enabled. Setting Adaptive sync to Never doesn't help. The first time I launched after the update had a hard freeze while on a map after about 30 seconds. Nothing about it in the journal. With TF2 set to windowed, it runs without issue. But this is not ideal as the -noborder launch option ignores Plasma's panel causing the window to be offset. And Adaptive sync has to be set to Always to work.

CachyOS Radeon RX 6700 XT AMD Ryzen 9 5900X Mesa 24.0.5 144Hz Monitor with FreeSync KDE 6.0.4 Wayland Steam Beta (Runtime) 1713317598 Launch options: mangohud %command% -novid

EDIT: When I posted this, it was after I had updated my packages and I hadn't played anything else. I went to play a different game, and experienced the same problems as with TF2 in fullscreen. I looked at what had updated and on a hunch downgraded kwin from 6.0.4 back to 6.0.3.1. Now everything works properly in fullscreen. Can't see anything relevant yet at a glance on the KDE bugtracker but saw this on the Arch tracker for kwin.

polluxau commented 6 months ago

this seems to be a xwayland problem with the game, i switched to x11 and there are no fps stutters, buttery smooth, also my mangohud didnt work properly under the game on wayland, but on x11 it works properly

rlly annoying as the majority of the linux desktop users are trying to move to wayland but we have these types of issues that appear

hopefully this gets fixed.

also running arch, plasma 6.0.4, mesa 23.0.5, kernel 6.8.7

polluxau commented 6 months ago

seems to be fixed with latest update, no weird fps problems on kde wayland

HurricanePootis commented 6 months ago

seems to be fixed with latest update, no weird fps problems on kde wayland

I am still experiencing issues on KDE Wayland. I am about to test it on Xorg with both the modesetting driver and the xf86-video-amdgpu driver.

I have attached a new video with the DXVK_HUD=full envar set; this was taken within the hour of the time of this post. In this video, it seems like there is something causing for the frametime to spike up.

vulkan4_2fort.webm

HurricanePootis commented 6 months ago

I just tested TF2 on X11 with the modesetting driver, and the stuttering was gone. This is either an Xwayland issue or a KDE issue. I have attached a video of me on X11 below.

vulkan5_2fort_x11.webm

polluxau commented 6 months ago

interesting, i dont get these little frame spikes under kde wayland, im not using that env tho, only mangohud %command%

DonKatsu commented 6 months ago

@HurricanePootis Did you try downgrading kwin to 6.0.3.1? I tried kwin 6.0.4 again (arch extra and cachyos-v3 to rule out the latter for me) and it's still stuttering, but 6.0.3.1 is fine.

HurricanePootis commented 6 months ago

@HurricanePootis Did you try downgrading kwin to 6.0.3.1? I tried kwin 6.0.4 again (arch extra and cachyos-v3 to rule out the latter for me) and it's still stuttering, but 6.0.3.1 is fine.

Yes, I just tested it with kwin 6.0.3.1 on Arch, and the stuttering did go away with on wayland. I am going to see if I can somehow bisect which commit caused this between kwin 6.0.3.1 and kwin 6.0.4 and to see if the KDE people are aware of this issue. If not, I'll open a bug thing on whatever system KDE uses as well.

Edit: Here's a list of commits to the kwin repo between v6.0.3.1 and v6.0.4 for anyone interested

fe5089925a698230d8ea41303879c5605b7de9a9 (tag: v6.0.4) Remove superfluous wake in dpmsinputeventfilter destruction
fc3a2d0d5d39c3003c2909580bf2c38a1dc6ba1f scripting/windowmodel: match screen closest to center for filter
f76b1947b1d74f2fc68198da37bca11724c0eb5f wayland: Send data offer source actions only for dnd
68532f178d7ba7ebc1eca51754176b3124fbece9 screenedge: reset timer when pointer leaves edge
a516e9e6cdefd2057441d969dcfb5480c295111b Mark windows for offsceen rendering in WindowThumbnailSource
61217e1c8f978509e7188c157aa44e98f0d514b2 GIT_SILENT Sync po/docbooks with svn
2d68d150ddc1736e4ee26af7410adac1da204d66 plugins/screencast: Remove irrelevant code
979c04335da7655558e07991fd8015ccf7c6d417 GIT_SILENT Sync po/docbooks with svn
a69fb4b958deda1d55c2003b17bffd2638574468 plugins/screencast: Fix sizeof() of SPA_META_Header
16bac3dbe5262e316f37e513a24bb358a1326210 backends/drm: Force software cursor on vmwgfx
4bf2a5dd86544dec87eff134b5febba4c2795312 backends/drm: Fix redraw issues on vmwgfx
a941323e2508f30b0452398aa6962b4f6e8afb76 backends/drm: Fix the closefb ioctl
6e4fae02c3d066311ccecfb74d3f2da52d019c86 backend/drm: fix cursor hotspot enablement for virtualized drivers
81ef5d3500f14c2eb1d39973f0a59bf8da3dd7dc plugins/screencast: Add a n_datas guard
4bcf3d6ad538829ec580e12538fc65f81b8e13bc GIT_SILENT Sync po/docbooks with svn
b8c7f8d339134a2e7f2a328dfca0685c6c667949 GIT_SILENT Sync po/docbooks with svn
615177749e6ca19cd1e786f826dbb0a428a8eb62 plugins/colorpicker: fix interaction with SDR brightness
9720ef2e23cf9e2747d493185163f0dfeb36de3e backends/drm: signal dmabuf feedback if an unsupported modifier is used
19ffe2ac411b866cd646942d4e3cfb41d8ca89a1 scene/workspacescene: fix direct scanout checks with subsurfaces
4919a8f0072a2228000d0e330801f175fb7eb4e3 backends/drm: actually prefer alpha formats again
8b2ddc447e34295fc569897270617a48f979e210 Fix inconsistent default keyboard delay value used in kwin.
135a9355ce20ee43433d4982677c8fb26207ce03 Guard against negative screen indices in Workspace::xineramaIndexToOutput()
24e4a9063705d9247967770168a759cdbd304303 backends/drm: don't do direct scanout with buffers that need cropping
fc659638f6242c9788b732c1cb4f77b497526857 Disable freebsd ci
93a168df940806d962bbd9d09119dceb0342233e GIT_SILENT Sync po/docbooks with svn
9e89fe7e1326daa042e6e22b7473e74d620726d0 (origin/work/zzag/backport-tiling-fixes) wayland: Emit closed signal immediately after marking the window as closed
fcbeeb0581a0be10f1dbe9b9c6ce3d444f9b4dc4 Unset Window::tile() when the window is closed
f53c62494aa132c68a7ebd534a14a05fb44e8524 plugins/mousemark: clear drawing when no modifiers are pressed
bb4262a621ba8fe665d32ef9e035547f1c852c65 plugins/mousemark: correct reserve size.
238dec820fb91ff6ef6fd3307664ec9e594d23e3 plugins/screencast: Destroy renegotiate event
8706a9356d38975ca9d7031d965c395fd4638e8b plugins/screencast: Corrupt header to indicate that buffer has no data
8597caf132ba9dc5583e97cc04838f824de89792 GIT_SILENT Sync po/docbooks with svn
4e33f715d3e33d19092ca394a6753ffd1f0d25f9 GIT_SILENT Sync po/docbooks with svn
f4289cd853c9efa45baf67b82c1a48a15e45d1eb update version for new release
fbb1705649c988f67b49b8b28f2adf4d15770902 GIT_SILENT Sync po/docbooks with svn
awillinger commented 6 months ago

Can confirm adding -windowed -noborder to the launch option both fixes the game not starting and the stutter issues.

Running with Vulkan on Manjaro.

HurricanePootis commented 6 months ago

I have narrowed it down to commit 9720ef2e23cf9e2747d493185163f0dfeb36de3e backends/drm: signal dmabuf feedback if an unsupported modifier is used, I will go build kwin from HEAD and see if it is still broken. If it is, I will open up a issue on their gitlab for kwin.

HurricanePootis commented 6 months ago

Actually, I just thought of something. Did something TF2 change cause this problem? Or, did something kwin changed that caused this problem. I haven't played tf2 recently, so I never ran the old game on kde 6.0.4

DonKatsu commented 6 months ago

I think it's just bad timing on kwin 6.0.4 releasing around the same time as the TF2 update. As I get the same issues outside of TF2 with kwin 6.0.4. Looks like it's already getting addressed?

Soup-64 commented 6 months ago

I think it's just bad timing on kwin 6.0.4 releasing around the same time as the TF2 update. As I get the same issues outside of TF2 with kwin 6.0.4. Looks like it's already getting addressed?

for arch users at least the fix mentioned here has been cherrypicked and the kwin package has been rebuilt (see here)!

HurricanePootis commented 6 months ago

On ArchLinux, the following patch has been added to its version of kwin, and it has solve my issue. Therefore, I am closing this issue.

However, if anyone here is on a distro that isn't shipping the patch now, as kde 6.0.5 is a few weeks away (to my understanding), downgrade to kde 6.0.3.1 in the meantime.

Zamundaaa commented 5 months ago

However, if anyone here is on a distro that isn't shipping the patch now, as kde 6.0.5 is a few weeks away (to my understanding), downgrade to kde 6.0.3.1 in the meantime.

FTR we've released KWin 6.0.4.1 to fix this, distros should update to it soon enough