https://bugs.winehq.org/show_bug.cgi?id=43773
Bug ID: 43773 Summary: grandma2 onpc screen flickering and d3d:context_reacquire errors Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: xhpohanka@gmail.com Distribution: ---
Created attachment 59277 --> https://bugs.winehq.org/attachment.cgi?id=59277 log with errors
Opening external screen in grandma2 onpc application causes screen flickering and a lot of errors like err:d3d:context_reacquire Acquired context 0x1846e840 instead of 0x88760
I have tested wine 2.13 - 2.17 including staging and all behaves same way. I also tested it on integrated intel gpu (i915 driver) and on nvidia card (940MX with nvidia driver)
To reproduce this issue it is enough to click Extern 1 or Screen 2 button to open external window.
Log is attached
https://bugs.winehq.org/show_bug.cgi?id=43773
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |2.17
--- Comment #1 from Matteo Bruni matteo.mystral@gmail.com --- Can you try to enable CSMT (see https://wiki.winehq.org/Useful_Registry_Keys)? That's assuming the crash at the end of the log is unrelated to this issue.
https://bugs.winehq.org/show_bug.cgi?id=43773
--- Comment #2 from xhpohanka@gmail.com --- With CSMT enabled the flickering seems to me les frequent (but it can be subjective), there is no crash at the end but d3d erorrs persist
wine .wine/drive_c/Program\ Files/MA\ Lighting\ Technologies/grandma/grandMA2\ onPC\ 3.3.4.1/gma2onpc.exe
fixme:winediag:start_process Wine Staging 2.17 is a testing version containing experimental patches. fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org. err:winediag:wined3d_dll_init Setting multithreaded command stream to 0x1. fixme:win:RegisterDeviceNotificationA (hwnd=0x1006a, filter=0xca9e090,flags=0x00000004) returns a fake device notification handle! fixme:win:RegisterDeviceNotificationA (hwnd=0x1006a, filter=0xca9e090,flags=0x00000004) returns a fake device notification handle! fixme:wtsapi:WTSRegisterSessionNotification Stub 0x1006a 0x00000000 fixme:wtsapi:WTSRegisterSessionNotification Stub 0x20074 0x00000000 fixme:wtsapi:WTSRegisterSessionNotification Stub 0x20072 0x00000000 fixme:wtsapi:WTSRegisterSessionNotification Stub 0x10076 0x00000000 fixme:wtsapi:WTSRegisterSessionNotification Stub 0x10078 0x00000000 fixme:wtsapi:WTSRegisterSessionNotification Stub 0x1007a 0x00000000 fixme:win:RegisterDeviceNotificationA (hwnd=0x1006a, filter=0xca9e360,flags=0x00000004) returns a fake device notification handle! err:d3d:context_reacquire Acquired context 0x85a80 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x85a80 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x85a80 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x85a80 instead of 0x11d0e0. ...... err:d3d:context_reacquire Acquired context 0x1957e100 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x1957e100 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x1957e100 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x1957e100 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x1957e100 instead of 0x11d0e0. err:d3d:context_reacquire Acquired context 0x1957e100 instead of 0x11d0e0. ...... err:d3d:context_reacquire Acquired context 0x11d0e0 instead of 0x1957e100. err:d3d:context_reacquire Acquired context 0x11d0e0 instead of 0x1957e100. err:d3d:context_reacquire Acquired context 0x11d0e0 instead of 0x1957e100. err:d3d:context_reacquire Acquired context 0x11d0e0 instead of 0x1957e100. err:d3d:context_reacquire Acquired context 0x11d0e0 instead of 0x1957e100. ....... err:ole:CoUninitialize Mismatched CoUninitialize
https://bugs.winehq.org/show_bug.cgi?id=43773
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |download URL| |http://www.malighting.com/e | |n/products/control/control/ | |ma-lighting/grandma2-onpc/g | |ma2onpc-grandma2-onpc.html Status|UNCONFIRMED |NEW Hardware|x86 |x86-64
--- Comment #3 from Matteo Bruni matteo.mystral@gmail.com --- Thank you for the very clear instructions.
The application uses d3d9 to draw to multiple windows from a single device (via CreateAdditionalSwapChain()). In current wined3d this means using, and switching between, multiple GL contexts, given that contexts are "private" to the swapchain. The application also creates a bunch of queries and keeps using them the whole time. Given that wined3d keeps switching between GL contexts as the application presents the different swapchains, it often happens that a query gets polled when the current context is different from the one that was used at query creation time.
CSMT usually helps for this kind of issue but it won't in this case because it's multiple swapchains, rather than multiple threads, that cause wined3d to use different GL contexts.
I have a proof-of-concept patch that moves the context management to the wined3d device and reuses the same context for multiple swapchains as long as the pixel format matches (which fortunately seems to be the case for the application in question). I'll try to clean it up into shape at some point after 3.0, it seems like it could also be a decent stepping stone for handling d3d10+ swapchainless rendering.
https://bugs.winehq.org/show_bug.cgi?id=43773
Józef Kucia joseph.kucia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |joseph.kucia@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=43773
Tobias Klausmann tobias.johannes.klausmann@mni.thm.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tobias.johannes.klausmann@m | |ni.thm.de
--- Comment #4 from Tobias Klausmann tobias.johannes.klausmann@mni.thm.de --- Origin seems to suffer the same fate: ... 0009:err:d3d:context_reacquire Acquired context 0x14522818 instead of 0x141b2198. 0009:err:d3d:context_reacquire Acquired context 0x14522818 instead of 0x141b2198. ...
Having the context(s) within the device seems a good idea imho, where the right context could be picked (made active?). Did the mentioned PoC work out?
Anyway, the below dirty hack seems to help a bit with the current situation:
@@ -4311,8 +4311,11 @@ struct wined3d_context *context_reacquire(const struct wined3d_device *device, }
acquired_context = context_acquire(device, NULL, 0); - if (acquired_context != context) + if (acquired_context != context) { ERR("Acquired context %p instead of %p.\n", acquired_context, context); + context_release(context); + return NULL; + } return acquired_context; }
https://bugs.winehq.org/show_bug.cgi?id=43773
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #5 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-5.11?