https://bugs.winehq.org/show_bug.cgi?id=55140
Bug ID: 55140 Summary: GPU Caps Viewer 1.60 can crash with Nvidia GPU when additional Nvidia libraries are present Product: Wine Version: 8.9 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: saancreed@gmail.com Regression SHA1: 354a8bb1f4a65bdec052606f2799db9e2907b5b1 Distribution: ---
Created attachment 74704 --> https://bugs.winehq.org/attachment.cgi?id=74704 Backtrace from wine-8.9
A particular setup of GPU Caps Viewer 1.60, when paired together with reimplementations of some Nvidia libraries, crashes in its own code after upgrading Wine to release 8.9 or later. I've bisected this problem to commit 354a8bb1f4a65bdec052606f2799db9e2907b5b1 which can be reverted to make the program function again.
The setup required to reproduce the issue might be quite convoluted, so bear with me:
1. Get a system with Nvidia GPU and their proprietary driver, making sure that 32-bit `libnvidia-ml.so.1` is installed and can be found by `dlopen` 2. Get a build of Wine that includes commit 354a8bb1f4a65bdec052606f2799db9e2907b5b1 and doesn't use experimental wow64 mode and drop wine-nvml into that Wine's libdirs (https://github.com/Saancreed/wine-nvml, see build/install instructions, there are prebuilt binaries on GH Actions) 3. Create a prefix and install into it at least 32-bit versions of: a. DXVK (https://github.com/doitsujin/dxvk) b. DXVK-NVAPI (https://github.com/jp7677/dxvk-nvapi) 4. Get GPU Caps Viewer from https://www.geeks3d.com/dl/show/718, sha256sum of that zip should be fcdd0992fdd36660a7561d6d5a9d3e64e653c7d5cc5cae2856634f6a003ae731. Unzip it somewhere and run `wine GPU_Caps_Viewer.exe`. If everything went right, it should see Nvidia GPU, load NVAPI, then load NVML, make a few NVML calls and cause a segfault after one such call returns.
Attached is the backtrace made with Wine 8.9 from Arch Linux repositories. Unfortunately, the application seems to enter the problematic code path only when all the mentioned libraries are present, which actually suggests another possibility: that this is an application bug that simply went undetected on Windows because there is no 32-bit `nvml.dll` provided by Nvidia. I have no idea if this works on Windows, or if it ever worked at all, but I find it curious that it used to work in Wine (when my wine-nvml wrapper was present) and it doesn't anymore.
https://bugs.winehq.org/show_bug.cgi?id=55140
Alois Schlögl alois.schloegl@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alois.schloegl@gmail.com
--- Comment #1 from Alois Schlögl alois.schloegl@gmail.com --- I can not reproduced this on the following setup:
- wine 8.11 (compiled from source with traditional "shared Wow64" setup) - nvidia-libs (https://github.com/SveSop/nvidia-libs commit 664c8620513e)
nvml.dll is installed and file $WINEPREFIX/drive_c/windows/syswow64/nvml.dll shows PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows
I can start GPU_Caps Viewer 1.60, it shows the nvidia gpus in that machine.
(I do not understand what you mean by "load NVAPI, then load NVML, make a few NVML calls" because this is a GUI-based application).
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #2 from Krzysztof Bogacki saancreed@gmail.com --- Do you also have 32-bit DXVK? That's a requirement for DXVK-NVAPI to work properly. If you do and you can see nvml loaded and used with `WINEDEBUG=+loaddll,+nvml` then you are indeed not affected. If nvml.dll is never loaded or called then you might be missing some prerequisite I must have forgotten about.
(I do not understand what you mean by "load NVAPI, then load NVML, make a few NVML calls" because this is a GUI-based application).
I'm just describing what the application appears to be doing. I'll attach another log in a moment that should hopefully make it obvious what is happening.
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #3 from Krzysztof Bogacki saancreed@gmail.com --- Created attachment 74779 --> https://bugs.winehq.org/attachment.cgi?id=74779 Wine, DXVK, dxvk-nvapi and nvml combined log
Here is a fuller log, made with `DXVK_NVAPI_LOG_LEVEL=info WINEDEBUG=+loaddll,+nvml` that shows nvapi and nvml calls made by the program in question. Note how `nvmlInit_v2` is actually called twice: the first time by dxvk-nvapi which uses it to implement some NVAPI functions and the second time by the application itself.
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #4 from Alois Schlögl alois.schloegl@gmail.com --- Created attachment 74784 --> https://bugs.winehq.org/attachment.cgi?id=74784 log file running DXVK_NVAPI_LOG_LEVEL=info WINEDEBUG=+loaddll,+nvml wine gpu_caps_viewer on wine/8.11 + nvidia-libs
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #5 from Alois Schlögl alois.schloegl@gmail.com --- Comment on attachment 74784 --> https://bugs.winehq.org/attachment.cgi?id=74784 log file running DXVK_NVAPI_LOG_LEVEL=info WINEDEBUG=+loaddll,+nvml wine gpu_caps_viewer on wine/8.11 + nvidia-libs
attached is the log file when running
DXVK_NVAPI_LOG_LEVEL=info WINEDEBUG=+loaddll,+nvml wine gpu_caps_viewer.exe on wine 8.11 + nvidia-libs.
Most important, GPU_CAPS_VIEWER does not crash, and it recognizes the nvidia gpu in my case. So, I can not reproduce this.
I checked also the install nvidia dll's and these are schloegl@myhost:~$ ls -1 .wine/drive_c/windows/sys*/nv* .wine/drive_c/windows/system32/nvapi64.dll .wine/drive_c/windows/system32/nvcuda.dll .wine/drive_c/windows/system32/nvcuvid.dll .wine/drive_c/windows/system32/nvencodeapi64.dll .wine/drive_c/windows/system32/nvoptix.dll .wine/drive_c/windows/syswow64/nvapi.dll .wine/drive_c/windows/syswow64/nvcuda.dll .wine/drive_c/windows/syswow64/nvcuvid.dll .wine/drive_c/windows/syswow64/nvencodeapi.dll .wine/drive_c/windows/syswow64/nvml.dll
However, in my case I do not see that nvmlInit_v2 is called twice. Maybe, the difference is that I compiled everything from source for my platform (using debian11, cuda 11.4.4, nvidia-driver 470.xx, mingw-cross-environment). Using some pre-compiled binaries from some other platform might not work.
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #6 from Krzysztof Bogacki saancreed@gmail.com --- Your attachment doesn't seem to contain your logs :(
Recent versions of DXVK apparently require Nvidia driver 510.47.03 or newer, so 470 might not be enough, but if that's not it then one last thing I can think of would be exporting `DXVK_ENABLE_NVAPI=1` in the environment which, if not done, causes DXVK to report NV GPUs as AMD ones and cause NVAPI to fail to initialize:
info: DXGI: NvAPI workaround enabled, reporting AMD GPU NvAPI_Initialize: NVIDIA or other suitable device not found or initialization failed
So, if the application indeed doesn't attempt to enter its NVML code path on your machine, there's still some difference between our setup and unfortunately I'm running out of ideas why exactly is that the case here.
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #7 from Alois Schlögl alois.schloegl@gmail.com --- Created attachment 74786 --> https://bugs.winehq.org/attachment.cgi?id=74786 log file running DXVK_NVAPI_LOG_LEVEL=info WINEDEBUG=+loaddll,+nvml wine gpu_caps_viewer on wine/8.11 + nvidia-libs
this is now the real log file
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #8 from Krzysztof Bogacki saancreed@gmail.com ---
0024:err:d3d:wined3d_caps_gl_ctx_create Failed to find a suitable pixel format. 0024:err:d3d:wined3d_adapter_gl_init Failed to get a GL context for adapter 02F14108. Creating DXGI Factory (IDXGIFactory1) failed, please ensure that DXVK's dxgi.dll is present
Yup, looks like you are indeed missing DXVK.
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #9 from Alois Schlögl alois.schloegl@gmail.com --- dxgi.dll is in place. I see
$ ls -1 .wine/drive_c/windows/sys*/dxgi.dll .wine/drive_c/windows/system32/dxgi.dll .wine/drive_c/windows/syswow64/dxgi.dll
whether its used, or how to test its usage, I do not know.
https://bugs.winehq.org/show_bug.cgi?id=55140
--- Comment #10 from Krzysztof Bogacki saancreed@gmail.com --- Generally, just following instructions from https://github.com/doitsujin/dxvk#how-to-use should be enough (don't forget to set DLL overrides to native first), although your version of dxvk-nvapi requires DXVK >=2.1 but DXVK >=2.0 requires Nvidia driver >=510.47.03 which could be a problem on Debian 11 (Debian 12 has 525).
Alternatively, you could consider downgrading dxvk-nvapi to release 0.6 which could allow you to try with DXVK 1.x but I'm not sure if that will also cause GPU Caps Viewer to enter the code path on which it will attempt to use NVML. As I said, this is unfortunately quite convoluted.
But if everything goes well, you should see no messages from Wine's d3d channel and a bunch of messages from DXVK instead, like in my log.
https://bugs.winehq.org/show_bug.cgi?id=55140
Sveinar Søpler cybermax@dexter.no changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |cybermax@dexter.no
--- Comment #11 from Sveinar Søpler cybermax@dexter.no --- (In reply to Alois Schlögl from comment #9)
dxgi.dll is in place. I see
$ ls -1 .wine/drive_c/windows/sys*/dxgi.dll .wine/drive_c/windows/system32/dxgi.dll .wine/drive_c/windows/syswow64/dxgi.dll
whether its used, or how to test its usage, I do not know.
dxgi.dll is part of windows D3D setup, so this will exist with WineD3D usage aswell. DXVK is replacing dxgi.dll with its own to make it work with DXVK. This is a prerequisit for DXVK-NVAPI. NVIDIA driver 470 is probably not going to work too well.. time to upgrade.
No change for wine-staging-8.12