You are not logged in.

#1 2022-05-05 10:52:28

deruyoo
Member
Registered: 2022-05-05
Posts: 5

[SOLVED] Wine/Proton games consistent stuttering

When I play any game via Steam, Lutris and Wine itself there is always a consistent stuttering on the video and audio like every 3 seconds. It's not anything that completly ruins the game experience, but it's surely annoying and make it hard to focus, specially on ryhthm games. It sounds like a brief silence before someone taps on the mic.

When playing Linux native games like tf2 from Steam and Taisei from the AUR there is no such stuttering. So the problem is with wine and proton.

As for wine I have the the staging version, with all the dependencies that were recommended here https://github.com/lutris/lutris/wiki/W … 57acc7d990 + winetricks and wine-mono

Here is an example of me just hearing the song from a game and the audio stuttering. It sounds way worse live than in the recording tho (and resources usage are really low normally). https://www.youtube.com/watch?v=xrA1LUXRJmk You can see some frametime spikes when the audio stutters.

My hardware should be good enough to play those light games with no problem, I have an Intel Core i5 7th gen with Intel HD Graphics 620 and 16gb of RAM, with plenty of disk space on my SSD.

I tried asking on Reddit forums, so I tried some things they recommended, but with no success:
- Enable VSync;
- Disable Fastboot on my dual booted Windows 10 (didn't actually have an option to even enable it);
- Disable compositor (picom), which only created screen tearing for some reason;
- Try both the normal and LTS kernel;
- Create a swap partiton of 4GB.
- Try both the staging and normal version of wine
- Remove lutris, wine and steam, with each and every directory associated with them.

Last edited by deruyoo (2022-05-06 00:17:35)

Offline

#2 2022-05-05 12:13:41

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: [SOLVED] Wine/Proton games consistent stuttering

Sounds like buffer onderrun on the audio card.
Try to set, as a steam startup option, or system wide: PULSE_LATENCY_MSEC=60
Example: PULSE_LATENCY_MSEC=60 %command%
This forces pulseaudio clients to use 60msecs of buffering.
Thi higher the buffer, the less the buffer underruns, the higher the audio latency.


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#3 2022-05-06 00:15:03

deruyoo
Member
Registered: 2022-05-05
Posts: 5

Re: [SOLVED] Wine/Proton games consistent stuttering

This worked, thank you. Didn't test on every game, but had to set it to 90 to have no buffer underrun on Osu, latency is clearly noticeable tho, not sure which problem is better. When setting system wide, now anything other than the games have buffer underrun, so setting it to specifically run on games solved this. I wish there was a way to not sacrifice audio latency.

Offline

#4 2022-05-06 10:39:19

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: [SOLVED] Wine/Proton games consistent stuttering

I noticed more audio stuttering in wine/proton than in other apps too, but 90msecs is a very high value, for me a value around 40..50 is enough.

I wish there was a way to not sacrifice audio latency.

When setting system wide, now anything other than the games have buffer underrun

This really makes little sense to me.

Anyway, some things for you to try:
* If you're on pulseaudio, maybe you could try this.
* Switch from/to pipewire/pulseaudio.

Last edited by kokoko3k (2022-05-06 11:34:56)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#5 2022-05-06 11:39:17

deruyoo
Member
Registered: 2022-05-05
Posts: 5

Re: [SOLVED] Wine/Proton games consistent stuttering

90msecs is a very high value, something is definitely going wrong with your system.

With 60ms I still can hear some stuttering, with 80ms it's almost perfect, but I heard a song with a very high bass which had a little stuttering. With 90ms it everything was fine, except of course by the audio latency.

Have you tried to switch from/to pipewire/pulseaudio?

I'm currently using pipewire, I will try to go back to pulse audio when I'm with my laptop.

This really makes little sense to me.

Well, that's what is happening... on mpd, on Firefox...

Offline

#6 2022-05-06 12:48:31

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: [SOLVED] Wine/Proton games consistent stuttering

Since you are using pipewire, maybe then you can, instead of playing with PULSE_LATENCY_MSEC, force a latency at runtime.
It is done that way:

# pw-metadata -n settings 0 clock.force-quantum #Value

I'm not sure if #Value has to be a power of 2, try values like 32,64,128,256,1024,2048 and so on.
Quantum translates to latency this way:
If Quantum=1024 and sample rate=48000 ==> 1 Buffer latency = 1024/48000*1000 = 21.3msecs
Pulse clients may requests multiple buffers, so that value could be multiplied even by a factor of 4.

A value of 0 voids the settings.
The setting can be changed runtime, will affect all the applications, even the ones currently running, and is not pulse specific.
If you find a good value, you can then edit your ~/.config/pipewire/pipewire.conf (look for default.clock.* settings)
Also, in pw-top you can inspect the "ERR" column that wil register buffer underruns (however sometimes it seems to miss something with some apps).

And, if your audio card is an usb one, then it is a batch device, which could be handled better by pipewire by tweaking api.alsa.headroom at the end of ~/.config/pipewire/_media-session.d/alsa-monitor.conf (i'd try 1024)

Every change to pipewire files requires it to be restarted:

systemctl restart pipewire-pulse --user ; systemctl restart pipewire --user

Also, ~/.config/pipewire/ is empty by default; populate it by copying package file from /usr/share/pipewire

Last edited by kokoko3k (2022-05-06 12:49:36)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#7 2022-05-07 03:33:11

deruyoo
Member
Registered: 2022-05-05
Posts: 5

Re: [SOLVED] Wine/Proton games consistent stuttering

Running pw-top to test osu with the value at 0, both these two were adding up to the ERR count every two seconds:

alsa_output.pci-0000_00_1f.3.analog-stereo

adds up 1 to it's counter

+ osu!.exe

adds up 3 or 2 to it's counter

With the value at 512, both would add 1 at a irregular pace, and less frequent

With the value at 1024, both were stable (despite me hearing a stutter a time or two... maybe I'm just paranoic about this), only had a single ERR after an hour of gameplay, and at 2048 it was perfectly perfect. But since latency is bigger with that, so I decided to stick with 1024. Also, I tested values other than power of 2 and seemed to work fine. But overall, latency seemed a little better compared to that PULSE_LATENCY_MSEC... or I'm just paranoic...

Now, mpd and Firefox don't have any stutter.

And my audio card isn't USB.

Once again, thank you for your help.

Offline

#8 2022-05-07 09:14:26

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: [SOLVED] Wine/Proton games consistent stuttering

You're welcome.

-edit-
Before reading further, one thing i forgot for you to check: is your pipewire running with realtime privileges?
What's the output of

ps -T -eo rtprio,pri,ni,cmd|cut -b 1-80|sort -n

Is pipewire in there?
In case not, installing rtkit and rebooting should make it realtime, hopefully allowing lower latencies.
/edit


I've no experiences on api.alsa.headroom on non usb devices, but from what i read from the docs, it may benefit non usb soundcards too and overcome timing problems with drivers.
Since you have buffer underruns on the hardware device alsa_output.pci-0000_00_1f.3.analog-stereo, it may help.
It seems it can be used to keep the quantum lower while allowing pipewire to tune latency when there are Xruns (buffer underruns).

Last edited by kokoko3k (2022-05-07 09:46:36)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#9 2022-05-07 12:38:43

deruyoo
Member
Registered: 2022-05-05
Posts: 5

Re: [SOLVED] Wine/Proton games consistent stuttering

Full output is huge, but grepping pipewire I have:

     -  19   0 /usr/bin/pipewire-media-session
     -  30 -11 /usr/bin/pipewire
     -  30 -11 /usr/bin/pipewire-pulse
    20  60   - /usr/bin/pipewire
    20  60   - /usr/bin/pipewire-media-session
    20  60   - /usr/bin/pipewire-pulse

Checked and rtkit is already installed.

Offline

Board footer

Powered by FluxBB