ValveSoftware / Dota-2

Tracker for issues specific to Linux and Mac in the Reborn client. If you have a general issue or non-system-specific feature request please go to dev.dota2.com
470 stars 38 forks source link

[Linux] Strange occasional stuttering with 60fps #1521

Closed simvux closed 5 years ago

simvux commented 5 years ago

Your system information

Please describe your issue in as much detail as possible:

I'm having this strange behavior where the game alternates between:

The game usually runs smoothly for 2-5 seconds, and then badly for 4-15 seconds. This cycle repeats, and it doesn't matter how much i lower the quality settings.

I haven't observed any consistent way to make it happen however there's two spells which always induce the effects, but an even more extreme version of it where the fps feels as if it was 1-2. These being Chronosphere and AA's Ice Blast.

There's no notable console output, if there's any debug modes i should enable then let me know.

The effect happens under both Vulkan and Opengl equally.

I tried to use steam with native libs instead (STEAM_RUNTIME=0) however it hangs at startup with no errors in log output, so i was unable to complete that troubleshooting step (Yes i have the required 32bit libs installed).

The main menu works smoothly as it should which appears to set this apart from similar issues mentioned here.

I am using a Nvidia Optimus laptop but I'm running X11 server purely on the Nvidia card for best possible performance.

edit: Also worth noting that my CPU doesn't seem to change usage or frequency during this, so it doesn't seem to be a CPU issue

presianbg commented 5 years ago

Same here. Tried everything:

....

Even lowering the Video settings to minimum is not helping.

I'm on Solus Linux with Optimus enabled laptop. Never had such issues. Looks like dota client's fault.

Here is the console output when observing a game - gist

simvux commented 5 years ago

@presianbg Do you happen to use Btrfs as your filesystem?

And how are you handling optimus? nvidia-xrun, runnning X11 purely on nvidia, or using bumblebee?

presianbg commented 5 years ago

Ext4 on top of lvm + LUKS Pure Nvidia (Solus) PRIME display.

presianbg commented 5 years ago

Reinstalled Solus and this makes no difference. Its 100% dota client issue.

simvux commented 5 years ago

I think it's safe to assume the problem's related to PRIME/Optimus.

The next step would be isolating whether the issue lies in the Dota 2 client or in SDL2. @presianbg Do you have some other SDL2 game installed you could try with? CS:GO perhaps?

presianbg commented 5 years ago

@AlmightyFloppyFish Yes, I do have CS:GO and I can test it later. I will update here with my findings. Do you have any progress on your side ?

simvux commented 5 years ago

Nope, but I'll be doing some experimentation today. Gonna try running in openbox, changing my display settings ( Currently using dual monitors ), and so on

presianbg commented 5 years ago

@AlmightyFloppyFish What was the last time you had normal performance? For me 3-4 days ago it was fine, I'm not sure which client update broke it.

simvux commented 5 years ago

This is a hard question because, before ~3 days ago, i was dualbooting to play Dota. Then switched purely to Void linux and just assumed it had issues because I picked a hipster distro. I have had other stuttering issues in Dota 2 before when I was using Arch as a gaming OS. But that was completely different and was more like constant microstutter that made 120 fps feel like 40, which i do not observe anymore now as it runs very smooth when it doesn't stutter.

edit: missremembered stuff

presianbg commented 5 years ago

Just tried CS:GO and the same fps stuttering happens. Tried many different settings. You may be correct regarding optimus / SD.

Tried with nouveau and intel/mesa... Same behavior.

presianbg commented 5 years ago

I don't know how, but its fixed ! What I did:

  1. Re-installed Solus OS;
  2. Installed all updates and 410 Nvidia propriety drivers;
  3. Installed steam as always;
  4. Installed DOTA 2 without Vulkan DLC ;
  5. Tried to spectate a match - DOTA is working as smooth as french butter on a hot toast;
  6. Installed Vulkan DLC - DOTA client kept the high FPS frame rate without significant drops and stutters;
  7. Tried DEMO with Invoker - All GOOD! - Stable 120 FPS!

I suspect there were an update while doing steps 1-4, which fixed the regression.

simvux commented 5 years ago

Ohh nice, I'll try to do the same once i get home.

edit: no luck, gonna try installing a non-hipster OS like Ubuntu and see if it's just some weird lib issue, if it's still not functioning then it's one of the following or a combination of: Xorg, Nvidia driver for Optimus, PRIME, SDL2

presianbg commented 5 years ago

And the stuttering is back... I haven't changed anything since yesterday. I haven't played either after last tests. Even watching a game is unbearable.

simvux commented 5 years ago

Same issue in Kubuntu.

Here's a pro tip: Stay as far away from Nvidia Optimus and PRIME as you can

presianbg commented 5 years ago

New finding. If i use the lts kernel (4.9) everything is back to normal. With the current kernel branch (4.19) FPS is back to potato.

EDIT - Yep, it's 100% reproducible on my side.

@AlmightyFloppyFish would you be so kind to test with the LTS kernel and see if this is truly the case here ?

simvux commented 5 years ago

@presianbg Can confirm, downgrading from 4.19 on Kubuntu appears to have solved the issue. Gonna switch back to Void when i got the time and install older kernel there

presianbg commented 5 years ago

Nice, so we are now on the right track... but on wrong REPO :) Any clues how to investigate this further ?

simvux commented 5 years ago

I have no idea, a good idea would be to somehow monitor disk for abnormalities since the most major change of 4.19 iirc was some new I/O scheduler, but I'm really not educated enough to troubleshoot a kernel issues.

presianbg commented 5 years ago

New finding: Silly me, I didn't checked what process might choking my system with 4.19.

Kernel 4.19 where DOTA 2 is barely making 35 fps: image

What is that kwoerker/0:3+kacpid doing there ?!

Here is 4.9 with DOTA2 making stable 90 fps:

image

This tests were made with different nvidia drivers (stable, beta and developer), but result is the same. In-game settings are the same!

presianbg commented 5 years ago

@AlmightyFloppyFish Dude do you have external HDD bay? I removed mine after googling about kworker/0:3+kacpid https://unix.stackexchange.com/questions/398520/kworker-consumes-high-cpu-for-external-hard-drive And this indeed solved my stuttering! I swapped my HDD bay with my other laptop roughly the same time when lag appeared! It all makes sense now... at least for me.

simvux commented 5 years ago

I am nolonger experiencing this issue, neither on Kubuntu or Void. Not sure what was wrong, could've been the earlier versions of Linux 4.19 being buggy I'm not sure.

Closing issue for now

ps: no i do not have an external HDD bay, and no process was taking up extra CPU