Hello, I think that Mesa is compiled with debug mode even if the debug USE flag is disabled. I attach the default mesa-9999 log and you can see this line : "-Wall -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-math-errno -fno-trapping-math -Wno-missing-field-initializers -fPIC -pthread -Werror=pointer-arith -Werror=vla -fvisibility=hidden -O2 -pipe -march=native -MD -MQ 'src/util/src@util@@mesa_util@sta/debug.c.o' -MF 'src/util/src@util@@mesa_util@sta/debug.c.o.d' -o 'src/util/src@util@@mesa_util@sta/debug.c.o' -c ../mesa-9999/src/util/debug.c" This cause a crash when i try to play at Assassin's Creed : Syndicate with Wine-Staging + DXVK. (see https://bugs.freedesktop.org/show_bug.cgi?id=107727) It seems that since Mesa is build with Meson, this line in the ebuild has not effect when debug flag is not enabled : "--buildtype $(usex debug debug plain)" If i modify the ebuild, comment the previous line and add this : " if ! use debug; then emesonargs+=( -D b_ndebug=true ) fi " Mesa is not build with debug mode and my game works correctly. Cheers, Maxime
Created attachment 546186 [details] Mesa-9999 default log with debug enabled by default
Just looked into this, because I was having very bad performance after switching to mesa 18.2 and can confirm the way mesa 18.2 is being built still has DEBUG asserts enabled. I got hinted at this after feedback from doitsujin the DXVK dev see https://github.com/doitsujin/dxvk/issues/629#issuecomment-419711529 Some more info: - There are several `NDEBUG` checks in mesa's codebase, see https://github.com/mesa3d/mesa/search?q=NDEBUG&unscoped_q=NDEBUG - When building with meson -NDEBUG only gets passed when either b_ndebug=true, which it isn't for Mesa 18.2, or when b_ndebug=if-release and buildtype=release (see https://github.com/mesonbuild/meson/blob/0.46/mesonbuild/compilers/compilers.py#L335 for details of the checks it does). I've fixed this locally by applying a patch created from this commit https://github.com/mesa3d/mesa/commit/3824c8e7cda97c3bf856983ea5fb6d696c75fb24#diff-969b60ad3d206fd45c208e266ccfed38L29 which adds b_ndebug=if-release to mesa's meson.build configuration combined with a change to the ebuild that sets the buildtype to release when building with the "debug" USE flag disabled, i.e. --buildtype $(usex debug debug release) instead of --buildtype $(usex debug debug plain) I'm not sure why buildtype plain was being used to be honest, I think if one disables the debug USE flag all debugging options should be disabled. After doing this I'm back to having better/normal performance. P.S. I think the -c ../mesa-9999/src/util/debug.c part is a red-herring, those files are always compiled as part of the util sources https://github.com/mesa3d/mesa/blob/18.2/src/util/Makefile.sources#L9
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d56c8907d201bbe16a196e30e972e83e8db0aa0 commit 3d56c8907d201bbe16a196e30e972e83e8db0aa0 Author: Matt Turner <mattst88@gentoo.org> AuthorDate: 2018-09-11 16:33:40 +0000 Commit: Matt Turner <mattst88@gentoo.org> CommitDate: 2018-09-11 16:36:39 +0000 media-libs/mesa: Enable asserts only with USE=debug Closes: https://bugs.gentoo.org/665450 media-libs/mesa/{mesa-18.2.0.ebuild => mesa-18.2.0-r1.ebuild} | 1 + media-libs/mesa/mesa-9999.ebuild | 1 + 2 files changed, 2 insertions(+)
Thank you very much for the report. I totally missed this! (In reply to Simon from comment #2) > I'm not sure why buildtype plain was being used to be honest, I think if one > disables the debug USE flag all debugging options should be disabled. plain adds no CFLAGS, while the others add various things like -g and -O2. I didn't use b_ndebug=if-release because it requires a newer Meson than we currently require. Thanks again, both of you.
(In reply to Matt Turner from comment #4) > Thank you very much for the report. I totally missed this! > > (In reply to Simon from comment #2) > > I'm not sure why buildtype plain was being used to be honest, I think if one > > disables the debug USE flag all debugging options should be disabled. > > plain adds no CFLAGS, while the others add various things like -g and -O2. > > I didn't use b_ndebug=if-release because it requires a newer Meson than we > currently require. > > Thanks again, both of you. Ah, that makes sense. Just checked the meson sources and they do indeed default to -O3 for buildtype=release (see https://github.com/mesonbuild/meson/blob/3f3ae097d5a0c32b384aa3c2627cd88b66e66ea7/mesonbuild/coredata.py#L370) and they even mention it in their docs (https://github.com/mesonbuild/meson/blob/master/docs/markdown/Quick-guide.md#using-meson-as-a-distro-packager) so it seems like a good idea to use buildtype=plain :) sorry for the noise in that regard. Just had time to check: "b_ndebug" is correctly set and I'm not experiencing the extreme slowdown anymore. Thanks for the quick fix!