https://bugs.winehq.org/show_bug.cgi?id=46805
Bug ID: 46805 Summary: Multiple applications crash when playing sound Product: Wine Version: 4.3 Hardware: x86 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: xaudio2 Assignee: wine-bugs@winehq.org Reporter: zakk@rsdio.com
Created attachment 63826 --> https://bugs.winehq.org/attachment.cgi?id=63826 console output trace+xaudio2
Using the winehq portable 4.3 distribution. 32 bit clean prefix, with d3dx9 installed (required for some games to start).
Multiple games are crashing when they attempt to play the first sound.
(incomplete) list of games: Eschatos Minus Zero DoDonPachi Resurrection Mushihimesama Deathsmiles EXZEAL XIIZeal DeltaZeal
There ARE games where audio works great, and even a few that improved with the move to Faudio in 4.3.
All the stack traces look the same. I've attached an output log with trace+xaudio2
https://bugs.winehq.org/show_bug.cgi?id=46805
Ken Thomases ken@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |flibitijibibo@gmail.com
--- Comment #1 from Ken Thomases ken@codeweavers.com --- This is a crash where FAudio_INTERNAL_GenerateOutput() calls FAudio_INTERNAL_DecodePCM16() and that calls through the FAudio_INTERNAL_Convert_S16_To_F32 function pointer. But that function pointer is NULL.
I suspect the problem is in the FAudio build configuration, since it should have SSE2, but I'm not sure how FAudio_INTERNAL_InitSIMDFunctions() failed to either set it or assert. Is FAudio_assert() sometimes compiled to nothing? If so, it seems bad that FAudio_INTERNAL_InitSIMDFunctions() can be completely ineffective. Should that assert be a compile-time assert to prevent such broken builds?
Ethan, any suggestions?
https://bugs.winehq.org/show_bug.cgi?id=46805
pattietreutel katyaberezyaka@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |katyaberezyaka@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=46805
--- Comment #2 from Ethan Lee flibitijibibo@gmail.com --- Something isn't quite right with the build... on macOS we're guaranteed to have SSE2:
https://github.com/FNA-XNA/FAudio/blob/master/src/FAudio_internal_simd.c#L40
FAudio_assert will get optimized out in release builds, in debug builds we do pop up a message when this gets hit:
https://github.com/FNA-XNA/FAudio/blob/master/src/FAudio_internal_simd.c#L17...
So the issue is most likely SSE2 detection, which looks like this:
https://hg.libsdl.org/SDL/file/c005c49beaa9/src/cpuinfo/SDL_cpuinfo.c#l260 https://hg.libsdl.org/SDL/file/c005c49beaa9/src/cpuinfo/SDL_cpuinfo.c#l211
Not sure why this would fail though... if you can drop it in, here's the FNA build of SDL2 (and FAudio):
http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2
https://bugs.winehq.org/show_bug.cgi?id=46805
Ken Thomases ken@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |michael@fds-team.de
--- Comment #3 from Ken Thomases ken@codeweavers.com --- (In reply to Ethan Lee from comment #2)
Something isn't quite right with the build... on macOS we're guaranteed to have SSE2:
https://github.com/FNA-XNA/FAudio/blob/master/src/FAudio_internal_simd.c#L40
That code checks for __MACOSX__. What are you expecting to have defined that? On my Mac, it's *not* predefined by the compiler. It's not defined by any system header files I can find, either.
That said, I see that even if that preprocessor branch isn't taken, the SSE2 code should still be compiled in (unless -mno-sse or something was specified).
I guess we need to get input from whomever is building FAudio and SDL2 for these Mac packages.
https://bugs.winehq.org/show_bug.cgi?id=46805
--- Comment #4 from Ethan Lee flibitijibibo@gmail.com --- It's a bit roundabout, but the dependency tree is
FAudio_internal_simd.c > FAudio_internal.h > SDL_stdinc.h > SDL_config.h > SDL_platform.h
... which finally defines __MACOSX__:
https://hg.libsdl.org/SDL/file/c005c49beaa9/include/SDL_platform.h#l85
https://bugs.winehq.org/show_bug.cgi?id=46805
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de
--- Comment #5 from Sebastian Lackner sebastian@fds-team.de --- Most likely FAudio was compiled without SSE2 support. All of our packages are cross-compiled on Linux, and unfortunately thats a scenario often not considered / tested very well in build scripts.
@Ethan Lee: I assume we can fix this issue by adding -msse2 to the CFLAGS, however, it seems really unfortunate that there is no warning about this during compile time. Why is there code to define __SSE2__ on __x86_64__, but not for __MACOSX__? What if, for whatever reason, SDL_hasSSE2 retuns false? In my opinion, it shouldn't be possible to build a package without any converter functions.
Note that SSE was correctly detected in the SDL2 build, which also uses cmake:
--- snip --- [...] [23:02:39] -- SSE (Wanted: ON): ON [23:02:39] -- SSE2 (Wanted: ON): ON [23:02:39] -- SSE3 (Wanted: ON): ON [...] --- snip ---
https://bugs.winehq.org/show_bug.cgi?id=46805
--- Comment #6 from Sebastian Lackner sebastian@fds-team.de --- Created attachment 63829 --> https://bugs.winehq.org/attachment.cgi?id=63829 libfaudio compiled with CFLAGS="-msse2"
@Zakk: Could you test if the issue still exists with this version of libfaudio? It should be sufficient to replace the /usr/lib/libFAudio.0.19.03.dylib file included in the Wine package with this one.
https://bugs.winehq.org/show_bug.cgi?id=46805
--- Comment #7 from Zakk zakk@rsdio.com --- the attached -msse2 libfaudio does indeed fix the problem
https://bugs.winehq.org/show_bug.cgi?id=46805
Anthony Jagers noonetinone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |noonetinone@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=46805
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Product|Wine |Packaging Resolution|--- |FIXED Summary|Multiple applications crash |Multiple applications crash |when playing sound |when playing sound (faudio | |built without SSE2) Version|4.3 |unspecified Component|xaudio2 |wine-packages
--- Comment #8 from Sebastian Lackner sebastian@fds-team.de --- I've just pushed new Wine packages (version 4.3-2 available at http://dl.winehq.org/wine-builds/macosx/download.html) that include Faudio built with CFLAGS="-msse2". As usual, the Wine CDN seems pretty slow to me, but I have no influence on that - in a few minutes the packages should hopefully be available at a decent speed. Marking this bug as FIXED, please let me know if you notice any other packaging issues.
@Ethan Lee: I would still recommend to make your code more foolproof: Showing a warning when SSE2 is not correctly detected would be nice. Even without SSE2 enabled, it might be a good idea to have generic fallback functions always compiled in. I don't think saving a few bytes is worth the risk of bugs. ;)
https://bugs.winehq.org/show_bug.cgi?id=46805
Rosanne DiMesio dimesio@earthlink.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Rosanne DiMesio dimesio@earthlink.net --- Closing fixed packaging bug.