https://bugs.winehq.org/show_bug.cgi?id=39911
Bug ID: 39911 Summary: dxd9 PresentationInterval not propagated on device Reset Product: Wine Version: 1.9.0 Hardware: x86 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: zakk@rsdio.com
Background: The steam game XIIZeal relies on vsync to run the game engine timing; under wine (on OSX) fullscreen runs at an unlimited speed, while on windows it runs at the refresh rate of your display.
Looking into this this is the sequence of events as best I can tell:
It creates a D3D9 Device with PresentationInterval set to D3DPRESENT_INTERVAL_IMMEDIATE Wine creates the device, swap chain, OpenGL context and eventually calls wglSwapInterval(0).
Then the game does a device Reset, in that reset the PresentationInterval is set to D3DPRESENT_INTERVAL_ONE. Wine does not ever call wglSwapInterval(1) after this reset, thus the framerate is never limited.
If I hack up wined3d_device_reset() to call wglSwapInterval() based on the PresentationInterval the game behaves as expected. However I don't know if this is the best way to approach this issue.
https://bugs.winehq.org/show_bug.cgi?id=39911
--- Comment #1 from Zakk zakk@rsdio.com --- Created attachment 54103 --> https://bugs.winehq.org/attachment.cgi?id=54103 Change swapinterval in device_reset
This is the patch I'm using to work around this issue. It works but I'm not sure if there's a better place to put this logic.
https://bugs.winehq.org/show_bug.cgi?id=39911
--- Comment #2 from Henri Verbeet hverbeet@gmail.com --- Is wined3d_device_reset() getting called from d3d9ex by any chance? context_create() (called from create_primary_opengl_context()) should take care of setting up the swap interval, but if wined3d_device_reset() gets called with "reset_state" FALSE that never happens. We'll probably want to introduce a function context_set_swap_interval() and call that from both context_create() and wined3d_device_reset().
https://bugs.winehq.org/show_bug.cgi?id=39911
--- Comment #3 from Zakk zakk@rsdio.com --- Yes, now that I look deeper the game is creating the device with Direct3DCreate9Ex, so that explains the lack of swap interval change on reset
https://bugs.winehq.org/show_bug.cgi?id=39911
--- Comment #4 from Henri Verbeet hverbeet@gmail.com --- Created attachment 54110 --> https://bugs.winehq.org/attachment.cgi?id=54110 patch
Does this patch help?
https://bugs.winehq.org/show_bug.cgi?id=39911
--- Comment #5 from Zakk zakk@rsdio.com --- Yep, that fixes the issue
https://bugs.winehq.org/show_bug.cgi?id=39911
Henri Verbeet hverbeet@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |6b8fb1c22ea26f9fafda7613385 | |0af10ac3c7256 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #6 from Henri Verbeet hverbeet@gmail.com --- Should be fixed by commit 6b8fb1c22ea26f9fafda76133850af10ac3c7256.
https://bugs.winehq.org/show_bug.cgi?id=39911
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.9.8.
https://bugs.winehq.org/show_bug.cgi?id=39911
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mstefani@redhat.com Target Milestone|--- |1.8.x
https://bugs.winehq.org/show_bug.cgi?id=39911
--- Comment #8 from Michael Stefaniuc mstefani@redhat.com --- Henri, is it worth backporting this patch to Stable? It depends on
commit e3e5dcd2cd548bed34cc193383da96c1898fee2c Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Mar 2 19:24:13 2016 +0100
wined3d: Use a single allocation for texture sub-resource objects.
which has a huge dependency list.
https://bugs.winehq.org/show_bug.cgi?id=39911
--- Comment #9 from Henri Verbeet hverbeet@gmail.com --- (In reply to Michael Stefaniuc from comment #8)
Henri, is it worth backporting this patch to Stable? It depends on
commit e3e5dcd2cd548bed34cc193383da96c1898fee2c Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Mar 2 19:24:13 2016 +0100
wined3d: Use a single allocation for texture sub-resource objects.
which has a huge dependency list.
It shouldn't be hard to backport. At first sight, it's probably just the second argument to the context_acquire() call in swapchain_update_swap_interval(). You should be able to just replace that with something like "surface_from_resource(swapchain->front_buffer->sub_resources[0])".
https://bugs.winehq.org/show_bug.cgi?id=39911
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|1.8.x |---
--- Comment #10 from Michael Stefaniuc mstefani@redhat.com --- Removing 1.8.x milestone from bugs included in 1.8.4.