https://bugs.winehq.org/show_bug.cgi?id=41653
Bug ID: 41653 Summary: The Banner Saga 2 GOG (adobe air) flickering on Wine-staging Product: Wine-staging Version: 1.9.21 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: donanykey@gmail.com CC: erich.e.hoover@wine-staging.com, michael@fds-team.de, sebastian@fds-team.de Distribution: ---
Created attachment 56035 --> https://bugs.winehq.org/attachment.cgi?id=56035 Video of flickering picture
Dedicating separate bug from https://bugs.winehq.org/show_bug.cgi?id=41635 for Wine-staging.
The game works in plain Wine (1.9.21), but with very poor frame rate performance, while with staging - it's much more responsive, but the picture is flickering.
Video and log to be attached
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #1 from donanykey@gmail.com --- Created attachment 56036 --> https://bugs.winehq.org/attachment.cgi?id=56036 warn+all,+gdi,+loaddll
WINEPREFIX=/home/don/wine/tmpprefixsaga WINEDEBUG=warn+all,+gdi,+loaddll /opt/wine-staging/bin/wine The\ Banner\ Saga\ 2.exe 2>&1 | uniq >tbs2.log
https://bugs.winehq.org/show_bug.cgi?id=41653
donanykey@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://www.gog.com/game/ba | |nner_saga_2_the
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #2 from Sebastian Lackner sebastian@fds-team.de --- Have you enabled any experimental features in the Wine Staging tab, for example CSMT? If yes, please check if they are responsible for the performance difference and/or flickering.
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #3 from donanykey@gmail.com --- Hi Sebastian,
These features are not enabled by default, so the first runs I did with all of them disabled, though I tried with all of them enabled (except gtk theme) - all the same
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #4 from donanykey@gmail.com --- It appeared the game uses direct3d acceleration heavily with default wine-staging. So flickering is from there.
There is an option from developers to "disable the new Starling renderer" with `starling=false` command line option as described in docs.google.com/document/d/1xXKMaroP1t18BXEKrl0YpFamg-ZN8wPk-vTt0rAq53M/edit?pref=2&pli=1
The flickering will gone though the picture will be notably slower, but still far more playable than with plain wine
(Wine 1.9.22)
https://bugs.winehq.org/show_bug.cgi?id=41653
donanykey@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|The Banner Saga 2 GOG |The Banner Saga 2 GOG |(adobe air) flickering on |(adobe air, direct3d) |Wine-staging |flickering on Wine-staging
https://bugs.winehq.org/show_bug.cgi?id=41653
donanykey@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|The Banner Saga 2 GOG |The Banner Saga 2, The |(adobe air, direct3d) |Inner World, Samorost 3: |flickering on Wine-staging |image flickering on | |Wine-staging (d3d9, adobe | |air)
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #5 from donanykey@gmail.com --- Intermediate update. All these games (and number of others) are based on Adobe AIR with specific game engine "Starling" utilizing Adobe Stage3d for gpu rendering.
To simplify debug, I built a very small example with Starling and packaged it into exe bundled with AIR runtime in a way games do (I hope), 13,1 MB:
https://drive.google.com/drive/folders/0B3QOvR6YLO_ybjVHaWNRYjNlZjQ?usp=shar... Source: https://drive.google.com/file/d/0B3QOvR6YLO_yS2ZJcEJ5N09FcFE/view?usp=sharin...
It just adds 2 things to a stage with white background (in this order and order does matter in this 2D engine as it not fully supports depth afaiu):
1. Text in blue containing current rendering info (software/directx/etc) 2. And a green square in the center
So far, even with these two items, flickering is observable on wine-staging (1.9.23). Particularly the text is blinking, while the square doesn't show at all. FTR on plain Wine the both items are shown, but the renderer is "Software, hw_disabled=old_driver (baseline constraints)", and thus it could flicker as well, whenever passed the directx availability checks.
Anyway, as far as I understand a trace, looks like the square (two triangles) is reaching wined3d, but have no idea yet why is not visible finally:
701152.597:0009:trace:d3d9:d3d9_device_DrawPrimitive iface 0x125e08, primitive_type 0x5, start_vertex 0, primitive_count 2. 701152.597:0009:trace:d3d:wined3d_device_set_primitive_type device 0x21516f8, primitive_type WINED3D_PT_TRIANGLESTRIP 701152.597:0009:trace:d3d:wined3d_device_draw_primitive device 0x21516f8, start_vertex 0, vertex_count 4.
Probably, thats Z buffer and objects fall behind the scene 701152.619:0009:trace:d3d:state_zenable No Z buffer - disabling depth test
or different rendering order behavior in d3d9 implementation, I am not sure as not much familiar with directX and, especially, wined3d.
P.s. Wine-staging was compiled without CSMT patches and some others conflicting with the tree after `git reset --hard wine-1.9.23 && git clean -f`
./patchinstall.sh DESTDIR=/var/wine/staging/git --all -W wined3d-CSMT_Helper -W wined3d-CSMT_Main -W api-ms-win-Stub_DLLs -W dxva2-Video_Decoder -W mfplat-MFTRegister -W msidb-Implementation -W ntoskrnl- DriverTest -W nvcuda-CUDA_Support -W nvapi-Stub_DLL -W nvcuvid-CUDA_Video_Support -W nvencodeapi-Video_Encoder -W uxtheme-GTK_Theming -W vulkan-Vulkan_Implementation -W wuauserv-Dummy_Service
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #6 from donanykey@gmail.com --- Created attachment 56167 --> https://bugs.winehq.org/attachment.cgi?id=56167 Expected screen (from Windows VM)
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #7 from donanykey@gmail.com --- Created attachment 56168 --> https://bugs.winehq.org/attachment.cgi?id=56168 warn+all,+d3d9,+ddraw,+fps,+d3d,+gdi,+dib,+tid,+timestamp
Long trace, you might want to jump to BeginScene or Present since the application does a lot of initialization
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #8 from donanykey@gmail.com --- In short: there is `StrictDrawOrdering=enabled` option in wine registry flushing objects to GL as soon as they come. It makes the test app show rectangles correctly and picture of The Banner Saga an Inner World much better (The Inner World is playable), but flickering still could be met especially on *unloaded* threads (debug, fps measurements).
In long: Starling is using AGAL (Adobe Graphics Assembly Language) for simple 2D shaders like this https://github.com/Gamua/Starling-Framework/blob/master/starling/src/starlin...
Then, I suppose, Air runtime converts them to a platform's shaders (Direct3d in windows case).
Common for all these applications is that there are 2 threads: one for preparing animations (positions/textures/etc): while another - preparing rendering pipeline and calling DrawPrimitive itself. Noteworthy, that one thread could call BeginScene, another one - EndScene.
So there is a lot of IPC, and if the threads are heavy loaded (debug output, compiling in the background, etc) OR special in-game debug frames enabled (fps, memory) the flickering is almost gone. Probably if there is a way to limit framerate to something dramatically lower then 100-120 (on my hardware) - the games will be playable only with `StrictDrawOrdering=enabled` option
I think it would be a good idea to test the games on non-nvidia cards
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #9 from donanykey@gmail.com --- I did some reading and googling around multi-threading Direct3d 9 and OpenGL, and seems Adobe's engineers spent hundreds of hours on making things work in a way AIR runtime is working now: locks in proper places, rendering sequences, etc.
I don't have that much time to debug frame after frame, follow texture content with each IPC lock to find particular cases where render order is violated or a texture is corrupted, especially considering flickering almost gone when threads are loaded with the debugging (see previous comment).
*However* there is a workaround that minimizes flickering (my eye could catch single frames per several minutes) in the fullscreen, without debug and StrictDrawOrdering=enabled, while keeping reasonable FPS (below)
The patch just makes a call to glFinish() in the EndScene instead of glFlush() in cost of notable performance hit on some limited number of scenes, though the fps in general is still far above just-playable to me (fps 30-120, median ~80, Amd 2.6Ghz, Nvidia 650 blob; and that could be caused by my setup, so testing on other hardware, without composite WM, etc is welcome)
I would probably check with 1.9.24 whether CSMT makes any difference with the patch, though any other ideas are welcome
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #10 from donanykey@gmail.com --- Created attachment 56206 --> https://bugs.winehq.org/attachment.cgi?id=56206 Workaround in cost of performance hit. The comment is fair btw, probably the glFlush should be removed
https://bugs.winehq.org/show_bug.cgi?id=41653
donanykey@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|1.9.21 |1.9.23
https://bugs.winehq.org/show_bug.cgi?id=41653
donanykey@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |x86-64
https://bugs.winehq.org/show_bug.cgi?id=41653
Béla Gyebrószki gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gyebro69@gmail.com
--- Comment #11 from Béla Gyebrószki gyebro69@gmail.com --- The patch from Staging which causes the flickering: https://github.com/wine-compholio/wine-staging/blob/master/patches/setupapi-...
This is the same patch which improves performance in the affected games when compared to plain Wine (as reported in bug #41635).
Tested and reproduced the issue with some of my games which use Adobe AIR (The Inner World, Bardbarian).
wine-2.0-rc2-31-gf7cc41d Fedora 25 x86_64 XFCE 4.12 OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GT 730/PCIe/SSE2 OpenGL core profile version string: 4.5.0 NVIDIA 375.26
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #12 from donanykey@gmail.com --- Hi Béla,
Thanks for the finding, I could confirm this patch alone makes games consider Direct3D9 rendering.
Regarding flickering - I assume a reason could be somewhere closer to nvidia blob (we have it in common, as I met flickering on Ubuntu / Nvidia 650 / Driver 367).
On the other hand, my laptop with Intel OpenGL and clean wine-staging doesn't flicker at all with StrictDrawOrdering:
Ubuntu 14.04 (Unity) wine-2.0-rc3 (Staging) OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 OpenGL version string: 3.0 Mesa 11.2.0
Also, as soon as CSMT intended to solve such multi-threaded-commands issues by design, could you please check whether there is any flickering with CSMT enabled alone (without StrictDrawOrdering) on your setup?
https://bugs.winehq.org/show_bug.cgi?id=41653
donanykey@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |donanykey@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=41653
Béla Gyebrószki gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #13 from Béla Gyebrószki gyebro69@gmail.com --- nouveau/mesa 13.0.3, Wine 2.0-rc4: poor performance, no flickering Nvidia 375.26, Wine 2.0-rc4: poor performance, no flickering
nouveau/mesa 13.0.3, Wine Staging 2.0-rc4 (CSMT=off): good performance, no flickering Nvidia 375.26, Wine Staging 2.0-rc4 (CSMT=off): good performance, *flickering* nouveau/mesa 13.0.3, Wine Staging 2.0-rc4 (CSMT=on): good performance, no flickering Nvidia 375.26, Wine Staging 2.0-rc4 (CSMT=on): good performance, no flickering
https://bugs.winehq.org/show_bug.cgi?id=41653
Wylda wylda@volny.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |wylda@volny.cz
https://bugs.winehq.org/show_bug.cgi?id=41653
Béla Gyebrószki gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |spleefer90@gmail.com
--- Comment #14 from Béla Gyebrószki gyebro69@gmail.com --- *** Bug 42250 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=41653
Oleksandr Senkovych bjsenya@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bjsenya@gmail.com
--- Comment #15 from Oleksandr Senkovych bjsenya@gmail.com --- I've managed Baner Saga to work fine on wine-2.21 (Staging) with csmt=1 without any flickering and with good performance on Nvidia drivers.
https://bugs.winehq.org/show_bug.cgi?id=41653
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=41653
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #16 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-5.10?
https://bugs.winehq.org/show_bug.cgi?id=41653
--- Comment #17 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with plain wine-7.0-rc1?