3D applications crash/exit on Nvidia 340 driver

Questions about Wine on Linux
Locked
Heisenberg
Newbie
Newbie
Posts: 1
Joined: Fri May 29, 2020 5:09 am

3D applications crash/exit on Nvidia 340 driver

Post by Heisenberg »

I have legacy hardware that only supports Nvidia drivers up to version 340. Under new Wine versions (currently wine-staging 5.8), I have run into an issue.

When I run anything that tries to use graphics acceleration (e.g., a DX9 game), I get an X Error and the application exits:

Code: Select all

00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo GL version             : 3.3.0 NVIDIA 340.108.
00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo GL renderer            : ION/PCIe/SSE2.
00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo GLX version            : 1.4.
00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo Server GLX version     : 1.4.
00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo Server GLX vendor:     : NVIDIA Corporation.
00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo Client GLX version     : 1.4.
00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo Client GLX vendor:     : primus.
00c8:trace:wgl:X11DRV_WineGL_InitOpenglInfo Direct rendering enabled: True
00c8:trace:wgl:init_opengl GLX is up and running error_base = 161

.....

00c8:trace:wgl:glxdrv_wglCreateContext 0x150054 -> 0xb1353a0
00c8:trace:wgl:glxdrv_wglMakeCurrent (0x150054,0xb1353a0)
00c8:trace:wgl:glxdrv_wglMakeCurrent hdc 0x150054 drawable 480001f fmt 0xb133260 ctx 0x7dc14e2c fbconfig 0xef visual id 0x20 drawable type 0x7
00c8:trace:wgl:glxdrv_wglMakeCurrent 0x150054,0xb1353a0 returning 1
00c8:trace:wgl:wglGetProcAddress returning wglCreateContextAttribsARB -> 0x7a8bc200
00c8:trace:wgl:X11DRV_wglCreateContextAttribsARB (0x150054 (nil) 0x308804)
00c8:trace:wgl:X11DRV_wglCreateContextAttribsARB 0x2091 0x4
00c8:trace:wgl:X11DRV_wglCreateContextAttribsARB 0x2092 0x4
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  34 ()
  Value in failed request:  0x0
  Serial number of failed request:  52
  Current serial number in output stream:  53
After hours of debugging, I found that Wine is requesting OpenGL version 4.4, while the maximum my driver can handle appears to be 3.3. The Windows application calls Direct3DCreate9. After some hops through various Wine DLLs and system libs, I end up in glXCreateContextAttribsARB in libGL.so.340 (Nvidia blob). This function calls internal functions in the lib that eventually call XSync, which eventually leads to above X message being displayed (I stopped tracing it there because I don't particularly feel like diving into the mess that is Xorg). The call never returns and there's also no exception, it's as if it calls exit(0).
I've seen Wine code in one of the libraries that checks the return value and then retries with a different OpenGL version, however it doesn't get to do that because of above behavior. I wonder if someone with more experience has some insight into which component is at fault here? Hopefully it's nothing on Nvidia's side, because I doubt they'll fix anything in such an old driver.

A workaround that works for me is to set the MaxVersionGL registry key to 0x30003. I decided to post here anyway, because this was quite frustrating to figure out and there's no indication from the somewhat cryptic X error message that the OpenGL version is at fault.
Locked