ValveSoftware / csgo-osx-linux

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

CS:GO lagging on linux #2920

Closed Paynzin closed 2 years ago

Paynzin commented 2 years ago

Your system information

Please describe your issue in as much detail as possible:

When I find a match, the loading takes much longer than usual (like 5 minutes to load) and when I finally connect to the match my game gets really stuck, freezing every 1-2 seconds (this is doesn't happen with offline matches, but it isn't a connection problem because I test in my notebook and it works fine).

Steps for reproducing this issue:

  1. Open CS:GO
  2. Find a match
alou-S commented 2 years ago

From what I see it seems you have too little RAM. (Which seems to be 4GB according to the attached gist) Its recommended to have atleast 8GB while running CSGO on Linux. Plus on top of that you run an iGPU which means that RAM is also used as the Video Memory.

You have 2 options:

The reason for the stutters and long loading times:

Due to lack of RAM your system is probably using swap on disk which is slower than RAM. This thus increases disk I/O usage and leads to the longer loading times. The stutters are related to the same thing.

ghost commented 2 years ago

I can confirm that it's not RAM related. With Vulkan API when I put -vulkan in the launch options I have the same situation. Game is not lagging, but freezes in increments of 10-20 seconds for half or one second. Only on online matches like standard match making 64 tick and Deathmatch 64 tick on Valves official servers.

My PC is i3-8350k and 8 GB of RAM and I have Xfce. When I go back to OpenGL the problem disappears, so it's clearly related to Vulkan. I want to play on Vulkan, because it's more FPS.

Every test I do is on Manjaro Linux with the newest kernel 5 and also on LTS kernel 4. The system is updated, and the issue is less prevalent when I play longer time, but still not competitive.

lux01sv commented 2 years ago

Can confirm, have same issue. Probably nvidia specific problem

ghost commented 2 years ago

No it's not. I have AMD RX470 4GB, so it's Vulkan problem. When I switch to OpenGL the game runs smoothly without lags. Obviously fewer fps on OpenGL, but still playable without freezes 200-400 fps, and sometimes 170 fps and on Vulkan it never dips below 210 fps. That's why I want to invest my time to investigate this issue and I hope developers will fix this issue.

Also, when I play with bots it's not freezing, maybe sometimes has micro lags, and on online matches game is freezing from time to time, probably in 10-20 seconds intervals. So I would suggest to developers that's also communication related with the server.

I think everybody has this issue. Like in this video:

https://youtu.be/rhvVgLvM2wY?t=287

In the same video when the guy is disabling Vulkan, the freezes are resolved:

https://youtu.be/rhvVgLvM2wY?t=329

romanstingler commented 2 years ago

@niereklamuj try sudo cpupower frequency-set -g performance ....

Disable shader pre-caching in steam client and clear download cache in steam client,

Further testing possibility use single mesa shader cache file (mesa 21.1+ required) put MESA_DISK_CACHE_SINGLE_FILE=1 in your /etc/environment or export it.

Reboot your system

This will create a folder ~/.cache/mesa_shader_cache_sf where the single shader cache file (there will be multiple files, but the cache is stored in a single file) will reside. the old ~/.cache/mesa_shader_cache folder can be removed after testing. Delete also ~/.local/share/Steam/steamapps/shadercache/730 ...

Disable swap ...

Disable mangohud

...

Use only these launch options

%command% -vulkan -fullscreen -nojoy -novid ...

I have these video settings

"VideoConfig"
{
    "setting.cpu_level"     "0"
    "setting.gpu_level"     "0"
    "setting.mat_antialias"     "0"
    "setting.mat_aaquality"     "0"
    "setting.mat_forceaniso"        "16"
    "setting.mat_vsync"     "0"
    "setting.mat_triplebuffered"        "0"
    "setting.mat_grain_scale_override"      "-1.000000"
    "setting.gpu_mem_level"     "0"
    "setting.mem_level"     "3"
    "setting.mat_queue_mode"        "-1"
    "setting.csm_quality_level"     "0"
    "setting.mat_software_aa_strength"      "0"
    "setting.mat_motion_blur_enabled"       "0"
    "setting.mat_texturestreaming"      "0"
    "setting.r_player_visibility_mode"      "1"
    "setting.mat_enable_uber_shaders"       "1"
    "setting.defaultres"        "1280"
    "setting.defaultresheight"      "960"
    "setting.aspectratiomode"       "0"
    "setting.fullscreen"        "1"
    "setting.nowindowborder"        "0"
}

Set everything, reboot, launch game, join Death Match game and spectate the first few rounds. Leave DM and join another DM map, spectate again and try joining the game.

Important: Reboot don't open any browser or video player just steam and CS. Vulkan uses much more resources and we don't want that something is behaving strangely just because of something else.

You can also install radeon-profile and set the GPU manually to HIGH maximum frequency.

ghost commented 2 years ago

I did as you've said, but it's the same. I didn't skip anything. I even put your command for the CPU, knowing that I'm using cpupower-gui, and my all cores were 4.8 GHz.

This shader cache folder is constantly growing by kilobytes, so it's probably doing something and there is no end to it, because the old has 24 MB and the newer "mesa_shader_cache_sf" has 5.4 MB, and it's growing while I'm playing with freezes.

When I switch back to OpenGL removing "-vulkan" launch options, the game runs without freezes. Is it possible to end this shader cache nonsense, for the game to just run without it? It's so annoying...

Or, how do I speed up the process for it to be complete. Mind You, before your all suggestions I played for hours and the old cache is still growing, but not as much as at the beginning.

alou-S commented 2 years ago

@niereklamuj I would like to state that I said the solution for the problem related to the creator of this issue. In their case it is RAM related as far as I can see from the gist. You are technically thread hijacking here.

alou-S commented 2 years ago

@kisak-valve Would suggest to close this issue as the creator of the issue isn't responding to the possible solution I gave and others are using the issue for their own problems.

Sorry for the ping.

ghost commented 2 years ago

So, we need to move it to Vulkan related topic which I cannot find, because it's vague and many problems on this forum and I don't want to create one more to further fragment the topic.

Please Admin, can You move it or part of it to the right topic and create one topic with specific problem related to Vulkan which doesn't relate to OpenGL?

kisak-valve commented 2 years ago

Hello @niereklamuj, #2891 might be the issue report you're looking for.

romanstingler commented 2 years ago

@niereklamuj For new users here is my collection of tunables and fixes when using Vulkan https://gist.github.com/romanstingler/53b7a835a97607f0a2676fd4780dce48

Paynzin commented 2 years ago

When I had this problem I was using OpenGL not Vulkan, but I will test again when it's possible because I don't have my computer at this moment.

kisak-valve commented 2 years ago

Closing pending feedback.

Everest10 commented 2 years ago

Same problem here since fedora 35 and now f36 with stock or custom tkg kernel. After ≃30min or 40min playing the game starts to get slow with lag and sttutering.

OBS.: (!!) When press ESC in game to open the settings side bar the lag stop after press ESC again to back to the game the lag and stuttering start again.

System: Host: Fedora 36 Kernel: 5.19.1_tkg_pds arch: x86_64 bits: 64 Desktop: IceWM v: 2.9.7 Distro: Fedora release 36 (Thirty Six) Machine: Type: Desktop Mobo: ASUSTeK model: P8Z77-M PRO v: Rev 1.xx serial: BIOS: American Megatrends v: 2203 date: 12/15/2015 CPU: Info: quad core Intel Core i7-3770K [MT MCP] speed (MHz): avg: 1643 min/max: 1600/4100 Graphics: Device-1: Intel IvyBridge GT2 [HD Graphics 4000] driver: i915 v: kernel Device-2: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] driver: amdgpu v: kernel Display: x11 server: X.Org v: 1.20.14 with: Xwayland v: 22.1.3 driver: X: loaded: amdgpu,modesetting unloaded: fbdev,vesa gpu: amdgpu resolution: 1920x1080 OpenGL: renderer: AMD Radeon RX 580 Series (polaris10 LLVM 14.0.0 DRM 3.47 5.19.1_tkg_pds) v: 4.6 Mesa 22.1.5 Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 Drives: Local Storage: total: 6.82 TiB used: 1.89 TiB (27.7%) Info: Processes: 314 Uptime: 2h 35m Memory: 15.32 GiB used: 4.91 GiB (32.0%) Shell: Zsh inxi: 3.3.19

Everest10 commented 2 years ago

Can confirm, have same issue. Probably nvidia specific problem

No. It's with Radeon video card too.

Everest10 commented 2 years ago

@niereklamuj try sudo cpupower frequency-set -g performance ....

Disable shader pre-caching in steam client and clear download cache in steam client,

Further testing possibility use single mesa shader cache file (mesa 21.1+ required) put MESA_DISK_CACHE_SINGLE_FILE=1 in your /etc/environment or export it.

Reboot your system

This will create a folder ~/.cache/mesa_shader_cache_sf where the single shader cache file (there will be multiple files, but the cache is stored in a single file) will reside. the old ~/.cache/mesa_shader_cache folder can be removed after testing. Delete also ~/.local/share/Steam/steamapps/shadercache/730 ...

Disable swap ...

Disable mangohud

...

Use only these launch options

%command% -vulkan -fullscreen -nojoy -novid ...

I have these video settings

"VideoConfig"
{
  "setting.cpu_level"     "0"
  "setting.gpu_level"     "0"
  "setting.mat_antialias"     "0"
  "setting.mat_aaquality"     "0"
  "setting.mat_forceaniso"        "16"
  "setting.mat_vsync"     "0"
  "setting.mat_triplebuffered"        "0"
  "setting.mat_grain_scale_override"      "-1.000000"
  "setting.gpu_mem_level"     "0"
  "setting.mem_level"     "3"
  "setting.mat_queue_mode"        "-1"
  "setting.csm_quality_level"     "0"
  "setting.mat_software_aa_strength"      "0"
  "setting.mat_motion_blur_enabled"       "0"
  "setting.mat_texturestreaming"      "0"
  "setting.r_player_visibility_mode"      "1"
  "setting.mat_enable_uber_shaders"       "1"
  "setting.defaultres"        "1280"
  "setting.defaultresheight"      "960"
  "setting.aspectratiomode"       "0"
  "setting.fullscreen"        "1"
  "setting.nowindowborder"        "0"
}

Set everything, reboot, launch game, join Death Match game and spectate the first few rounds. Leave DM and join another DM map, spectate again and try joining the game.

Important: Reboot don't open any browser or video player just steam and CS. Vulkan uses much more resources and we don't want that something is behaving strangely just because of something else.

You can also install radeon-profile and set the GPU manually to HIGH maximum frequency.

Your idea probably is not the solution. When the player press ESC in game to open the settings side bar the lags stop after press ESC again the game lag and stuttering back again.

kisak-valve commented 2 years ago

Hello @Everest10, you've described the issue being tracked at #2901.