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

[x86_64][DRI2]Multiple applications are crashing on swapchain creation, was "Guild Wars 2 64 bit client crash" #183

Closed bniels707 closed 7 years ago

bniels707 commented 8 years ago

The Guild Wars 2 64 bit client (direct download link) crashes after signing into the launcher and trying to launch the game.

This does not happen with vanilla wine64, or when running the 32 bit client with wine32 and native d3d9 enabled.

I don't see anything interesting in the wine debug output, but I'm attaching it anyway: Gw2-64_d3d9_crash.txt

I don't see anything interesting in system logs either.

This is on Fedora 23, kernel 4.3.3, Mesa 11.1.0, LLVM 3.7.0, commit cf5b0c16939ce8d782019a8e0ba0c4c61202a09f of the iXit wine repo.

sarnex commented 8 years ago

In general we don't really support 64 bit wine.

But, if you send logs from mesa built with --enable-debug and then run the game with NINE_DEBUG=all wine game.exe and post the output, we can try and see what's happening.

siro20 commented 8 years ago

Tested on ixit/wine cf5b0c16939ce8d782019a8e0ba0c4c61202a09f (wine 1.9.1) shared WoW + ixit/Mesa: The 64bit version runs, but the game is a little bit slower than the 32bit version. Might be due to -O0, which is required to get wine 64bit running on gcc 5.1. @sarnex: There should be no difference in running 32bit or 64bit nine.

sarnex commented 8 years ago

@siro20 yes but in the past we've seen 64 bit wine itself be more buggy

bniels707 commented 8 years ago

I'm seeing the same issue using ixit/Mesa. I'll compile with --enable-debug and try to get a useful log. Perhaps its a graphics option that triggers it, or something with gcc 5.3.1.

bniels707 commented 8 years ago

Updated to latest iXit wine repo, still see the issue.

Gw2-64_d3d9_crash_NINE_DEBUG.txt is a log using iXit mesa with --enable-debug and the NINE_DEBUG=all environment variable set. Nothing in there looks fatal to me, but I'm probably missing something.

I've forgot to mention I'm running multiple monitors, if that matters.

siro20 commented 8 years ago

It is failing to make use of the DRI2 presentation backend in d3d9-nine.dll: "Mesa: User error: GL_INVALID_ENUM in glEGLImageTargetTexture2D(target=9728)". The error message doesn't make any sense, as target is never set to 9728...

You can try to use DRI3 presentation backend instead: https://wiki.ixit.cz/d3d9_dri3

axeldavy commented 8 years ago

Are you using DRI_PRIME by any chance ?

bniels707 commented 8 years ago

@siro20 Just tested with DRI3 enabled, 64 bit client works with d3d9-nine / Wine iXit.

You may want to double check the wiki for enabling DRI3, from the radeon manpage:

   Option "DRI3" "boolean"
          Enable the DRI3 extension. The default is off.

I don't see a 'DRI' option.

@axeldavy I'm not using DRI_PRIME

axeldavy commented 8 years ago

Are you using the same versions of Mesa for both 32 and 64 bits ?

bniels707 commented 8 years ago

@axeldavy Tests were done using Mesa 11.1.0. Except for when I explicitly used iXit Mesa with debug enabled to generate the requested log.

axeldavy commented 8 years ago

if same code works on 32 bits (combination wine/Mesa) but not 64 bits (same version combination), it may be compiler bug.

sarnex commented 8 years ago

@bniels707 The wiki is correct, here is my man radeon. It was changed to match the other DDXs a few months ago

Option "DRI" "integer"
              Define the maximum level of DRI to enable. Valid values are 2 for DRI2 or 3 for DRI3.  The
              default is 2 for DRI2.
siro20 commented 8 years ago

I tested 64bit Guild Wars 2 using nine: DRI3: the game runs fine. DRI2: the game doesn't start and the error "Mesa: User error: GL_INVALID_ENUM in glEGLImageTargetTexture2D(target=9728)" is printed. There's likely something wrong in our code or EGL on x64.

axeldavy commented 8 years ago

siro, Has it been fixed ?

siro20 commented 8 years ago

bug is still present in ixit-wine/wine-1.9.8 and ixit-mesa/88bfafe8d0a28395aae2d549eb2b2e33ab51755e using DRI_PRIME=1 and DRI2 fallback.

As the value passed depends on the last function call made prior to glEGLImageTargetTexture2D it's likely a compiler bug, or something trashes the stack

siro20 commented 8 years ago

seems to be related to eglMakeCurrent. Not only glEGLImageTargetTexture2D but other functions have problems with wrong arguments after calling eglMakeCurrent. Commenting eglMakeCurrent fixes this issue, but causes d3d9-nine to crash in another place.

siro20 commented 8 years ago

Affected applications: Guild Wars x64 Crysis Warhead x64 Planetside 2 x64

All applications are working when using DRI3. After eglMakeCurrent the function calls to egl* are broken.

siro20 commented 8 years ago

Finally found the problem. glEGLImageTargetTexture2D has APIENTRY in it's function prototype. Due to wine headers it's set to ms_abi. ms_abi on x64 doesn't match unix ABI and thus we were calling into libGL with wrong stack causing all arguments to be wrong.

axeldavy commented 8 years ago

see with wine devs what is the fix, they likely have the same issue elsewhere, and may (or may not) have solved it.

siro20 commented 8 years ago

They do not use GL/gl.h. It looks like they are using GLX with custom headers. Not sure if we should link against opengl32, too.

siro20 commented 7 years ago

Fixed in wine commit "d3d9-nine: Fix includes to prevent ABI mismatch"