ValveSoftware / csgo-osx-linux

Counter-Strike: Global Offensive
http://counter-strike.net
774 stars 69 forks source link

Counter Strike 2 - Huge performance loss compared to Windows client #3325

Open MacTavishAO opened 11 months ago

MacTavishAO commented 11 months ago

Your system information

Please describe your issue in as much detail as possible:

Below are the screenshots from native linux client with vulkan and CS2 running through Wine + DXVK, respectively. 20230929034453_1 20230929040743_1

I've played the Limited Test on Windows and there seems to be performance loss of anywhere between 40 to 60% compared to Windows client.

Steps for reproducing this issue:

  1. Run the game on the same hardware with both Operating Systems.
  2. Compare how they perform.
emko commented 9 months ago

not sure what has changed but the game is unplayable now... frame pacing is above 30ms constantly so the game is a stutter fest, i am still on fedora 39, nvidia rtx 3080 and a intel i9 13900k

KeironO commented 8 months ago

After a couple thousand hours, I've stopped playing CS completely. Number of reasons, but the main reason being that the game runs like absolute trash on a good system and has done since release.

It's a shame, but it is what it is.

MacTavishAO commented 8 months ago

After a couple thousand hours, I've stopped playing CS completely. Number of reasons, but the main reason being that the game runs like absolute trash on a good system and has done since release.

It's a shame, but it is what it is.

It's been a month since last time I played the game. I got too tired booting Windows just to play this game. I ran the game using Proton 10 minutes ago just to see how it runs, and I have to say frametimings on DXVK (and I'm not mentioning FPS, it's already high as expected) is so stable that it's almost poetic. What a wasted potential aside from all the other issues plaguing linux port (audio, wayland, mouse input etc.). Thousands of hours of play time amassed by not just me but all linux players is down on the drain. Just like that.

dataprolet commented 8 months ago

I don't know, but for me the game is running completely fine after switching back and forth between fullscreen and windowed after every start (see https://github.com/ValveSoftware/csgo-osx-linux/issues/3566#issuecomment-1865137459). I'm getting above 100 FPS on an Ryzen 6 3600 + RX 5700 on Arch Linux.

nJ3ahxac commented 8 months ago

Recently there was an update to AMDVLK which claimed to optimize for CS2. I found better performance when using this over mesa RADV, in some areas it was slight but in others up to 20% (sorry I don't have graphs). Generally I also saw less gpu utilization at the same time, can't say if this is strictly a good thing though. 5600x + 6600 btw, obviously this will only affect those with AMD cards.

I suggest people here give it a try, although it's not going to magically fix the awful smoke fps drops. Don't remove the RADV libraries, just install it alongside them. Because I installed it alongside RADV, I had to tell vulkan to use the new drivers and you can do that with an environment variable. Set custom launch options to include the following var:

VK_ICD_FILENAMES=/etc/vulkan/icd.d/amd_icd64.json

Make sure the 'amd_icd64.json' file exists. It's possible that this isn't the location for some distros, so make sure this directory is correct. Just to be explicit, my launch options now look like this:

VK_ICD_FILENAMES=/etc/vulkan/icd.d/amd_icd64.json gamemoderun mangohud %command% -nojoy

Launch the game and compare FPS. Expect big stutters at first as you will have to recompile shaders, but once you do it should be smooth like RADV. Let me know if this helps.

nJ3ahxac commented 8 months ago

Tiny AMDVLK vs mesa benchmark - note performance regression in later mesa versions and greater performance in AMDVLK. I went to that spot on Ancient and used 'setang 0 270 0' to position my crosshair. Will add windows FPS later after I can be bothered to install windows again on another drive. 1920*1080 native lowest settings 5600x + 6600.

framerates_debian

x0r13 commented 8 months ago

Tested amdvlk on nuke, but performance was much worse. Using Ryzen 5600 + RX6800 I have ~240fps with lows of 150fps using Mesa 23.3.2 - kisak-mesa PPA and ~110fps with 90fps lows using amdvlk. GPU load is 99% using mesa, and 75-80% using amdvlk. Don't really know why the performance is so bad for me.

Under windows (other ssd) I get ~380fps.

flaphoschi commented 8 months ago

I’ve tested amdvlk with a RDNA2 (Ryzen 6850U, Radeon 680M) with 2560x1600. The performance was similar to radv. To be on the safe side I disabled and enabled pre-cached shaders in Steam (Downloads) settings. If you use pre-cached shaders (default on) you need download approximately 1.6 GB of data and the connection seems slow (in Central Europe).

I switched back to radv because its architecture should fit cleanly within the software stack and provide better compatibility.

Please note. It is possible the results vary depending on specific hardware models and display resolution.

tahuffman1s commented 7 months ago

This issue has been open since last September. This is very disheartening, my friend recently switched to linux and CS2 is the worst performing game in his library, and it's a native port.

I don't understand why they don't just compile against DXVK and use the flag like MacTavishAO mentioned all the way back in September.

If Valve is going to get rid of the ability to play CS:GO then they should at least make CS2 a performant game on all platforms.

MacTavishAO commented 7 months ago

This issue has been open since last September. This is very disheartening, my friend recently switched to linux and CS2 is the worst performing game in his library, and it's a native port.

I don't understand why they don't just compile against DXVK and use the flag like MacTavishAO mentioned all the way back in September.

If Valve is going to get rid of the ability to play CS:GO then they should at least make CS2 a performant game on all platforms.

Subpar implementation of Vulkan in Source 2 plagues both DOTA and CS2 to this day. Since League of Legends switched to Vanguard many more players are going to seek refuge in DOTA. This issue is only going to get annoying for more people. I hate to distrub you by tagging @kisak-valve, but can we please at least have an answer as to why DXVK isn't feasible here? Please stop ignoring us. Working on a solution would save both CS2 and DOTA players from performance issues prevalent on Linux clients.

MacTavishAO commented 7 months ago

I've tested the new update. AMDVLK no longer beats mesa in terms of FPS. They're within margin of error to each other. DXVK is 5-10% slower than Linux client with Mesa.

EysseW commented 7 months ago

In a positive way or a negative way?

rariema commented 7 months ago

positive way - did not test AMDVLK, only Mesa

mesa 24.0, rx6600, 5600g ~10% avg. gain

My "Bench": T side Mirage, unlimited ammo, smoke, frag grenade and ak. Hit record and then I try to throw smokes and he grenades at the same spots and do some spraying, look at the smokes, and go on. Back at the start i stop the benchmark. Take the numbers with a grain of salt, cause of the method and i changed some gpu and cpu settings since then.

cs2_mesa24

Screenshot_20240207_115948

https://flightlessmango.com/games/26503/logs/4877

flaphoschi commented 7 months ago

I will try to check that. An improvement of 10% through Mesa 24 would be awesome.

MacTavishAO commented 7 months ago

In a positive way or a negative way?

In a positive way. Took a quick glance and below were my FPS more or less on 5700X, RX6800 system running Plasma 6 RC2. Vulkan renderer still needs more work but it's better than it was before I'd say.

Inferno Mid;

Windows DX11: 450~ Mesa-git 24.1 w/ SDL_VIDEO_DRIVER=x11: 400~ Mesa-git 24.1 w/ SDL_VIDEO_DRIVER=wayland: 410~

Nuke T Base;

Windows DX11: 640~ Mesa-git 24.1 w/ SDL_VIDEO_DRIVER=x11: 530~ Mesa-git 24.1 w/ SDL_VIDEO_DRIVER=wayland: 540~

I changed back and forth between x11 and wayland SDL_VIDEO_DRIVER by editing cs2.sh. Default is x11.

oyvindln commented 7 months ago

It seems to perform better at the start of a match but at least in my case (RX 6600, R5600X, Mesa 24.00, plasma 5.27 on ubuntu 23.10, steam installed via official .deb ) the gpu utilization starts fluctuation more and more the longer the game has been running and the framerate seems to worsen as well (and my GPU is nowhere close to temperature throttling and works fine under full load for other apps so it's not that). Seems I'm not the only person noticing some issues with gpu utilization: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10443

No idea if this is a driver problem or a game issue.

Tested with wayland sdl driver but that seemed to screw up the colors so not sure it's properly functional yet.

GenocideStomper commented 7 months ago

Replying to https://github.com/ValveSoftware/csgo-osx-linux/issues/3325#issuecomment-1933253375

I have a similar issue, and I'm running Nvidia on X11. So I think it's more likely a game issue, or the game's implementation of vulkan.

x0r13 commented 6 months ago

R5 5600 + RX6800

After todays patch, I wanted to try if I can see any performance improvement. I deleted my shader cache and started the game, went to de_ancient and to my surprise, MangoHUD reported over 400fps with peaks into ~460fps. GPU was working overtime, and I was even able to hear slight coil whine for the first time with this card in CS2.

When running though water, fps only dropped to about ~360fps. Previously I had about 200-220fps with drops to 140fps in the water.

When going into another map (de_nuke) fps were all of a sudden the same as before (200-250fps). GPU not stressed anymore, and no more coil whine. So I loaded a 3rd map (de_inferno) and also, everything was as bad a ever.

I have no idea why fps were so good when loading the first map. I had absolutely no shader generation stutters, everything was buttery smooth.

Will try again later if it was because of deleted shaders.

oyvindln commented 6 months ago

Just from some quick testing it seems that there being other players on the map is having a drastic effect performance in some way (seemingly causing a bottleneck somewhere that's at least not showing up as either gpu utilization or close to maxed out cpu cores) even if they are not visible and maybe even if they're dead? Loading into an empty dust2 map with no other players using the console and kicking the auto-added bots I get GPU limited with my RX 6600 and R5 5600X as expected and the performance is in the 400s fps range. Bot match with 10 people in it drops me closer to 300-350, joininga deachmatch on the same match puts me closer to 200 on average though it varies a lot. The fps and gpu util also drastically goes up at the match end screen.

FPS on Default DX11 renderer on windows is actually a bit lower than on linux when running around dust2 with no other players but doesn't suffer nearly the same hit and bottlenecking when joining a server with other players on it or adding bots.

Vulkan renderer on windows seems to have similar behaviour as on linux, with high fps and the gpu being utilized if you load a map on your own (fps was about the same as with dx11 on empty dust2) but gpu utilization is nowhere near full and fps a fair bit worse than dx11 mode if joining a deathmatch and may or may not get lower over time.

MacTavishAO commented 6 months ago

Finally got around to testing it on an arms race game. Game drops to 90~ and stays there. No matter what you think, 5700X paired with RX6800 shouldn't drop to 90s. Weak APUs on Windows manage to hold higher FPS. Unacceptable.

rariema commented 6 months ago

do you still have this with the

Fixed a threading bug that could lead to a frame rate hitch, especially if all CPUs were busy.

update?

nipnipj commented 5 months ago

Low performance. I had this kind of issue with games that are Playstation ports.

EysseW commented 5 months ago

To be honest, I think many of us are mainly unhappy with how movements feels way less smooth in cs2 compared to cs:go. I installed cs2 on my windows install, hoping to be able to play again, but was disappointed to find it still feels like I have 40 fps the entire time, despite my frame rate being perfectly fine.

Jonas-Sander commented 5 months ago

To be honest, I think many of us are mainly unhappy with how movements feels way less smooth in cs2 compared to cs:go.

No, not me. Please don't include me in your statement if it's just your personal opinion.

EysseW commented 5 months ago

"I think" and "most of us" should indicate I didn't state you were.

upbox-org commented 5 months ago

To be honest, I think many of us are mainly unhappy with how movements feels way less smooth in cs2 compared to cs:go. I installed cs2 on my windows install, hoping to be able to play again, but was disappointed to find it still feels like I have 40 fps the entire time, despite my frame rate being perfectly fine.

No, you are wrong, at least in my case and I think in many others too. The frame rate is unfortunately not perfectly fine.

EysseW commented 5 months ago

Y'all can't read. I said the frame rate was fine on my windows setup. Linux does have lower frame rates indeed, and the issue is real, but part of it also comes from the less smooth movement of cs2. That's all.

emko commented 5 months ago

Y'all can't read. I said the frame rate was fine on my windows setup. Linux does have lower frame rates indeed, and the issue is real, but part of it also comes from the less smooth movement of cs2. That's all.

objectively wrong, just check the frame pacing on linux vs windows, people have posted graphs..... on windows its way way more stable and smooth on linux it spikes to 80ms+ constantly and its all over the place, on windows it does not do this and is perfectly smooth not going from 300+fps to sub 10fps random stutters that happen all the time

EysseW commented 5 months ago

That complies to what I said?

MacTavishAO commented 4 months ago

No improvements with the latest update.

EXtremeExploit commented 4 months ago

On the latest update: https://steamcommunity.com/games/CSGO/announcements/detail/4199120329626448731

Added console output that may be helpful for advanced users to diagnose performance problems. When a very long frame occurs, a brief profile of the frame is printed. At the end of a match, a summary is printed.

This could be useful for cs devs to know the cause of the insane stutters (we already know its shader compilation) than what we already have (?

MacTavishAO commented 4 months ago

I'll take a look and try to provide a gist later.

oyvindln commented 4 months ago

Arms race matches on the shoots maps seems to be one of the worst offenders when it comes to microstutter if people need suggestions on something to test quickly. Whether the stutters are still long enough to trigger this effect I don't know, as one or two of the recent updates that fixed some thread stuff seem to have made the impact a little less but it's extremely noticeable.

MacTavishAO commented 4 months ago

This output is printed to console right after a game of Arms Race on Shoots. I had to set cl_frametime_summary_report_detailed to true to get additional information to display.

FPS starts off high and drops to around a third of it by the end of the game.

[VProf] 
[VProf] -- Performance report --
[VProf] Summary of 63361 frames.  (0 frames excluded from analysis.)
[VProf] FPS: Avg=170.4, P1=79.7
[VProf] 
[VProf]                                                       All frames         Active frames   
[VProf]                                                         Avg    P99        N    Avg    P99
[VProf] ---------------------------------------------------- ------ ------   ------ ------ ------
[VProf]                                           FrameTotal   5.87  12.54    63361   5.87  12.54
[VProf]                                       Frame Boundary   2.40   7.21    63361   2.40   7.21
[VProf]                                     Client Rendering   1.70   3.60    63361   1.70   3.60
[VProf]                                    Client Simulation   1.23   3.11    63361   1.23   3.11
[VProf]                                           PanoramaUI   0.51   1.37    63361   0.51   1.37
[VProf]                                           Prediction   0.37   2.20    63361   0.37   2.20
[VProf]                                          Unaccounted   0.25   0.88    63361   0.25   0.88
[VProf]                                           Networking   0.17   1.06    23780   0.46   1.49
[VProf]                                       Client Physics   0.11   0.77    23808   0.29   1.26
[VProf] LatchAndSaveLastSimulationValuesForInterpolationList   0.08   1.10    23772   0.22   1.73
[VProf] 
[VProf] VProfLite stopped.
MacTavishAO commented 4 months ago

So I have played another game of Arms Race on Shoots to upload performance metrics recorded by mangohud at 1000ms intervals: https://flightlessmango.com/games/4777/logs/5280

It's still not adequate enough to show performance issues so I'm leaving gists of raw recordings too: https://gist.github.com/MacTavishAO/efea87313030ff986dc2697e52d9546b

As can be seen on CSV recordings, CPU utilization starts at mid-20s and climbs all the way up to mid-40s and settles there whilst GPU utilization starts high (98+) but it slowly goes down to as low as 55% by the end.

This results in significantly lower FPS after a while. I should also mention that this game only took 5 minutes for someone to win. Performance impact would've been much worse otherwise as I have seen sub 90 on longer games.

Retalak commented 3 months ago

Having just switched back to Linux after being on Windows for a few years, the performance is very apparently worse on Linux. It's unplayable, I'll just boot up Windows when I want to play CS for now. Valve pls fix.

gamertyke commented 2 months ago

I know this is a pretty undetailed report, but I switched from a 12900K to a 7800X3D yesterday and the performance difference is HUGE. The frame times are incredibly consistent and spike free on the 7800X3D, unlike the Intel.

dylif commented 2 months ago

I know this is a pretty undetailed report, but I switched from a 12900K to a 7800X3D yesterday and the performance difference is HUGE. The frame times are incredibly consistent and spike free on the 7800X3D, unlike the Intel.

That's really interesting. On my 13900HX, I have pretty bad frame times, which are slightly improved when disabling my e-cores. Note that I'm using the latest kernel (6.9.5) on Arch/KDE/X11 with an RTX 4090 Mobile. On Wayland, cs2 is borderline unplayable.

gamertyke commented 2 months ago

Just to expand for those who may be interested, after extensive testing I've found that KDE performs better than Gnome by a small margin and X11 outperforms Xwayland (and forced native Wayland) by a large margin.

dylif commented 2 months ago

Just to expand for those who may be interested, after extensive testing I've found that KDE performs better than Gnome by a small margin and X11 outperforms Xwayland (and forced native Wayland) by a large margin.

How can I force native wayland? I'd like to give it a try. TIA.

gamertyke commented 2 months ago

How can I force native wayland? I'd like to give it a try. TIA.

in the game dir, find cs2.sh and change export SDL_VIDEO_DRIVER line. either change to wayland or comment it out.

KeironO commented 1 month ago

I've stopped playing CS altogether, but I did see that 3kliksphilip did a video about CS2 on the Steam Deck.

https://www.youtube.com/watch?v=_PycIuATXaw

He misattributes many of the issues he faced to Steam Deck's 'limited' hardware offering. I have a pretty decent rig, and I've experienced all of the issues he's lamenting.

Valve failed to provide the beta to us, and they've failed to provide an enjoyable experience on Linux.

This issue is nearly a year old now, and we've not seen nor heard anything from Valve to address it.

It's over.

MacTavishAO commented 1 month ago

He misattributes many of the issues he faced to Steam Deck's 'limited' hardware offering. I have a pretty decent rig, and I've experienced all of the issues he's lamenting.

This was my thoughts as well the second I saw that viewmodel.

Valve failed to provide the beta to us, and they've failed to provide an enjoyable experience on Linux.

And yet when I created a thread over at reddit to start a discussion about that back then I got called "dumb, so dumb" because apparently I got "mad" over the exclusion of Linux from beta. I could read the state CS2 was going to be in on Linux after its eventual release to the public from miles ahead. It was as obvious as the sun in broad daylight. I got downvoted without any discussion when I gave the state CSGO was in at that time on Linux as a reason for my scepticism.

So why am I writing this here? Is it because I care about "internet points"? No. The moral of the story is Valve can be, and should be, criticised where it's due. Yes, Valve have contributed a lot to gaming on Linux, and we appreciate that, but that doesn't mean they're incapable of doing anything wrong.

nJ3ahxac commented 1 month ago

I've noticed the same performance degradation on servers with other players. Performance is notably worse after the first round and degrades as time goes on, with bad performance remaining between map changes. Otherwise on my machine FPS is reasonably comparable to windows (assuming you don't play the actual game and just sit in an empty map).

IMO it's clearly a memory leak from https://github.com/ValveSoftware/csgo-osx-linux/issues/3687 that's causing this issue and it's probably been there since the beta. Whatever the source, it seems to require playing with other players to accumulate. Obviously more mem usage equals worse frames.

For me in 10v10 casual on high settings @ 1920x1080, the first round of the first game will have ~5gb allocated. By the end of the game it will be around 6gb. The second game ends at ~8gb, and the third at ~12gb (risking oom kill). Performance degrades proportionally - so clearly this allocation is awful for performance. Windows does not exhibit this issue (and if it did they would probably fix it within a day). The unnecessary allocation and caching issues from this behaviour could explain the poor linux performance.

Is this issue separate from the memory leak issue? Obviously performance is not ideal and the vulkan renderer should outperform by a wide margin, but given the existence of this memory leak which has likely been present since beta, is it possible this is not a case of linux-specific poor optimisation, but rather a linux-specific memory leak that has gone mostly unnoticed?

oyvindln commented 1 month ago

A memory leak issue does match up with the fact that neither the cpu nor gpu utilization seem to be able to properly max out when playing with mangohud up yeah. Maybe the settings also have some impact on how drastic it is - wonder if the graphics settings have any impact on how much it's leaking though as I usually run mostly lowest settings and haven't seen quite that drastic memory usage.

Valve has bunch of world class developers contracted to work on linux graphics drivers, wine and other bits that makes the steam deck a viable platform - I wish they could leverage a smidgen of that expertise to have a go over the of the CS2 linux client as well to fix some of these issues.

nJ3ahxac commented 1 month ago

@oyvindln Please test again but watch your VRAM instead. I've done separate hardware tests and notice this only occurs once VRAM is maxed out, go here for specifics (https://github.com/ValveSoftware/csgo-osx-linux/issues/3687). It's probably Valve mishandling memory during overcommitment. Use high settings to trigger it more consistently.

oyvindln commented 1 month ago

Maybe there are multiple issues then or the issue has some effect even before the ram/vram runs out, I've noticed some performance degradation (+ the stutter on maps with water like ar_shoots which may or may not be a separate issue) without vram being anywhere close to maxed out. I just have a RX 6600 but since I play with almost everything on the lowest setting other than resolution I've not noticed the vram getting anywhere close to running out (maybe it would if I played for much longer if there is a vram leak though.)

Looking at that issue it seems it gets much worse once ram starts filling up though so I guess as you say if playing with high which isn't something I personally would normally do in a game like this it would probably be way worse.

gamertyke commented 1 month ago

I get 99% GPU (3090) usage after upgrading from a 12900K to 7800X3D. Believe me when I say the difference in CS2 between those 2 CPUs is ASTRONOMICAL.

Retalak commented 1 month ago

The new open source 560 drivers from Nvidia seem to make a massive difference.

gamertyke commented 1 month ago

Replying to https://github.com/ValveSoftware/csgo-osx-linux/issues/3325#issuecomment-2256091211

What improvements are you seeing?