Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After 25-30 minutes of gameplay, Battlefield 1 stutters like crazy #697

Open
tralph3 opened this issue Dec 4, 2022 · 25 comments
Open

After 25-30 minutes of gameplay, Battlefield 1 stutters like crazy #697

tralph3 opened this issue Dec 4, 2022 · 25 comments

Comments

@tralph3
Copy link

tralph3 commented Dec 4, 2022

This is an odd one. For some reason, title happens. Up until that point, the game runs flawlessly, constant 60 FPS, no drops, no stutters, nothing. It's buttery smooth.

But CONSISTENTLY after about 25-30 minutes, it stutters, and it never goes away. This only happens when I'm using gamescope. If I don't use it, I can play multiple hours without a hitch.

I haven't encountered this issue on any other game, not even on its predecessor, Battlefield 4. It only happens in Battlefield 1 (I don't own the successors, I'm unaware if this is an issue in BF 5 or 2042).

This issue is not related to ping either. I don't have high ping, and it persists into the campaign and even menus.

System info:

  • GPU: Vega 11 integrated graphics
  • CPU: Ryzen 5 3400G
  • RAM: 16GB DDR4@3200MHz
  • Game installed on 5400rpm HDD
  • Arch Linux, stock kernel
  • Qtile window manager
  • Picom as compositor (with --unredir-if-possible, it should disable itself on fullscreen applications)

Super detailed system info.

Here's a video showcasing the issue. I'm sorry for the compression, GitHub has a 10MB upload limit, but you can appreciate how choppy it is. That's not the framerate, that's this weird stuttering that makes the game unplayable. It's clearly noticeable when I stop and just move my mouse around.

test.mp4
@Sporknife
Copy link

Same problem here with total war warhammer 2.

Operating System: Arch Linux
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Kernel Version: 6.0.11-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-8700 CPU @ 3.20GHz
Memory: 15,5 GiB of RAM
Graphics Processor: AMD Radeon RX 480 Graphics

@CartoonFan
Copy link

CartoonFan commented Dec 5, 2022

Could this be related to #163? That issue's not Fedora or KDE-specific anymore.

@cyberphantom52
Copy link

can you try doing
sudo setcap 'cap_sys_nice=eip' /usr/bin/gamescope

@Sporknife
Copy link

Just tried running a game again, and now I get freeze every 1-3 seconds (this is without the command, unless it is persistent through a reboot).

@Sporknife
Copy link

For some reason, I can't reproduce this with a native game (in this case, Drag).

@tralph3
Copy link
Author

tralph3 commented Dec 29, 2022

Oh, sorry. I forgot to update this. The command @cyberphantom52 provided actually worked wonders. I can play indefinitely now without issues.

Although, I'm hesitant to close the issue, since something is causing it in the first place, and I'd wager that should be fixed.

@Sporknife
Copy link

I now have a similar issue where the game starts to have fps drops every second. I noticed that with total war warhammer 2 it starts after a video thumbnail is loaded in the launcher and stops when I start a campaign (when I start playing the game).

@Sporknife
Copy link

Sporknife commented Feb 5, 2023

Now I am having the same issue as @tralph3 encountered. The command did not help.

@envyniv
Copy link

envyniv commented Oct 30, 2023

Same thing happening here - Using Steam (and gamescope by extension) through flatpak; the games i've noticed this happening on are Team Fortress 2 (native) and City of Brass (proton). I have not tried out the command suggested in the previous posts yet.

I would like to add that input doesn't seem to be affected - seems to be only a video output issue.
Both games run at lower resolution and then get upscaled to my desired window size (~1910x1044)

@flasheeprom
Copy link

I had exactly the same issue in War Thunder after some time of game play. Sudden massive stuttering after a few minutes.

The command sudo setcap 'cap_sys_nice=eip' /usr/bin/gamescope solved the issue. Packagers should be made aware of this so they can include this in their build/installation scripts. This information should be added to the front page of this repository.

@ammgws
Copy link

ammgws commented May 29, 2024

That seems to have issues as well: #107

@misyltoad
Copy link
Collaborator

setcap solves the issue because it breaks LD_PRELOAD. Setting LD_PRELOAD="" %command% also fixes the problem.

The problem is some pipe getting filled up in the Steam overlay stuff. I will see if there is some workaround.

@flasheeprom
Copy link

flasheeprom commented May 30, 2024

Setting LD_PRELOAD="" %command% also fixes the problem.

I had to use env LD_PRELOAD="" %command% instead, as LD_PRELOAD isn't an executable binary and throws xwm: execvp failed: No such file or directory

EDIT: And the game started stuttering again, so this doesn't seem to work.

@misyltoad
Copy link
Collaborator

Then you set it wrong. Send your full commandline arg

@flasheeprom
Copy link

flasheeprom commented May 30, 2024

First it was this:

gamescope -W 2560 -H 1440 -f --expose-wayland --force-grab-cursor --display-index 1 -- LD_PRELOAD="" %command%

which gave the error, then this:

gamescope -W 2560 -H 1440 -f --expose-wayland --force-grab-cursor --display-index 1 -- env LD_PRELOAD="" %command%

which ran, but didn't solve the issue.

@misyltoad
Copy link
Collaborator

LD_PRELOAD="" gamescope -W 2560 -H 1440 -f --expose-wayland --force-grab-cursor --display-index 1 -- %command%

Use that ^, sorry I wasn't clear enough.

@flasheeprom
Copy link

flasheeprom commented May 30, 2024

Thanks, it's running now. Will test for a while and report back.

EDIT: OK, this way seems to be working, which is better, as I don't have to setcap every time gamescope is updated.

@Stewmath
Copy link

Stewmath commented Jun 16, 2024

I've been encountering this issue on the Steam Deck with two specific games - PrimeHack, and DX-Ball 2. The only common thread between these games that I can think of is that I spent a lot of time tinkering with the mouse settings in steam input.

The lag occurs specifically when the virtual mouse is moved (as configured through steam input). When the mouse stops moving there is no lag.

More details in the issue I filed with PrimeHack here: shiiion/dolphin#144

The LD_PRELOAD fix thankfully also works on the steam deck, in particular these were my arguments for DX-Ball 2:

LD_PRELOAD= %command%

This is slightly different from the above posted fix, I guess because gamescope is invoked at a different stage in the launch process when running in game mode.

It's concerning that this is happening on a fairly normal, not overly modded steam deck.

@FaelLiberatori
Copy link

I recently opened #1511 about this issue. I’d like to add that the stutters mentioned are caused by frametime becoming unstable. Using LD_PRELOAD="" solved the issue for me. In my case, it didn’t seem to be limited to specific games (tested with both Baldur's Gate III and Death Stranding Director's Cut).

@LoipesMas
Copy link

I've also ran into this issue (with Rain World and Nier: Automata, although I haven't tested other games).
Setting LD_PRELOAD="" does fix that, but it broke the controller support (I guess it breaks Steam Input?), so I fixed that by re-setting the LD_PRELOAD for the game itself. Here's the command I used, for those having the same issue:

LD_PRELOAD=""  gamescope -- env LD_PRELOAD=:/home/user/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so:/home/user/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so %command%

(Obviously you would need to make those paths point to your home directory, but other than that I assume it should work)

@gavtroy
Copy link

gavtroy commented Oct 3, 2024

I'm also seeing this in many Steam games for the last few months. For me it started only when the Wayland backend was added (and when I use it) so there could potentially be a big uptick in affected users. LD_PRELOAD= does seem to avoid it.

Arch / KDE Plasma / RX 6800 XT, also consistently about 30 minutes in. An example game is Half-Life 2.

@X-m7
Copy link

X-m7 commented Oct 26, 2024

I think I may have been affected by this issue as well, and setting CAP_SYS_NICE did make it go away, except in my case the affected game was Forza Horizon 5 and it takes something like 3 hours of gameplay for the stutters to appear.

I don't know yet if setting LD_PRELOAD="" without CAP_SYS_NICE will also make my issue go away (currently I'm trying out Flatpak for games so CAP_SYS_NICE is no longer an option), will give it a try and see if the stutters come back or not.

@BETLOG
Copy link

BETLOG commented Dec 29, 2024

try: export PROTON_ENABLE_NVAPI=0 or the equivalent line in dxvk.conf dxgi.nvapiHack = False
this is useful for any frostbyte engine (battlefield*)

BETLOG: maybe you need to disable kwin if you are going to use gamescope?
[11:16 AM]BETLOG: qdbus org.kde.KWin /Compositor suspend

[[ false == $(qdbus org.kde.KWin /Compositor org.kde.kwin.Compositing.active) ]] && qdbus org.kde.KWin /Compositor resume &
[11:16 AM]BETLOG: thats kde syntax, i imagine its the same on steamdeck
[11:17 AM]BETLOG: second line is a general usage hint

@HarlemSquirrel
Copy link

So I'm having the same issue with Valheim on Arch / KDE Plasma / RX 7900 XTX and adding LD_PRELOAD="" seems to fix the issue but also seems to disable the Steam overlay.

The full options string I'm using now is:

LD_PRELOAD="" gamescope -W 2560 -H 1440 --adaptive-sync --expose-wayland --rt --steam --fullscreen -- %command% -console

@gavtroy
Copy link

gavtroy commented Dec 30, 2024

That was mentioned above. It's easiest to set LD_PRELOAD back again for the actual game command and the Steam overlay will work.

LD_PRELOAD= gamescope -- env LD_PRELOAD="$LD_PRELOAD" %command%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests