mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Added patches to implement some further NVAPI stubs.
This commit is contained in:
parent
d78dc772d6
commit
8fb3cd2056
@ -0,0 +1,75 @@
|
||||
From 4f86b6cc532f3381aafcd1e3b24206e2a3611f86 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 27 Jun 2017 00:24:24 +0200
|
||||
Subject: nvapi: Improve NvAPI_D3D_GetCurrentSLIState.
|
||||
|
||||
---
|
||||
dlls/nvapi/nvapi.c | 17 +++++++++++++++--
|
||||
include/nvapi.h | 20 ++++++++++++++++++--
|
||||
2 files changed, 33 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index 545bb5aa47f..ad17354c140 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -544,10 +544,23 @@ static NvAPI_Status CDECL NvAPI_D3D_GetCurrentSLIState(IUnknown *pDevice, NV_GET
|
||||
if (!pDevice || !pSliState)
|
||||
return NVAPI_INVALID_ARGUMENT;
|
||||
|
||||
- if (pSliState->version != NV_GET_CURRENT_SLI_STATE_VER)
|
||||
+ if (pSliState->version != NV_GET_CURRENT_SLI_STATE_VER1 &&
|
||||
+ pSliState->version != NV_GET_CURRENT_SLI_STATE_VER2)
|
||||
return NVAPI_INCOMPATIBLE_STRUCT_VERSION;
|
||||
|
||||
- return NVAPI_NO_ACTIVE_SLI_TOPOLOGY;
|
||||
+ /* Simulate single GPU */
|
||||
+ pSliState->maxNumAFRGroups = 1;
|
||||
+ pSliState->numAFRGroups = 1;
|
||||
+ pSliState->currentAFRIndex = 0;
|
||||
+ pSliState->nextFrameAFRIndex = 0;
|
||||
+ pSliState->previousFrameAFRIndex = 0;
|
||||
+ pSliState->bIsCurAFRGroupNew = FALSE;
|
||||
+
|
||||
+ /* No VR SLI */
|
||||
+ if (pSliState->version == NV_GET_CURRENT_SLI_STATE_VER2)
|
||||
+ pSliState->numVRSLIGpus = 0;
|
||||
+
|
||||
+ return NVAPI_OK;
|
||||
}
|
||||
|
||||
static NvAPI_Status CDECL NvAPI_GetLogicalGPUFromDisplay(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU)
|
||||
diff --git a/include/nvapi.h b/include/nvapi.h
|
||||
index ca95a1ac5ee..2cb4ed31f2b 100644
|
||||
--- a/include/nvapi.h
|
||||
+++ b/include/nvapi.h
|
||||
@@ -77,9 +77,25 @@ typedef struct
|
||||
NvU32 nextFrameAFRIndex;
|
||||
NvU32 previousFrameAFRIndex;
|
||||
NvU32 bIsCurAFRGroupNew;
|
||||
-} NV_GET_CURRENT_SLI_STATE;
|
||||
+} NV_GET_CURRENT_SLI_STATE_V1;
|
||||
|
||||
-#define NV_GET_CURRENT_SLI_STATE_VER MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE, 1)
|
||||
+typedef struct
|
||||
+{
|
||||
+ NvU32 version;
|
||||
+ NvU32 maxNumAFRGroups;
|
||||
+ NvU32 numAFRGroups;
|
||||
+ NvU32 currentAFRIndex;
|
||||
+ NvU32 nextFrameAFRIndex;
|
||||
+ NvU32 previousFrameAFRIndex;
|
||||
+ NvU32 bIsCurAFRGroupNew;
|
||||
+ NvU32 numVRSLIGpus;
|
||||
+} NV_GET_CURRENT_SLI_STATE_V2;
|
||||
+
|
||||
+#define NV_GET_CURRENT_SLI_STATE_VER1 MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE_V1, 1)
|
||||
+#define NV_GET_CURRENT_SLI_STATE_VER2 MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE_V2, 1)
|
||||
+
|
||||
+#define NV_GET_CURRENT_SLI_STATE_VER NV_GET_CURRENT_SLI_STATE_VER2
|
||||
+#define NV_GET_CURRENT_SLI_STATE NV_GET_CURRENT_SLI_STATE_V2
|
||||
|
||||
/* undocumented stuff */
|
||||
typedef struct
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,143 @@
|
||||
From c4367b30ff8b1acb3e8fcbe027a749313d5a2d91 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 27 Jun 2017 00:28:03 +0200
|
||||
Subject: nvapi: Implement NvAPI_GPU_Get{Physical,Virtual}FrameBufferSize.
|
||||
|
||||
---
|
||||
dlls/nvapi/Makefile.in | 1 +
|
||||
dlls/nvapi/nvapi.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/nvapi64/Makefile.in | 1 +
|
||||
3 files changed, 77 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/nvapi/Makefile.in b/dlls/nvapi/Makefile.in
|
||||
index 606177f1f8b..6341254d9f6 100644
|
||||
--- a/dlls/nvapi/Makefile.in
|
||||
+++ b/dlls/nvapi/Makefile.in
|
||||
@@ -1,4 +1,5 @@
|
||||
MODULE = nvapi.dll
|
||||
+IMPORTS = wined3d
|
||||
|
||||
C_SRCS = \
|
||||
nvapi.c
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index ad17354c140..372ae359ded 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
+#define COBJMACROS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winternl.h"
|
||||
@@ -29,6 +30,8 @@
|
||||
#include "nvapi.h"
|
||||
#include "d3d9.h"
|
||||
|
||||
+#include "wine/wined3d.h"
|
||||
+
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(nvapi);
|
||||
|
||||
#define FAKE_PHYSICAL_GPU ((NvPhysicalGpuHandle)0xdead0001)
|
||||
@@ -589,6 +592,75 @@ static NvAPI_Status CDECL NvAPI_D3D9_RegisterResource(IDirect3DResource9* pResou
|
||||
return NVAPI_ERROR;
|
||||
}
|
||||
|
||||
+static NvU32 get_video_memory(void)
|
||||
+{
|
||||
+ static NvU32 cache;
|
||||
+ struct wined3d_adapter_identifier identifier;
|
||||
+ struct wined3d *wined3d;
|
||||
+ HRESULT hr = E_FAIL;
|
||||
+
|
||||
+ if (cache) return cache;
|
||||
+
|
||||
+ memset(&identifier, 0, sizeof(identifier));
|
||||
+
|
||||
+ wined3d_mutex_lock();
|
||||
+ wined3d = wined3d_create(0);
|
||||
+ if (wined3d)
|
||||
+ {
|
||||
+ hr = wined3d_get_adapter_identifier(wined3d, 0, 0, &identifier);
|
||||
+ wined3d_decref(wined3d);
|
||||
+ }
|
||||
+ wined3d_mutex_unlock();
|
||||
+
|
||||
+ if (SUCCEEDED(hr))
|
||||
+ {
|
||||
+ cache = identifier.video_memory / 1024;
|
||||
+ return cache;
|
||||
+ }
|
||||
+
|
||||
+ return 1024 * 1024; /* fallback: 1GB */
|
||||
+}
|
||||
+
|
||||
+static NvAPI_Status CDECL NvAPI_GPU_GetPhysicalFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pSize)
|
||||
+{
|
||||
+ TRACE("(%p, %p)\n", hPhysicalGpu, pSize);
|
||||
+
|
||||
+ if (!hPhysicalGpu)
|
||||
+ return NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE;
|
||||
+
|
||||
+ if (hPhysicalGpu != FAKE_PHYSICAL_GPU)
|
||||
+ {
|
||||
+ FIXME("invalid handle: %p\n", hPhysicalGpu);
|
||||
+ return NVAPI_INVALID_HANDLE;
|
||||
+ }
|
||||
+
|
||||
+ if (!pSize)
|
||||
+ return NVAPI_INVALID_ARGUMENT;
|
||||
+
|
||||
+ *pSize = get_video_memory();
|
||||
+ return NVAPI_OK;
|
||||
+}
|
||||
+
|
||||
+static NvAPI_Status CDECL NvAPI_GPU_GetVirtualFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pSize)
|
||||
+{
|
||||
+ TRACE("(%p, %p)\n", hPhysicalGpu, pSize);
|
||||
+
|
||||
+ if (!hPhysicalGpu)
|
||||
+ return NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE;
|
||||
+
|
||||
+ if (hPhysicalGpu != FAKE_PHYSICAL_GPU)
|
||||
+ {
|
||||
+ FIXME("invalid handle: %p\n", hPhysicalGpu);
|
||||
+ return NVAPI_INVALID_HANDLE;
|
||||
+ }
|
||||
+
|
||||
+ if (!pSize)
|
||||
+ return NVAPI_INVALID_ARGUMENT;
|
||||
+
|
||||
+ *pSize = get_video_memory();
|
||||
+ return NVAPI_OK;
|
||||
+}
|
||||
+
|
||||
void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{
|
||||
static const struct
|
||||
@@ -630,7 +702,9 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{0x4b708b54, NvAPI_D3D_GetCurrentSLIState},
|
||||
{0xee1370cf, NvAPI_GetLogicalGPUFromDisplay},
|
||||
{0xfceac864, NvAPI_D3D_GetObjectHandleForResource},
|
||||
- {0xa064bdfc, NvAPI_D3D9_RegisterResource}
|
||||
+ {0xa064bdfc, NvAPI_D3D9_RegisterResource},
|
||||
+ {0x46fbeb03, NvAPI_GPU_GetPhysicalFrameBufferSize},
|
||||
+ {0x5a04b644, NvAPI_GPU_GetVirtualFrameBufferSize},
|
||||
};
|
||||
unsigned int i;
|
||||
TRACE("(%x)\n", offset);
|
||||
diff --git a/dlls/nvapi64/Makefile.in b/dlls/nvapi64/Makefile.in
|
||||
index 80e2d6bfb20..04bd0cf1c46 100644
|
||||
--- a/dlls/nvapi64/Makefile.in
|
||||
+++ b/dlls/nvapi64/Makefile.in
|
||||
@@ -1,5 +1,6 @@
|
||||
MODULE = nvapi64.dll
|
||||
PARENTSRC = ../nvapi
|
||||
+IMPORTS = wined3d
|
||||
|
||||
C_SRCS = \
|
||||
nvapi.c
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,51 @@
|
||||
From a70ccecd38d52576818ce899d8c16e8d940de86a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 27 Jun 2017 00:28:59 +0200
|
||||
Subject: nvapi: Add stub for NvAPI_GPU_GetGpuCoreCount.
|
||||
|
||||
---
|
||||
dlls/nvapi/nvapi.c | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index 372ae359ded..12ddb0d871f 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -661,6 +661,26 @@ static NvAPI_Status CDECL NvAPI_GPU_GetVirtualFrameBufferSize(NvPhysicalGpuHandl
|
||||
return NVAPI_OK;
|
||||
}
|
||||
|
||||
+static NvAPI_Status CDECL NvAPI_GPU_GetGpuCoreCount(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pCount)
|
||||
+{
|
||||
+ TRACE("(%p, %p)\n", hPhysicalGpu, pCount);
|
||||
+
|
||||
+ if (!hPhysicalGpu)
|
||||
+ return NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE;
|
||||
+
|
||||
+ if (hPhysicalGpu != FAKE_PHYSICAL_GPU)
|
||||
+ {
|
||||
+ FIXME("invalid handle: %p\n", hPhysicalGpu);
|
||||
+ return NVAPI_INVALID_HANDLE;
|
||||
+ }
|
||||
+
|
||||
+ if (!pCount)
|
||||
+ return NVAPI_INVALID_ARGUMENT;
|
||||
+
|
||||
+ *pCount = 1;
|
||||
+ return NVAPI_OK;
|
||||
+}
|
||||
+
|
||||
void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{
|
||||
static const struct
|
||||
@@ -705,6 +725,7 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{0xa064bdfc, NvAPI_D3D9_RegisterResource},
|
||||
{0x46fbeb03, NvAPI_GPU_GetPhysicalFrameBufferSize},
|
||||
{0x5a04b644, NvAPI_GPU_GetVirtualFrameBufferSize},
|
||||
+ {0xc7026a87, NvAPI_GPU_GetGpuCoreCount},
|
||||
};
|
||||
unsigned int i;
|
||||
TRACE("(%x)\n", offset);
|
||||
--
|
||||
2.13.1
|
||||
|
@ -6583,6 +6583,9 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then
|
||||
patch_apply nvapi-Stub_DLL/0014-nvapi-Add-stub-for-NvAPI_GetLogicalGPUFromDisplay.patch
|
||||
patch_apply nvapi-Stub_DLL/0015-nvapi-Add-stub-for-NvAPI_D3D_GetObjectHandleForResou.patch
|
||||
patch_apply nvapi-Stub_DLL/0016-nvapi-Add-stub-for-NvAPI_D3D9_RegisterResource.patch
|
||||
patch_apply nvapi-Stub_DLL/0017-nvapi-Improve-NvAPI_D3D_GetCurrentSLIState.patch
|
||||
patch_apply nvapi-Stub_DLL/0018-nvapi-Implement-NvAPI_GPU_Get-Physical-Virtual-Frame.patch
|
||||
patch_apply nvapi-Stub_DLL/0019-nvapi-Add-stub-for-NvAPI_GPU_GetGpuCoreCount.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: First implementation.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Add stubs for NvAPI_EnumLogicalGPUs and undocumented equivalent.", 1 },';
|
||||
@ -6600,6 +6603,9 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Add stub for NvAPI_GetLogicalGPUFromDisplay.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Add stub for NvAPI_D3D_GetObjectHandleForResource.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Add stub for NvAPI_D3D9_RegisterResource.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Improve NvAPI_D3D_GetCurrentSLIState.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Implement NvAPI_GPU_Get{Physical,Virtual}FrameBufferSize.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Add stub for NvAPI_GPU_GetGpuCoreCount.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user