jp7677 / dxvk-nvapi

Alternative NVAPI implementation on top of DXVK.
MIT License
365 stars 32 forks source link

[Games Broken] Must report a newer NVIDIA driver version #67

Closed Arcitec closed 2 years ago

Arcitec commented 2 years ago

This is an issue in either DXVK or DXVK-NVAPI. Most likely NVAPI, so I'll only report the issue here. Let me know if it should be reported to DXVK instead.

It seems like the API is NvAPI_SYS_GetDriverAndBranchVersion.

We respond with 337.88 which is a driver from mid-2014. Some modern games such as Battlefield 5 and Star Wars Battlefront 2 say "hell naw, that's too old". The games then refuse to run. This error box is from Battlefield 5:

Screenshot from 2022-01-19 17-17-24

Proposed solutions/ideas from best to worst:

References for some previous mentions of the "driver 337.88" issue:

Arcitec commented 2 years ago

Before it's mentioned, I found that it seems to look up the driver version here:

https://github.com/jp7677/dxvk-nvapi/blob/2a4ebbd6ae03e20d7383bd2bdf9e7896d0500c16/src/nvapi_sys.cpp#L24

I'm playing through the Bottles flatpak which uses sandboxed drivers, but their version matches my system drivers, so I am unsure if this is the cause of the ancient version being reported. Besides, there are plenty of reports of this exact version number (337.88) online so it seems like it's hardcoded in DXVK or DXVK-NVAPI...

Either way this is my full list of flatpaks:

flatpak list
Name                                            Application ID                                                Version                     Branch          Installation
Ferdi                                           com.getferdi.Ferdi                                            5.7.0                       stable          system
Flatseal                                        com.github.tchx84.Flatseal                                    1.7.5                       stable          system
Stremio                                         com.stremio.Stremio                                           4.4.142                     stable          system
Bottles                                         com.usebottles.bottles                                        2022.1.14-trento-4          stable          system
Boop-GTK                                        fyi.zoey.Boop-GTK                                             1.6.0                       stable          system
Freedesktop Platform                            org.freedesktop.Platform                                      20.08.17                    20.08           system
Freedesktop Platform                            org.freedesktop.Platform                                      21.08.9                     21.08           system
Mesa                                            org.freedesktop.Platform.GL.default                           21.1.8                      20.08           system
Mesa                                            org.freedesktop.Platform.GL.default                           21.3.3                      21.08           system
nvidia-495-44                                   org.freedesktop.Platform.GL.nvidia-495-44                                                 1.4             system
nvidia-495-46                                   org.freedesktop.Platform.GL.nvidia-495-46                                                 1.4             system
default                                         org.freedesktop.Platform.GL32.default                                                     21.08           system
nvidia-495-44                                   org.freedesktop.Platform.GL32.nvidia-495-44                                               1.4             system
nvidia-495-46                                   org.freedesktop.Platform.GL32.nvidia-495-46                                               1.4             system
openh264                                        org.freedesktop.Platform.openh264                             2.1.0                       2.0             system
GNOME Application Platform version 41           org.gnome.Platform                                                                        41              system
i386                                            org.gnome.Platform.Compat.i386                                                            41              system
Adwaita theme                                   org.kde.KStyle.Adwaita                                                                    5.14            system
Adwaita theme                                   org.kde.KStyle.Adwaita                                                                    5.15            system
KDE Application Platform                        org.kde.Platform                                                                          5.14            system
KDE Application Platform                        org.kde.Platform                                                                          5.15            system
QGnomePlatform                                  org.kde.PlatformTheme.QGnomePlatform                                                      5.14            system
QGnomePlatform                                  org.kde.PlatformTheme.QGnomePlatform                                                      5.15            system
QtSNI                                           org.kde.PlatformTheme.QtSNI                                                               5.14            system
QtSNI                                           org.kde.PlatformTheme.QtSNI                                                               5.15            system
QGnomePlatform-decoration                       org.kde.WaylandDecoration.QGnomePlatform-decoration                                       5.14            system
QGnomePlatform-decoration                       org.kde.WaylandDecoration.QGnomePlatform-decoration                                       5.15            system
jp7677 commented 2 years ago

You are not using DXVK-NVAPI, but the NVAPI implementation from Wine-Staging. See here: https://github.com/wine-staging/wine-staging/blob/master/patches/nvapi-Stub_DLL/0009-nvapi-Add-stub-for-NvAPI_SYS_GetDriverAndBranchVersi.patch#L21 , this is exactly the (hardcoded) driver version in your screenshot. So either report this to wine-staging, or just use DXVK-NVAPI, which correctly reads the driver version from the installed driver.

Arcitec commented 2 years ago

@jp7677 Thanks a lot for clearing that up!

I'll have to talk to @mirkobrombin about this. I'm using Bottles with DXVK-NVAPI v0.5.1, and the "Enable DLSS/NVAPI" checkbox enabled. So this seems to be a bug in how Bottles installs NVAPI, since you showed that it's using the built-in NVAPI in Wine instead of DXVK-NVAPI!

image

image

jp7677 commented 2 years ago

Thanks for providing those screenshots. I'm not familiar with Bottles, this helps to get some context. ~My guess is that the WINEDLLOVERRIDES are not set, see https://github.com/jp7677/dxvk-nvapi#wine .~

Arcitec commented 2 years ago

@jp7677 Yeah I thought the same about DLL overrides, so I ensured they were set in winecfg. But it still loads Wine-Staging's NVAPI instead of your native DLL. Hopefully mirko can figure it out. Perhaps the path to your DLLs isn't being set properly by Bottles.

mirkobrombin commented 2 years ago

According to this the only thing is not doing is setting the DLL override for dxgi https://github.com/bottlesdevs/Bottles/blob/b31d6da442c200a12c673da71bbe410d5593368a/src/backend/runner.py#L429 can you try setting it in from DLL Overrides in bottle's preferences?

jp7677 commented 2 years ago

@mirkobrombin DXVK-NVAPI does indeed need dxgi from DXVK for operating correctly, but not having that wouldn't prevent nvapi64.dll from DXVK-NAPI being loaded. So you'll need that override, but I think that's not (yet) the issue here. Looking at the wine logs with wine debug channel +loaddll should be a good start for seeing which dll's are attempted to load and actually being loaded by Wine.

Arcitec commented 2 years ago

@mirkobrombin I checked. dxgi (native, builtin) was already listed in winecfg. I don't think I've added it manually so it was probably enabled by vkd3d or dxvk packages in Bottles.

@jp7677 I will try with the WINEDEBUG=+loaddll env now.

mirkobrombin commented 2 years ago

@mirkobrombin DXVK-NVAPI does indeed need dxgi from DXVK for operating correctly, but not having that wouldn't prevent nvapi64.dll from DXVK-NAPI being loaded. So you'll need that override, but I think that's not (yet) the issue here. Looking at the wine logs with wine debug channel +loaddll should be a good start for seeing which dll's are attempted to load and actually being loaded by Wine.

Good tip. I'm not able to do this right now, I hope someone will help me with this :D

Arcitec commented 2 years ago

@mirkobrombin Okay:

08a4:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\nvapi64.dll" at 000000021B3F0000: native

But the thing is, that the DLL is now successfully loading. After I've done a ton of switching of Wine Runner (I am back on caffe-7.0 which is what failed originally). And a ton of switching of the dxvk-nvapi setting from 0.5.1 to 0.4 to 0.5.1 again to try to make Wine register it properly. So sometime during all this, I've managed to make it work.

And I think I know exactly what made it work...

  1. During one of the earlier tests, I noted that nvapi64 was not registered as native when using an older Wine Runner, and that I had to manually register it: https://github.com/bottlesdevs/Bottles/issues/951#issuecomment-1016786718
  2. This is 99% certainly what fixed it for caffe-7.0 too. I did check my list of registered DLLs when I just used caffe-7.0 originally, and I think I saw that nvapi64 was registered. Then I switched to an older wine runner, looked at winecfg and noticed that nvapi64 was missing, and manually added it there. Now caffe-7.0 works too. So apparently it wasn't properly registered until I manually added it on an older wine runtime. Weird.
  3. So it seems like there's an issue in bottles where it doesn't always register nvapi64. Perhaps it's an issue in caffe-7.0 where DLL overrides may not always register?
mirkobrombin commented 2 years ago

@mirkobrombin Okay:

08a4:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\nvapi64.dll" at 000000021B3F0000: native

But the thing is, that the DLL is now successfully loading. After I've done a ton of switching of Wine Runner (I am back on caffe-7.0 which is what failed originally). And a ton of switching of the dxvk-nvapi setting from 0.5.1 to 0.4 to 0.5.1 again to try to make Wine register it properly. So sometime during all this, I've managed to make it work.

And I think I know exactly what made it work...

  1. During one of the earlier tests, I noted that nvapi64 was not registered as native when using an older Wine Runner, and that I had to manually register it: [BUG] Caffe is using Wine-Staging NVAPI instead of DXVK-NVAPI bottlesdevs/Bottles#951 (comment)
  2. This is 99% certainly what fixed it for caffe-7.0 too. I did check my list of registered DLLs when I just used caffe-7.0 originally, and I think I saw that nvapi64 was registered. Then I switched to an older wine runner, looked at winecfg and noticed that nvapi64 was missing, and manually added it there. Now caffe-7.0 works too. So apparently it wasn't properly registered until I manually added it on an older wine runtime. Weird.
  3. So it seems like there's an issue in bottles where it doesn't always register nvapi64. Perhaps it's an issue in caffe-7.0 where DLL overrides may not always register?

So this is actually a Bottles issue

Arcitec commented 2 years ago

Yeah or wine/caffe-7.0 issue. At least it's no issue of DXVK-NVAPI. Thanks a lot for all advice @jp7677 ! :)

jp7677 commented 2 years ago

You are welcome!