updated nvcuda-CUDA_Support patchset

Thanks Sveinar Søpler.
This commit is contained in:
Alistair Leslie-Hughes 2022-01-12 11:33:10 +11:00
parent ee4ca71a7f
commit e1c496b21e
3 changed files with 186 additions and 1 deletions

View File

@ -0,0 +1,95 @@
From af088c1d1c1a5757466f620d981b766184b973b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sveinar=20S=C3=B8pler?= <cybermax@dexter.no>
Date: Tue, 11 Jan 2022 17:25:06 +0100
Subject: [PATCH 1/2] nvcuda: Implement cuDeviceGetUuid and cuDeviceGetLuid
This partially resolves #52342
DAZ Studio4 will fail to initialize cuda if no valid UUID and LUID
is obtained. Linux nvCUDA does not provide a LUID, so this will be
a "fake" LUID for now.
---
dlls/nvcuda/nvcuda.c | 33 +++++++++++++++++++++++++++++++++
dlls/nvcuda/nvcuda.spec | 4 ++--
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/nvcuda/nvcuda.c b/dlls/nvcuda/nvcuda.c
index 5b6bf53a1de..dde0bfa8469 100644
--- a/dlls/nvcuda/nvcuda.c
+++ b/dlls/nvcuda/nvcuda.c
@@ -408,6 +408,9 @@ static CUresult (*pcuStreamQuery_ptsz)(CUstream hStream);
static CUresult (*pcuStreamSynchronize_ptsz)(CUstream hStream);
static CUresult (*pcuStreamWaitEvent_ptsz)(CUstream hStream, CUevent hEvent, unsigned int Flags);
+/* Cuda 10.0 */
+static CUresult (*pcuDeviceGetUuid)(CUuuid *uuid, CUdevice dev);
+static CUresult (*pcuDeviceGetLuid)(char *luid, unsigned int *deviceNodeMask, CUdevice dev);
static void *cuda_handle = NULL;
@@ -758,6 +761,10 @@ static BOOL load_functions(void)
TRY_LOAD_FUNCPTR(cuStreamSynchronize_ptsz);
TRY_LOAD_FUNCPTR(cuStreamWaitEvent_ptsz);
+ /* CUDA 10 */
+ TRY_LOAD_FUNCPTR(cuDeviceGetUuid);
+ TRY_LOAD_FUNCPTR(cuDeviceGetLuid);
+
#undef LOAD_FUNCPTR
#undef TRY_LOAD_FUNCPTR
@@ -2904,6 +2911,32 @@ CUresult WINAPI wine_cuStreamWaitEvent_ptsz(CUstream hStream, CUevent hEvent, un
return pcuStreamWaitEvent_ptsz(hStream, hEvent, Flags);
}
+/*
+ * Additions in CUDA 10.0
+ */
+
+CUresult WINAPI wine_cuDeviceGetUuid(CUuuid *uuid, CUdevice dev)
+{
+ TRACE("(%p, %d)\n", uuid, dev);
+ CHECK_FUNCPTR(cuDeviceGetUuid);
+ return pcuDeviceGetUuid(uuid, dev);
+}
+
+CUresult WINAPI wine_cuDeviceGetLuid(char *luid, unsigned int *deviceNodeMask, CUdevice dev)
+{
+ int wine_luid[] = { 0x0000000e, 0x00000000 };
+
+ TRACE("(%p, %p, %d)\n", luid, deviceNodeMask, dev);
+ CHECK_FUNCPTR(cuDeviceGetLuid);
+ /* Linux native libcuda does not provide a LUID, so we need to fake something and return a success */
+
+ memcpy(luid, &wine_luid, sizeof(wine_luid));
+ FIXME("Fix this LUID: (0x%08x)\n", *luid);
+ *deviceNodeMask = 1;
+
+ return CUDA_SUCCESS;
+}
+
#undef CHECK_FUNCPTR
/*
diff --git a/dlls/nvcuda/nvcuda.spec b/dlls/nvcuda/nvcuda.spec
index 891920b8699..85abf5d2e63 100644
--- a/dlls/nvcuda/nvcuda.spec
+++ b/dlls/nvcuda/nvcuda.spec
@@ -93,12 +93,12 @@
@ stdcall cuDeviceGetAttribute(ptr long long) wine_cuDeviceGetAttribute
@ stdcall cuDeviceGetByPCIBusId(ptr str) wine_cuDeviceGetByPCIBusId
@ stdcall cuDeviceGetCount(ptr) wine_cuDeviceGetCount
-@ stub cuDeviceGetLuid
+@ stdcall cuDeviceGetLuid(ptr ptr long) wine_cuDeviceGetLuid
@ stdcall cuDeviceGetName(ptr long long) wine_cuDeviceGetName
@ stub cuDeviceGetP2PAttribute
@ stdcall cuDeviceGetPCIBusId(ptr long long) wine_cuDeviceGetPCIBusId
@ stdcall cuDeviceGetProperties(ptr long) wine_cuDeviceGetProperties
-@ stub cuDeviceGetUuid
+@ stdcall cuDeviceGetUuid(ptr long) wine_cuDeviceGetUuid
@ stdcall cuDevicePrimaryCtxGetState(long ptr ptr) wine_cuDevicePrimaryCtxGetState
@ stdcall cuDevicePrimaryCtxRelease(long) wine_cuDevicePrimaryCtxRelease
@ stdcall cuDevicePrimaryCtxReset(long) wine_cuDevicePrimaryCtxReset
--
2.34.1

View File

@ -0,0 +1,88 @@
From c81d2443afb5c48bed31a31ad03fde29b8b7d920 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sveinar=20S=C3=B8pler?= <cybermax@dexter.no>
Date: Tue, 11 Jan 2022 17:30:06 +0100
Subject: [PATCH 2/2] nvcuda: Expand the Unknown1 table
This partially resolve #52342
The table for UUID_Unknown1 needs to be expanded because
DAZ Studio4 uses Unknown1_func5 and Unknown1_func6.
This also gets rid of the WARNING about "Your CUDA version supports a
newer interface for Unknown1 then the Wine implementation" when
using recent nVidia proprietary drivers.
---
dlls/nvcuda/internal.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/dlls/nvcuda/internal.c b/dlls/nvcuda/internal.c
index 0b654a967fa..db5f1fd6710 100644
--- a/dlls/nvcuda/internal.c
+++ b/dlls/nvcuda/internal.c
@@ -111,6 +111,10 @@ struct Unknown1_table
void* (WINAPI *func2)(void *param0, void *param1);
void* (WINAPI *func3)(void *param0, void *param1);
void* (WINAPI *func4)(void *param0);
+ void* (WINAPI *func5)(void *param0, void *param1);
+ void* (WINAPI *func6)(void *param0, void *param1);
+ void* (WINAPI *func7)(void *param0, void *param1);
+ void* (WINAPI *func8)(void *param0, void *param1);
};
static const struct
{
@@ -120,6 +124,10 @@ static const struct
void* (*func2)(void *param0, void *param1);
void* (*func3)(void *param0, void *param1);
void* (*func4)(void *param0);
+ void* (*func5)(void *param0, void *param1);
+ void* (*func6)(void *param0, void *param1);
+ void* (*func7)(void *param0, void *param1);
+ void* (*func8)(void *param0, void *param1);
} *Unknown1_orig = NULL;
/*
@@ -233,6 +241,30 @@ static void* WINAPI Unknown1_func4_relay(void *param0)
return Unknown1_orig->func4(param0);
}
+static void* WINAPI Unknown1_func5_relay(void *param0, void *param1)
+{
+ TRACE("(%p, %p)\n", param0, param1);
+ return Unknown1_orig->func5(param0, param1);
+}
+
+static void* WINAPI Unknown1_func6_relay(void *param0, void *param1)
+{
+ TRACE("(%p, %p)\n", param0, param1);
+ return Unknown1_orig->func6(param0, param1);
+}
+
+static void* WINAPI Unknown1_func7_relay(void *param0, void *param1)
+{
+ TRACE("(%p, %p)\n", param0, param1);
+ return Unknown1_orig->func7(param0, param1);
+}
+
+static void* WINAPI Unknown1_func8_relay(void *param0, void *param1)
+{
+ TRACE("(%p, %p)\n", param0, param1);
+ return Unknown1_orig->func8(param0, param1);
+}
+
struct Unknown1_table Unknown1_Impl =
{
sizeof(struct Unknown1_table),
@@ -241,6 +273,10 @@ struct Unknown1_table Unknown1_Impl =
Unknown1_func2_relay,
Unknown1_func3_relay,
Unknown1_func4_relay,
+ Unknown1_func5_relay,
+ Unknown1_func6_relay,
+ Unknown1_func7_relay,
+ Unknown1_func8_relay,
};
static void* WINAPI Unknown2_func0_relay(void *param0, void *param1)
--
2.34.1

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "86eaf7eeb2603d1b13d18e3fe71a615e1ee14cee"
echo "76c9fc8a761c9faff72f97ab508a1afcb28eeb12"
}
# Show version information
@ -2591,6 +2591,8 @@ if test "$enable_nvcuda_CUDA_Support" -eq 1; then
patch_apply nvcuda-CUDA_Support/0011-nvcuda-Add-semi-stub-for-cuD3D10GetDevice.patch
patch_apply nvcuda-CUDA_Support/0012-nvcuda-Add-semi-stub-for-cuD3D11GetDevice-and-cuGrap.patch
patch_apply nvcuda-CUDA_Support/0013-nvcuda-Update-spec-file.patch
patch_apply nvcuda-CUDA_Support/0014-nvcuda-Implement-cuDeviceGetUuid-and-cuDeviceGetLuid.patch
patch_apply nvcuda-CUDA_Support/0015-nvcuda-Expand-the-Unknown1-table.patch
fi
# Patchset nvapi-Stub_DLL