iXit / Mesa-3D

Please use official https://gitlab.freedesktop.org/mesa/mesa/ !
https://github.com/iXit/Mesa-3D/wiki
66 stars 13 forks source link

All games hang on startup when nine is enabled #310

Closed mtmkls closed 6 years ago

mtmkls commented 6 years ago

When I do "wine game.exe" the first frame is drawn (it's almost completely black for most games because they like to use a fade-in-from-black effect), and then nothing. No CPU usage, no reaction to anything other than ctrl-c.

When I do "vblank_mode=0 wine game.exe" the game starts, but the memory usage climbs up to several gigabytes in a couple of seconds, and wine crashes. The memory usage remains at that point though, which indicates a memory leak in the kernel. On a second try the memory usage doesn't increase further, but the crash is the same. Backtrace with GTA San Andreas:

wine: Assertion failed at address 0xf7f5eaf9 (thread 0009), starting debugger... Unhandled exception: assertion failed in 32-bit code (0xf7f5eaf9). Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b EIP:f7f5eaf9 ESP:0032f780 EBP:0032f79c EFLAGS:00200246( - -- I Z- -P- ) EAX:00000000 EBX:00000002 ECX:0032f79c EDX:00000000 ESI:00000008 EDI:00000000 Stack dump: 0x0032f780: 0032f79c 00000000 0032f79c f7b565b2 0x0032f790: f7b9c747 0032f7fc 7bcf8200 00000000 0x0032f7a0: 00000000 7bcf8200 7bcf85c7 fd1ae300 0x0032f7b0: 7bcf8200 0032f7fc f7b7184b f7cfe000 0x0032f7c0: 7bcf8200 0032f7fc 0032f89c f7b972d1 0x0032f7d0: 0032f7fc 7efda709 0032f9e0 7bcf8200 Backtrace: =>0 0xf7f5eaf9 kernel_vsyscall+0x9() in [vdso].so (0x0032f79c) 1 0xf7b565b2 gsignal+0xc1() in libc.so.6 (0x0032f79c) 2 0xf7b579c1 abort+0x120() in libc.so.6 (0xf7cfece0) 3 0xf7b4e6ab in libc.so.6 (+0x256aa) (0xf7cfece0) 4 0xf7b4e709 __assert_fail+0x38() in libc.so.6 (0x0032fab8) 5 0x60db7f62 D3DWindowBuffer_create.constprop+0xb1() in d3dadapter9.so.1 (0x0032fab8) 6 0x60dbb7a2 NineSwapChain9_Resize+0x1cf1() in d3dadapter9.so.1 (0x59ae0a90) 7 0x60d36cc8 NineDevice9_Reset+0x97() in d3dadapter9.so.1 (0x0032fba8) 8 0x7efd0b53 in d3d9 (+0x10b52) (0x0032fbd8) 9 0x0082e271 in gta-sa (+0x42e270) (0x0032fc34) 10 0x0054ec22 in gta-sa (+0x14ec21) (0x0032fc48) 11 0x0054f0d1 in gta-sa (+0x14f0d0) (0x0032fc50) 12 0x00637a22 in gta-sa (+0x237a21) (0x0032fc68) 13 0x0077d491 in gta-sa (+0x37d490) (0x0032fe30) 14 0x00858e55 in gta-sa (+0x458e54) (0x0032fec0) 15 0x7b46043c call_process_entry+0xb() in kernel32 (0x0032fed8) 16 0x7b461d52 start_process+0x1b1(entry=<couldn't compute location>, peb=<couldn't compute location>) [/home/miki/SRC/wine/dlls/kernel32/process.c:1099] in kernel32 (0x0032ffd8) 17 0x7b46044a start_process_wrapper+0x9() in kernel32 (0x0032ffec) 0xf7f5eaf9 kernel_vsyscall+0x9 in [vdso].so: popl %ebp

This is what I currently have: Linux 4.15.3, libdrm-radeon 2.4.90, Mesa 17.3.6, xorg 1.19.6, Wine 3.3+Nine. I compiled d3dadapter9.so from Mesa master at 0f0a6fa21dc240fca99a3a110a6c0dfac6d2a376 (2018-03-10); I tried llvm 4.0.1 and 5.0.1, no difference.

BTW the configure.ac part of the Nine patch never applies cleanly to vanilla Wine.

axeldavy commented 6 years ago

Not all games do hang, but all that use lighting. If you wish it to be solved faster, please manifest you have the same issue on my opened bugs: https://bugs.llvm.org/show_bug.cgi?id=36704 https://bugs.freedesktop.org/show_bug.cgi?id=105442

EDIT: hum actually you may have different issue since your entire system doesn't hang.

axeldavy commented 6 years ago

Could you build mesa with --enable-debug and show the result of NINE_DEBUG=all NINE_FF_DUMP=1 wine yourprogram.exe &> mylog ?

mtmkls commented 6 years ago

In your bug reports you refer to llvm 5.0.1, but I also get the hang when I compile d3dadapter9.so with llvm 4.0.1.

Could you please provide an example game that doesn't hang for you? The ones that I tried fall into two mutually exclusive categories:

axeldavy commented 6 years ago

the assert you hit seems to be our check to see if ID3DPresent_NewD3DWindowBufferFromDmaBuf succeeds.

You should have one of the following error printed: DRI2FallbackPRESENTPixmap failed DRI3PixmapFromDmaBuf failed PRESENTPixmapInit failed

mtmkls commented 6 years ago

Here is the log for GTA without vblank_mode=0: gtasa.txt.gz (hangs at first frame)

axeldavy commented 6 years ago

It seems to stop at a different part in your new log. Could you with with csmt_force=0 ?

mtmkls commented 6 years ago

Here is the log for GTA with vblank_mode=0: gtasa_vblank.txt.gz (crashes after a few seconds)

axeldavy commented 6 years ago

the vblank_mode=0 one is weird. It tries again and again and likely exhausts memory or something.

axeldavy commented 6 years ago

I don't know what is the issue, if it is wine or nine.

iiv3 commented 6 years ago

xorg 1.19.6

It might be side effect of https://github.com/iXit/Mesa-3D/issues/300 . While the bug has been fixed in Xorg, there is no new release that contains the fix. Aka no 1.19.7 or 1.20.0 yet. The vblank_mode=0, should workaround this bug. So there might be another issue.

As for the memory usage. Make sure that after crash you do wineserver -k to kill all wine processes. You could also try GALLIUM_HUD, to monitor the GPU memory usage.

BTW, what is your exact video card. Radeon might use r600, radeon si or amdgpu.

FYI. I have Wine-3.3 with sarnex's patches for Nine. It works without issue with GTA-SA and Crysis2. AvP-c seems to have some wine issue and crashes in the launcher, even with wined3d. I'm with R600 driver. I have also compiled my own xorg-server-1.19.6 in order to apply the patch from #300. Before that, some games (e.g. L4D2) would hang on exit, after destroying their window (but still holding few GB of memory).

mtmkls commented 6 years ago

I downgraded xserver-xorg-core from 1.19.6 to 1.19.5 from Ubuntu, and now gta starts up, but when I try to load a game the entire system locks up.

axeldavy commented 6 years ago

Possibly https://bugs.freedesktop.org/show_bug.cgi?id=105613 ?

iiv3 commented 6 years ago

The Fixed Function bug is not triggered with Mesa 17.2 and LLVM 5.0.1, is it? It's also radeon-si/amdgpu issue.

axeldavy commented 6 years ago

yes it is

mtmkls commented 6 years ago

The ff light fix 39240926cd45519f seems to have fixed the system hang (I'm currently on llvm 4.0). It also fixed the lighting issue in San Andreas that I originally intended to report.