Kron4ek / Wine-Builds

Wine builds (Vanilla, Staging, TkG and Proton)
MIT License
692 stars 61 forks source link

FSYNC will add keyboard delay #40

Closed gabriele2000 closed 3 years ago

gabriele2000 commented 3 years ago

On high CPU-usage scenarios, enabling FSYNC will add a strange delay, basically you keep pressing W (for example) but when you stop wine will think that the key is still pressed, for a few second or just half a second... it's a bit randomic

Kron4ek commented 3 years ago

I doubt i can help you with that since i'm not a Wine/fsync developer. Anyway, here are a few things worth checking. Does this happen with older wine-tkg versions (6.8 and 6.9 at least)? Does this happen with Proton (Experimental and 6.3-4)? Does this happen with ESYNC?

You can use stress to get high CPU usage. For example: stress -c 4 will fully load 4 CPU cores.

In addition, WINEFSYNC_SPINCOUNT env variable can make reproduction of the issue easier or harder. Afaik, the default spincount value is 100. Lower values should decrease cpu usage, while much higher values (1000, 5000, 10000 and so on) will likely increase it. In my experience, very big values significantly reduce performance in CPU-limited scenarios.

gabriele2000 commented 3 years ago

I doubt i can help you with that since i'm not a Wine/fsync developer. Anyway, here are a few things worth checking. Does this happen with older wine-tkg versions (6.8 and 6.9 at least)? Does this happen with Proton (Experimental and 6.3-4)? Does this happen with ESYNC?

You can use stress to get high CPU usage. For example: stress -c 4 will fully load 4 CPU cores.

In addition, WINEFSYNC_SPINCOUNT env variable can make reproduction of the issue easier or harder. Afaik, the default spincount value is 100. Lower values should decrease cpu usage, while much higher values (1000, 5000, 10000 and so on) will likely increase it. In my experience, very big values significantly reduce performance in CPU-limited scenarios.

ESYNC has no problems... though I wonder: isn't FSYNC supposed to be better? It's worse in almost everything, as far as I'm seeing...

Kron4ek commented 3 years ago

I believe that depends on hardware. It's worse than ESYNC on my 2 core 4 threads CPU, but i guess it may be better on more powerful CPUs with more cores/threads.

There is also Futex2 which i haven't tested yet.

gabriele2000 commented 3 years ago

I believe that depends on hardware. It's worse than ESYNC on my 2 core 4 threads CPU, but i guess it may be better on more powerful CPUs with more cores/threads.

There is also Futex2 which i haven't tested yet.

I've got an i7-7700HQ so 4 cores, 8 threads... How can I enable futex2?

Kron4ek commented 3 years ago

As far as i know it's enabled by default, but you need a custom kernel with futex2 support (for example, linux-zen and xanmod support it).

On wine-staging-tkg builds you will see futex2: up and running. if it's working.

gabriele2000 commented 3 years ago

As far as i know it's enabled by default, but you need a custom kernel with futex2 support (for example, linux-zen and xanmod support it).

On wine-staging-tkg builds you will see futex2: up and running. if it's working.

I've got xanmod kernel but I don't see anything like this... maybe I need to set an env variable?

Kron4ek commented 3 years ago

Try WINEFSYNC_FUTEX2=1, maybe WINEFSYNC is also need to be enabled.

And check if you have CONFIG_FUTEX2 enabled in your kernel config and if /sys/kernel/futex2 is present.

gabriele2000 commented 3 years ago

Try WINEFSYNC_FUTEX2=1, maybe WINEFSYNC is also need to be enabled.

And check if you have CONFIG_FUTEX2 enabled in your kernel config and if /sys/kernel/futex2 is present.

/sys/kernel/futex2 doesn't exist, also where is the kernel config located? xanmod has futex2 indeed, but I don't see it, strange

Kron4ek commented 3 years ago

The kernel config should be in /boot or in /proc/config.gz (zcat /proc/config.gz), or in both locations.

What xanmod version are you using? 5.10 has no futex2 support, but 5.12 has.

gabriele2000 commented 3 years ago

The kernel config should be in /boot or in /proc/config.gz (zcat /proc/config.gz), or in both locations.

What xanmod version are you using? 5.10 has no futex2 support, but 5.12 has.

Kernel version: 5.12.12-xanmod1-cacule

CONFIG_FUTEX=y CONFIG_FUTEX2=y CONFIG_FUTEX_PI=y

Kron4ek commented 3 years ago

Well, although CONFIG_FUTEX2 is enabled, but the fact that /sys/kernel/futex2 is missing means that Futex2 is not working.

I just tried linux-zen and there is /sys/kernel/futex2 and wine-staging-tkg shows futex2: up and running. when WINEFSYNC is enabled (enabling WINEFSYNC_FUTEX2 is not needed).

gabriele2000 commented 3 years ago

Well, although CONFIG_FUTEX2 is enabled, but the fact that /sys/kernel/futex2 is missing means that Futex2 is not working.

I just tried linux-zen and there is /sys/kernel/futex2 and wine-staging-tkg shows futex2: up and running. when WINEFSYNC is enabled (enabling WINEFSYNC_FUTEX2 is not needed).

damn, how can I install the missing module, if it's a module? I'm searching on google but I can't find anything

Kron4ek commented 3 years ago

It's not an an external module, so the only option is to install kernel with properly enabled Futex2.

gabriele2000 commented 3 years ago

It's not an an external module, so the only option is to install kernel with properly enabled Futex2.

I opened an issue on xanmod's github, we'll see why /sys/kernel/futex2 is missing and how to fix this

Kron4ek commented 3 years ago

Try regular xanmod (I mean without cacule scheduler), maybe futex2 is working there. You can also manually compile your own kernel with futex2, linux-tkg project allows to do this pretty easily.

gabriele2000 commented 3 years ago

Try regular xanmod (I mean without cacule scheduler), maybe futex2 is working there. You can also manually compile your own kernel with futex2, linux-tkg project allows to do this pretty easily.

even without cacule scheduler, futex2 isn't working... I'll switch again to cacule and I'll wait a response on the github thread that I opened, 'cuz the patch should be applied by default, as the homepage states

gabriele2000 commented 3 years ago

@Kron4ek WHOAH! Look at that!

gabriele2000 commented 3 years ago

Futex2 didn't solve the problem, but now it's more bearable. Loadings are even faster, slightly better FPS as far as I can see

Kron4ek commented 3 years ago

Keep in mind that futex2 is still considered experimental and may cause issues in some games, in which case you can disable it (WINEFSYNC_FUTEX2=0) and probably report here.

Closing this issue as i can't do anything about it anyway.

BailShamber commented 3 years ago

@gabriele2000 try export XMODIFIERS=@im=none it has fixed this particular problem for me in the past.

gabriele2000 commented 3 years ago

@gabriele2000 try export XMODIFIERS=@im=none it has fixed this particular problem for me in the past.

what does it do?

BailShamber commented 3 years ago

@gabriele2000 It's an environment variable that has to do with the input method, I saw in a bug report that setting it gets rid of the stuck key effect in wine.

Source: https://bugzilla.redhat.com/show_bug.cgi?id=1279587#c21

BailShamber commented 3 years ago

P.S The env variable is XMODIFIERS and its value is @im=none the value kinda looks weird but that's what it is.

lavyadrian commented 2 years ago

As of 2022 I am playing no man's sky and the keyboard delay bug is still very much present, so I don't know why no one is looking into it... I wanted to open an issue about it but there was already one AND it was closed even though the bug is still there... Is there any chance the wine devs could do something about this? the XMODIFIERS env var did nothing for me, so here I am asking for help. I am using zorin os with kernel version 5.18 and wine build 7.0.

Kron4ek commented 2 years ago

Are you sure it's a Wine issue and not a game issue? Also, are you using Esync or Fsync or none?

gabriele2000 commented 2 years ago

As of 2022 I am playing no man's sky and the keyboard delay bug is still very much present, so I don't know why no one is looking into it... I wanted to open an issue about it but there was already one AND it was closed even though the bug is still there... Is there any chance the wine devs could do something about this? the XMODIFIERS env var did nothing for me, so here I am asking for help. I am using zorin os with kernel version 5.18 and wine build 7.0.

This is what you want to insert in your .profile file in your home folder. You can ignore what you don't want anyway. After you put these lines in the end of the file, you write "source .profile" and you restart your PC.

# WINE STUFF # export WINEFSYNC=1 export WINE_FULLSCREEN_FSR=1 export WINE_LARGE_ADDRESS_AWARE=1 export DXVK_ENABLE_NVAPI=1 export DXVK_ASYNC=1 export __GL_THREADED_OPTIMIZATION=1 export __GL_SHADER_DISK_CACHE=1 export __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 export XMODIFIERS=@im=none

lavyadrian commented 2 years ago

Are you sure it's a Wine issue and not a game issue? Also, are you using Esync or Fsync or none?

I am playing original sin 2 and when you scroll the game screen with the keyboard, it will keep on scrolling for a bit when the key is released even though its not as bad as no mans sky, so maybe some games are VERY sensitive to what wine/fsync does, others (like doom eternal and control) does not have that problem. I am using Fsync.

lavyadrian commented 2 years ago

As of 2022 I am playing no man's sky and the keyboard delay bug is still very much present, so I don't know why no one is looking into it... I wanted to open an issue about it but there was already one AND it was closed even though the bug is still there... Is there any chance the wine devs could do something about this? the XMODIFIERS env var did nothing for me, so here I am asking for help. I am using zorin os with kernel version 5.18 and wine build 7.0.

This is what you want to insert in your .profile file in your home folder. You can ignore what you don't want anyway. After you put these lines in the end of the file, you write "source .profile" and you restart your PC.

# WINE STUFF # export WINEFSYNC=1 export WINE_FULLSCREEN_FSR=1 export WINE_LARGE_ADDRESS_AWARE=1 export DXVK_ENABLE_NVAPI=1 export DXVK_ASYNC=1 export __GL_THREADED_OPTIMIZATION=1 export __GL_SHADER_DISK_CACHE=1 export __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 export XMODIFIERS=@im=none

I dont understand what do you mean by write source .profile? Also most of these options can be enabled through lutris right? What's the difference?

gabriele2000 commented 2 years ago

As of 2022 I am playing no man's sky and the keyboard delay bug is still very much present, so I don't know why no one is looking into it... I wanted to open an issue about it but there was already one AND it was closed even though the bug is still there... Is there any chance the wine devs could do something about this? the XMODIFIERS env var did nothing for me, so here I am asking for help. I am using zorin os with kernel version 5.18 and wine build 7.0.

This is what you want to insert in your .profile file in your home folder. You can ignore what you don't want anyway. After you put these lines in the end of the file, you write "source .profile" and you restart your PC. # WINE STUFF # export WINEFSYNC=1 export WINE_FULLSCREEN_FSR=1 export WINE_LARGE_ADDRESS_AWARE=1 export DXVK_ENABLE_NVAPI=1 export DXVK_ASYNC=1 export __GL_THREADED_OPTIMIZATION=1 export __GL_SHADER_DISK_CACHE=1 export __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 export XMODIFIERS=@im=none

I dont understand what do you mean by write source .profile? Also most of these options can be enabled through lutris right? What's the difference?

I don't have Lutris so I can't help you with this, anyway I can make a video...

https://youtu.be/PK133usEfj0