https://bugs.winehq.org/show_bug.cgi?id=44623
Bug ID: 44623 Summary: Witche 3: Wine d3dx11 capped to 60Hz/fps Product: Wine Version: 3.2 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3dx11 Assignee: wine-bugs@winehq.org Reporter: dahlberg@lysator.liu.se Distribution: ---
Created attachment 60611 --> https://bugs.winehq.org/attachment.cgi?id=60611 wexport WINEDEBUG=-all,+fps,+d3d_perf ➜ wine-build glxosd /opt/wine-build/bin/wine $WINEPREFIX/drive_c/Prog
Symptom/Failure:
The Witcher 3 or Crysis 2 (see https://bugs.winehq.org/show_bug.cgi?id=44146) in menus using 3.2 with new buffer patch from https://bugs.winehq.org/show_bug.cgi?id=42592 when browsing the menu before launching the game (here: TW3) the FPS is capped at 60 even though Vsync is turned off in nvidia-settings and the game.
Interestingly the game seems similarly to be semi-stuck/capped at ~20 fps when running.
How to reproduce:
1) Build recent master or 3.2 with the following patch https://bugs.winehq.org/show_bug.cgi?id=42592
2) Disable Vsync in e.g. nvidia-settings.
3) Launch the game
4) Observe FPS while in the first menu menu
What should happen:
Using wine-staging 2.21 or older FPS runs into the 100s when in the menu without Vsync.
https://bugs.winehq.org/show_bug.cgi?id=44623
Anders Dahlberg dahlberg@lysator.liu.se changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Witche 3: Wine d3dx11 |Witcher 3: Wine d3dx11 |capped to 60Hz/fps |capped to 60Hz/fps
https://bugs.winehq.org/show_bug.cgi?id=44623
Anders Dahlberg dahlberg@lysator.liu.se changed:
What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |x86-64
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #1 from Anders Dahlberg dahlberg@lysator.liu.se --- Patch mentioned above should be: https://bugs.winehq.org/attachment.cgi?id=60570
https://bugs.winehq.org/show_bug.cgi?id=44623
Christian christian.frank@gmx.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |christian.frank@gmx.de
--- Comment #2 from Christian christian.frank@gmx.de --- same happens in unigine heaven, the benchmark also caps at 60fps,but vsync is inactive.
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #3 from Anders Dahlberg dahlberg@lysator.liu.se --- Created attachment 60614 --> https://bugs.winehq.org/attachment.cgi?id=60614 same settings but with wine-staging 2.21 gives ~950 fps in menu
Same settings both in game and nvidia gives ~950 fps in menu when testing with old wine-staging 2.21.
Note that the fps difference while actually playing the game is much smaller: 20 vs 20-24 fps.
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #4 from Anders Dahlberg dahlberg@lysator.liu.se --- Some additional observations using (latest or 3.2) master with patch above.
One steady state is reached at 20.00 fps or 50.00 ms average frame duration. One example is just outside Hierarch Square. But all locations I've tried have one (a lot of really) of these positions in close proximity.
Another steady state is seen at exactly 15.00 or 66.67 ms average frame duration. In the middle of Hierarch Square.
A third steady state is in the menus, exactly 60.00 FPS.
Moving between the steady states the frame rate fluctuates a lot. But stopping to move and then slowly moving/changing viewpoint towards higher/lower FPS is it easy to reach an equilibrium position where the FPS is either a rock solid 15.00 or 20.00 fps. All (?) other fps values fluctuate over time but when 15.00 or 20.00 is found you can stand there forever in exact synchronization.
https://bugs.winehq.org/show_bug.cgi?id=44623
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #5 from Anders Dahlberg dahlberg@lysator.liu.se --- Created attachment 60648 --> https://bugs.winehq.org/attachment.cgi?id=60648 b1aee9c + small buffers patch + 142465/swap interval patch
Seems to be fixed in patch https://source.winehq.org/patches/data/142465, see attached log.
Now ~960 FPS in menus and more dynamic fps while in game - i.e. does no longer "semi-cap" at 15 or 20. FPS changes also "feels smoother" between 15 and 20 (might be imagination - difficult to measure).
Previous master max FPS was 20.00 now it goes up to 24-ish.
https://bugs.winehq.org/show_bug.cgi?id=44623
Anders Dahlberg dahlberg@lysator.liu.se changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Witcher 3: Wine d3dx11 |The Witcher 3: Wine d3dx11 |capped to 60Hz/fps |capped to 60Hz/fps
https://bugs.winehq.org/show_bug.cgi?id=44623
Daniel Oom oom.daniel@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |oom.daniel@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=44623
Anders Dahlberg dahlberg@lysator.liu.se changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|3.2 |3.4
https://bugs.winehq.org/show_bug.cgi?id=44623
Sveinar Søpler cybermax@dexter.no changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |cybermax@dexter.no
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #6 from Sveinar Søpler cybermax@dexter.no --- Created attachment 60788 --> https://bugs.winehq.org/attachment.cgi?id=60788 Patch to make swap_interval accept "0" (disabled)
Fixes what i believe is a typo in dlls/wined3d/swapchain.c that prevents "0" being set to swap_interval (ie. vsync disabled)
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #7 from Anders Dahlberg dahlberg@lysator.liu.se --- Nice catch! Rebuilt with above patch applied on wine-3.4 and issue is resolved - not capped at 60 any more.
"confirmed +1" I guess. :-)
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #8 from Henri Verbeet hverbeet@gmail.com --- Created attachment 60792 --> https://bugs.winehq.org/attachment.cgi?id=60792 hack
No, that's not a typo. The attached hack should be more proper if you just want to disable vsync for d3d11.
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #9 from Sveinar Søpler cybermax@dexter.no --- (In reply to Henri Verbeet from comment #8)
Created attachment 60792 [details] hack
No, that's not a typo. The attached hack should be more proper if you just want to disable vsync for d3d11.
Not sure what you mean by that?
As it WAS, the applications vsync option, or whatever vsync option was used, did not work at all. Vsync could not be disabled.
The point was not to "just disable vsync", the point was to be able to CHOOSE that option. Like, if i tick OFF a "vsync" option in a game, vsync should be disabled, and it was not.
I tested with Unigine Valley and World of Warcraft. With wine-3.4 (and wine-release/dev since dx11 started working around 2.10 or something) vsync has been ON no matter what setting is used. Wine-staging implemented a vsync function that worked back around 2.16 or so, and it worked until wine-staging-3.3, but got broken again with wine-staging-3.4, cos the "swap_interval" function was changed in dlls/wined3d/swapchain.c.
Or do you have other info?
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #10 from Henri Verbeet hverbeet@gmail.com --- (In reply to Sveinar Søpler from comment #9)
(In reply to Henri Verbeet from comment #8)
No, that's not a typo. The attached hack should be more proper if you just want to disable vsync for d3d11.
Not sure what you mean by that?
It's intentional that swap intervals larger than 4 will behave like swap interval 1.
The point was not to "just disable vsync", the point was to be able to CHOOSE that option. Like, if i tick OFF a "vsync" option in a game, vsync should be disabled, and it was not.
Well, yes, but your patch does not do that. It will just map intervals larger than 4 (including WINED3D_SWAP_INTERVAL_DEFAULT) to 0, which effectively disables vsync for Direct3D 11 applications.
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #11 from Sveinar Søpler cybermax@dexter.no --- (In reply to Henri Verbeet from comment #10)
The point was not to "just disable vsync", the point was to be able to CHOOSE that option. Like, if i tick OFF a "vsync" option in a game, vsync should be disabled, and it was not.
Well, yes, but your patch does not do that. It will just map intervals larger than 4 (including WINED3D_SWAP_INTERVAL_DEFAULT) to 0, which effectively disables vsync for Direct3D 11 applications.
Interesting that it works as it's supposed to then.
Starting Unigine Heaven DX11, with vsync disabled = disabled. Setting it enabled, will enable it and i get 60fps cap (on my 60Hz monitor). Closing the program, and starting it with vsync enabled will have vsync enabled. Closing and starting it with vsync DISABLED, will leave it disabled, and i get whatever fps my hardware can muster.
This is not the case with wine-3.x, as starting it with vsync disabled will cap at 60 hz, and enable/disable will cap at 60hz. No vsync setting will get me past 60hz.
This is not just with Unigine Valley (so dont blame the app), but all DX11 games/apps i have tried. Vsync ingame options = NOT WORKING.
With swapchain->desc.swap_interval > 4 ? 0 : swapchain->desc.swap_interval; atleast ingame vsync option works as intended.
Just so we are clear: This is with the aforementioned patch for swapchain, which is basically the same as in wine-staging-3.x.
Are you saying that vsync works as its supposed to with just the patch from staging?
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #12 from Sveinar Søpler cybermax@dexter.no --- The line swapchain->desc.swap_interval > 4 ? 0 : swapchain->desc.swap_interval; is new in Wine-3.4, as it was not like this in wine-3.3... where the staging swapinterval patch worked...
I dont know why the old way with: switch (swapchain->desc.swap_interval) { case WINED3DPRESENT_INTERVAL_IMMEDIATE: swap_interval = 0; break; case WINED3DPRESENT_INTERVAL_DEFAULT: case WINED3DPRESENT_INTERVAL_ONE: swap_interval = 1; break; and so on worked with the previous staging patch, and the new one does not..
Could it be a nVidia thing?
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #13 from Henri Verbeet hverbeet@gmail.com --- (In reply to Sveinar Søpler from comment #11)
Are you saying that vsync works as its supposed to with just the patch from staging?
No, I'm saying it doesn't work the way it's supposed to with any of the patches out there; they're just trading different issues. I think that's fine, as long as people are aware of that.
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #14 from Anders Dahlberg dahlberg@lysator.liu.se --- Seeing that the only solutions I am aware of as of Today are various patches/hacks - how far away is wine master from having working vsync? I.e. ability to turn it off by deselecting vsync in the various game menus. For me personally wine work fine at 60FPS as that's what my monitor supports but e.g. performance comparisons becomes a bit trickier. :-)
I am basically just curious if it is "almost there" or if there is some huge refactoring or similar that would be needed?
Thanks in advance and for all your great work! :-)
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #15 from Sveinar Søpler cybermax@dexter.no --- @Henri Verbeet I agree :)
We could debate "works as it is intended" tho, cos for ME as a user, seeing the right thing happen on my screen when flipping a switch = "intended", but i guess from a coding perspective that is not good enough :)
What is the main difference in how it is supposed to work when comparing dx9/ogl and dx11 and the behaviour of enabling/disabling vsync? Again, im seeing this from a user perspective, so eg. in a dx9 app, i can flip the vsync option, and see vsync fps is capped at monitor hz, flipping it off the fps is "free".
After the hack i did + the staging patch, this also works exactly the same with dx11, but as you say: this is not intended. Elaborate.
https://bugs.winehq.org/show_bug.cgi?id=44623
Józef Kucia joseph.kucia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|directx-d3dx11 |directx-d3d CC| |joseph.kucia@gmail.com Status|UNCONFIRMED |RESOLVED Version|3.4 |3.2 Fixed by SHA1| |6aeb444e4ca7f8e60c503858bc5 | |2e4a75b150f7a Resolution|--- |FIXED
--- Comment #16 from Józef Kucia joseph.kucia@gmail.com --- It should be fixed by https://source.winehq.org/git/wine.git/?a=commit;h=6aeb444e4ca7f8e60c503858b...
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #17 from Anders Dahlberg dahlberg@lysator.liu.se --- Confirmed, afef57f clean master build allows vsync to be toggled from within the game.
Thanks Józef!
https://bugs.winehq.org/show_bug.cgi?id=44623
--- Comment #18 from Sveinar Søpler cybermax@dexter.no --- Nice job! Working now :)
Thanks!
https://bugs.winehq.org/show_bug.cgi?id=44623
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #19 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.5.