dxvk-nvapi: Add to Proton

Add https://github.com/jp7677/dxvk-nvapi as a submodule. dxvk-nvapi will
not be copied into Proton prefixes by default, but instead will be
controlled via the environment variable PROTON_ENABLE_NVAPI. This is
done to avoid any potential adverse effects of the nvapi DLL existing
in cases where an application may require a function that is not
implemented by dxvk-nvapi.

This new functionality can be enabled by setting the following environment
variable to a value of `1`:
    `PROTON_ENABLE_NVAPI`

This functionality is needed in order to support DLSS within Proton.

Reviewed-by: Adam Moss <amoss@nvidia.com>
This commit is contained in:
Liam Middlebrook 2021-05-10 14:27:49 -07:00 committed by Andrew Eikum
parent 3f865b5b5b
commit 1630811474
6 changed files with 59 additions and 0 deletions

3
.gitmodules vendored
View File

@ -31,3 +31,6 @@
[submodule "OpenXR-SDK"]
path = OpenXR-SDK
url = https://github.com/KhronosGroup/OpenXR-SDK
[submodule "dxvk-nvapi"]
path = dxvk-nvapi
url = https://github.com/jp7677/dxvk-nvapi

View File

@ -181,6 +181,14 @@ dxvk: downloads
cp -f $(BUILD_DIR)/dist/dist/lib/wine/dxvk/*.dll /vagrant/dxvk/lib/wine/dxvk/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/dxvk/*.dll /vagrant/dxvk/lib64/wine/dxvk/
dxvk-nvapi: | vagrant_share/dxvk-nvapi/lib/wine/nvapi
dxvk-nvapi: | vagrant_share/dxvk-nvapi/lib64/wine/nvapi
dxvk-nvapi: private SHELL := $(VAGRANT_SHELL)
dxvk-nvapi: downloads
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) dxvk-nvapi && \
cp -f $(BUILD_DIR)/dist/files/lib/wine/nvapi/*.dll /vagrant/dxvk-nvapi/lib/wine/nvapi/ && \
cp -f $(BUILD_DIR)/dist/files/lib64/wine/nvapi/*.dll /vagrant/dxvk-nvapi/lib64/wine/nvapi/
vkd3d-proton: | vagrant_share/vkd3d-proton/lib/wine/vkd3d-proton
vkd3d-proton: | vagrant_share/vkd3d-proton/lib64/wine/vkd3d-proton
vkd3d-proton: private SHELL := $(VAGRANT_SHELL)

View File

@ -315,6 +315,7 @@ the Wine prefix. Removing the option will revert to the previous behavior.
| <tt>noesync</tt> | <tt>PROTON_NO_ESYNC</tt> | Do not use eventfd-based in-process synchronization primitives. |
| <tt>nofsync</tt> | <tt>PROTON_NO_FSYNC</tt> | Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no `FUTEX_WAIT_MULTIPLE` support.) |
| <tt>noxim</tt> | <tt>PROTON_NO_XIM</tt> | Enabled by default. Do not attempt to use XIM (X Input Methods) support. XIM support is known to cause crashes with libx11 older than version 1.7. |
| <tt>enablenvapi</tt> | <tt>PROTON_ENABLE_NVAPI</tt> | Enable NVIDIA's NVAPI GPU support library. |
| <tt>nativevulkanloader</tt> | | Use the Vulkan loader shipped with the game instead of Proton's built-in Vulkan loader. This breaks VR support, but is required by a few games. |
| <tt>forcelgadd</tt> | <tt>PROTON_FORCE_LARGE_ADDRESS_AWARE</tt> | Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default. |
| <tt>heapdelayfree</tt>| <tt>PROTON_HEAP_DELAY_FREE</tt>| Delay freeing some memory, to work around application use-after-free bugs. |

View File

@ -744,6 +744,32 @@ $(OBJ)/.dxvk-post-build32:
touch $@
##
## dxvk-nvapi
##
DXVK_NVAPI_MESON_ARGS32 = \
--bindir=$(DXVK_NVAPI_DST32)/lib/wine/nvapi \
--cross-file=$(DXVK_NVAPI_OBJ32)/build-win32.txt
DXVK_NVAPI_MESON_ARGS64 = \
--bindir=$(DXVK_NVAPI_DST64)/lib64/wine/nvapi \
--cross-file=$(DXVK_NVAPI_OBJ64)/build-win64.txt
$(eval $(call rules-source,dxvk-nvapi,$(SRCDIR)/dxvk-nvapi))
$(eval $(call rules-meson,dxvk-nvapi,32))
$(eval $(call rules-meson,dxvk-nvapi,64))
$(OBJ)/.dxvk-nvapi-post-build64:
mkdir -p "$(DST_DIR)"/lib64/wine/nvapi
rm -f "$(DST_DIR)"/lib64/wine/nvapi/version && if test -e $(SRCDIR)/.git; then ( cd $(SRCDIR) && git submodule status -- dxvk-nvapi ) > "$(DST_DIR)"/lib64/wine/nvapi/version; fi
touch $@
$(OBJ)/.dxvk-nvapi-post-build32:
mkdir -p "$(DST_DIR)"/lib/wine/nvapi
rm -f "$(DST_DIR)"/lib/wine/nvapi/version && if test -e $(SRCDIR)/.git; then ( cd $(SRCDIR) && git submodule status -- dxvk-nvapi ) > "$(DST_DIR)"/lib/wine/nvapi/version; fi
touch $@
##
## vkd3d-proton
##

1
dxvk-nvapi Submodule

@ -0,0 +1 @@
Subproject commit 8b3987f6707946b9202eda3dda38632197d2286b

20
proton
View File

@ -550,6 +550,7 @@ class CompatData:
use_wined3d = "wined3d" in g_session.compat_config
use_dxvk_dxgi = not use_wined3d and \
not ("WINEDLLOVERRIDES" in g_session.env and "dxgi=b" in g_session.env["WINEDLLOVERRIDES"])
use_nvapi = 'enablenvapi' in g_session.compat_config
builtin_dll_copy = os.environ.get("PROTON_DLL_COPY",
#dxsetup redist
@ -594,6 +595,7 @@ class CompatData:
str(use_wined3d),
str(use_dxvk_dxgi),
builtin_dll_copy,
str(use_nvapi),
))
# check whether any prefix config has changed
@ -686,6 +688,23 @@ class CompatData:
self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
g_session.dlloverrides[f] = "n"
# If the user requested the NVAPI be available, copy it into place.
# If they didn't, clean up any stray nvapi DLLs.
if use_nvapi:
try_copy(g_proton.lib64_dir + "wine/nvapi/nvapi64.dll",
self.prefix_dir + "drive_c/windows/system32/nvapi64.dll")
try_copy(g_proton.lib_dir + "wine/nvapi/nvapi.dll",
self.prefix_dir + "drive_c/windows/syswow64/nvapi.dll")
g_session.dlloverrides["nvapi64"] = "n"
g_session.dlloverrides["nvapi"] = "n"
else:
nvapi64_dll = self.prefix_dir + "drive_c/windows/system32/nvapi64.dll"
nvapi32_dll = self.prefix_dir + "drive_c/windows/syswow64/nvapi.dll"
if os.path.exists(nvapi64_dll):
os.unlink(nvapi64_dll)
if os.path.exists(nvapi32_dll):
os.unlink(nvapi32_dll)
try_copy(g_proton.lib64_dir + "wine/vkd3d-proton/d3d12.dll",
self.prefix_dir + "drive_c/windows/system32/d3d12.dll")
try_copy(g_proton.lib_dir + "wine/vkd3d-proton/d3d12.dll",
@ -870,6 +889,7 @@ class Session:
self.check_environment("PROTON_SET_GAME_DRIVE", "gamedrive")
self.check_environment("PROTON_NO_XIM", "noxim")
self.check_environment("PROTON_HEAP_DELAY_FREE", "heapdelayfree")
self.check_environment("PROTON_ENABLE_NVAPI", "enablenvapi")
if "noesync" in self.compat_config:
self.env.pop("WINEESYNC", "")