Add more nvapi stubs.

This commit is contained in:
Michael Müller 2015-01-13 03:16:33 +01:00
parent 32d5e2d8e9
commit 0d07d50b91
10 changed files with 1014 additions and 0 deletions

View File

@ -0,0 +1,123 @@
From 089ba9733d4692a2cfac5f46713d6e2bb2b2ce87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 12 Jan 2015 17:57:52 +0100
Subject: nvapi: Add stub for NvAPI_EnumPhysicalGPUs.
---
dlls/nvapi/nvapi.c | 19 ++++++++++++++++++-
dlls/nvapi/tests/nvapi.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index 3c3f2fd..f02df67 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -452,6 +452,22 @@ static NvAPI_Status CDECL NvAPI_GetPhysicalGPUsFromLogicalGPU(NvLogicalGpuHandle
return NVAPI_OK;
}
+static NvAPI_Status CDECL NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle gpuHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *count)
+{
+ TRACE("(%p, %p)\n", gpuHandle, count);
+
+ if (!gpuHandle)
+ return NVAPI_INVALID_ARGUMENT;
+
+ if (!count)
+ return NVAPI_INVALID_POINTER;
+
+ gpuHandle[0] = FAKE_PHYSICAL_GPU;
+ *count = 1;
+
+ return NVAPI_OK;
+}
+
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
@@ -481,7 +497,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0xaeaecd41, NvAPI_D3D9_StretchRectEx},
{0x48b3ea59, NvAPI_EnumLogicalGPUs},
{0xfb9bc2ab, NvAPI_EnumLogicalGPUs_unknown},
- {0xaea3fa32, NvAPI_GetPhysicalGPUsFromLogicalGPU}
+ {0xaea3fa32, NvAPI_GetPhysicalGPUsFromLogicalGPU},
+ {0xe5ac921f, NvAPI_EnumPhysicalGPUs}
};
unsigned int i;
TRACE("(%x)\n", offset);
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
index 779dc32..3855635 100644
--- a/dlls/nvapi/tests/nvapi.c
+++ b/dlls/nvapi/tests/nvapi.c
@@ -36,6 +36,7 @@
#define NvAPI_EnumLogicalGPUs_unknown_Offset 0xfb9bc2ab
#define NvAPI_EnumLogicalGPUs_Offset 0x48b3ea59
#define NvAPI_GetPhysicalGPUsFromLogicalGPU_Offset 0xaea3fa32
+#define NvAPI_EnumPhysicalGPUs_Offset 0xe5ac921f
static void* (CDECL *pnvapi_QueryInterface)(unsigned int offset);
static NvAPI_Status (CDECL *pNvAPI_Initialize)(void);
@@ -46,6 +47,7 @@ static NvAPI_Status (CDECL *pNvAPI_unknown3)(void *param0, void *param1);
static NvAPI_Status (CDECL *pNvAPI_EnumLogicalGPUs_unknown)(NvLogicalGpuHandle nvGPUHandle[NVAPI_MAX_LOGICAL_GPUS], NvU32 *pGpuCount);
static NvAPI_Status (CDECL *pNvAPI_EnumLogicalGPUs)(NvLogicalGpuHandle nvGPUHandle[NVAPI_MAX_LOGICAL_GPUS], NvU32 *pGpuCount);
static NvAPI_Status (CDECL *pNvAPI_GetPhysicalGPUsFromLogicalGPU)(NvLogicalGpuHandle hLogicalGPU, NvPhysicalGpuHandle hPhysicalGPU[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
+static NvAPI_Status (CDECL *pNvAPI_EnumPhysicalGPUs)(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
static BOOL init(void)
{
@@ -76,6 +78,7 @@ static BOOL init(void)
pNvAPI_EnumLogicalGPUs_unknown = pnvapi_QueryInterface(NvAPI_EnumLogicalGPUs_unknown_Offset);
pNvAPI_EnumLogicalGPUs = pnvapi_QueryInterface(NvAPI_EnumLogicalGPUs_Offset);
pNvAPI_GetPhysicalGPUsFromLogicalGPU = pnvapi_QueryInterface(NvAPI_GetPhysicalGPUsFromLogicalGPU_Offset);
+ pNvAPI_EnumPhysicalGPUs = pnvapi_QueryInterface(NvAPI_EnumPhysicalGPUs_Offset);
if (!pNvAPI_Initialize)
{
@@ -377,6 +380,38 @@ static void test_NvAPI_GetPhysicalGPUsFromLogicalGPU(void)
}
+static void test_NvAPI_EnumPhysicalGPUs(void)
+{
+ NvLogicalGpuHandle gpuHandle[NVAPI_MAX_PHYSICAL_GPUS];
+ NvAPI_Status status;
+ NvU32 count;
+ int i;
+
+ if (!pNvAPI_EnumPhysicalGPUs)
+ {
+ win_skip("NvAPI_EnumLogicalGPUs export not found.\n");
+ return;
+ }
+
+ status = pNvAPI_EnumPhysicalGPUs(NULL, NULL);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ status = pNvAPI_EnumPhysicalGPUs((void*)0xdeadbeef, NULL);
+ ok(status == NVAPI_INVALID_POINTER, "Expected status NVAPI_INVALID_POINTER, got %d\n", status);
+
+ status = pNvAPI_EnumPhysicalGPUs(NULL, (void*)0xdeadbeef);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ memset(gpuHandle, 0, sizeof(gpuHandle));
+
+ status = pNvAPI_EnumPhysicalGPUs(gpuHandle, &count);
+ ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
+ ok(count > 0, "Expected count > 0, got %d\n", count);
+ for (i = 0; i < count; i++)
+ ok(gpuHandle[i] != NULL, "Expected gpuHandle[%d] != NULL\n", i);
+}
+
+
START_TEST( nvapi )
{
if (!init())
@@ -388,4 +423,5 @@ START_TEST( nvapi )
test_unknown3();
test_NvAPI_EnumLogicalGPUs();
test_NvAPI_GetPhysicalGPUsFromLogicalGPU();
+ test_NvAPI_EnumPhysicalGPUs();
}
--
1.9.1

View File

@ -0,0 +1,143 @@
From 1858bd6b9e0bbf89b2ff0738dc5324aad4adf2a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 12 Jan 2015 18:16:12 +0100
Subject: nvapi: Add stubs for NvAPI_GPU_GetFullName.
---
dlls/nvapi/nvapi.c | 25 +++++++++++++++++++++++-
dlls/nvapi/tests/nvapi.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index f02df67..51c6688 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -468,6 +468,28 @@ static NvAPI_Status CDECL NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle gpuHandle[N
return NVAPI_OK;
}
+static NvAPI_Status CDECL NvAPI_GPU_GetFullName(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName)
+{
+ NvAPI_ShortString adapter = {'G','e','F','o','r','c','e',' ','9','9','9',' ','G','T','X', 0};
+
+ TRACE("(%p, %p)\n", hPhysicalGpu, szName);
+
+ if (!hPhysicalGpu)
+ return NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE;
+
+ if (hPhysicalGpu != FAKE_PHYSICAL_GPU)
+ {
+ FIXME("invalid handle: %p\n", hPhysicalGpu);
+ return NVAPI_INVALID_HANDLE;
+ }
+
+ if (!szName)
+ return NVAPI_INVALID_ARGUMENT;
+
+ memcpy(szName, adapter, sizeof(adapter));
+ return NVAPI_OK;
+}
+
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
@@ -498,7 +520,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0x48b3ea59, NvAPI_EnumLogicalGPUs},
{0xfb9bc2ab, NvAPI_EnumLogicalGPUs_unknown},
{0xaea3fa32, NvAPI_GetPhysicalGPUsFromLogicalGPU},
- {0xe5ac921f, NvAPI_EnumPhysicalGPUs}
+ {0xe5ac921f, NvAPI_EnumPhysicalGPUs},
+ {0xceee8e9f, NvAPI_GPU_GetFullName}
};
unsigned int i;
TRACE("(%x)\n", offset);
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
index 3855635..e205662 100644
--- a/dlls/nvapi/tests/nvapi.c
+++ b/dlls/nvapi/tests/nvapi.c
@@ -37,6 +37,7 @@
#define NvAPI_EnumLogicalGPUs_Offset 0x48b3ea59
#define NvAPI_GetPhysicalGPUsFromLogicalGPU_Offset 0xaea3fa32
#define NvAPI_EnumPhysicalGPUs_Offset 0xe5ac921f
+#define NvAPI_GPU_GetFullName_Offset 0xceee8e9f
static void* (CDECL *pnvapi_QueryInterface)(unsigned int offset);
static NvAPI_Status (CDECL *pNvAPI_Initialize)(void);
@@ -48,6 +49,7 @@ static NvAPI_Status (CDECL *pNvAPI_EnumLogicalGPUs_unknown)(NvLogicalGpuHandle n
static NvAPI_Status (CDECL *pNvAPI_EnumLogicalGPUs)(NvLogicalGpuHandle nvGPUHandle[NVAPI_MAX_LOGICAL_GPUS], NvU32 *pGpuCount);
static NvAPI_Status (CDECL *pNvAPI_GetPhysicalGPUsFromLogicalGPU)(NvLogicalGpuHandle hLogicalGPU, NvPhysicalGpuHandle hPhysicalGPU[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
static NvAPI_Status (CDECL *pNvAPI_EnumPhysicalGPUs)(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
+static NvAPI_Status (CDECL* pNvAPI_GPU_GetFullName)(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName);
static BOOL init(void)
{
@@ -79,6 +81,7 @@ static BOOL init(void)
pNvAPI_EnumLogicalGPUs = pnvapi_QueryInterface(NvAPI_EnumLogicalGPUs_Offset);
pNvAPI_GetPhysicalGPUsFromLogicalGPU = pnvapi_QueryInterface(NvAPI_GetPhysicalGPUsFromLogicalGPU_Offset);
pNvAPI_EnumPhysicalGPUs = pnvapi_QueryInterface(NvAPI_EnumPhysicalGPUs_Offset);
+ pNvAPI_GPU_GetFullName = pnvapi_QueryInterface(NvAPI_GPU_GetFullName_Offset);
if (!pNvAPI_Initialize)
{
@@ -411,6 +414,52 @@ static void test_NvAPI_EnumPhysicalGPUs(void)
ok(gpuHandle[i] != NULL, "Expected gpuHandle[%d] != NULL\n", i);
}
+static void test_NvAPI_GPU_GetFullName(void)
+{
+ NvLogicalGpuHandle gpuHandle[NVAPI_MAX_PHYSICAL_GPUS];
+ NvAPI_Status status;
+ NvU32 count;
+ NvAPI_ShortString str;
+
+ if (!pNvAPI_EnumPhysicalGPUs)
+ {
+ win_skip("NvAPI_EnumLogicalGPUs export not found.\n");
+ return;
+ }
+
+ if (!pNvAPI_GPU_GetFullName)
+ {
+ win_skip("NvAPI_GPU_GetFullName export not found.\n");
+ return;
+ }
+
+ memset(gpuHandle, 0, sizeof(gpuHandle));
+
+ status = pNvAPI_EnumPhysicalGPUs(gpuHandle, &count);
+ ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
+ ok(count > 0, "Expected count > 0, got %d\n", count);
+
+ status = pNvAPI_GPU_GetFullName(NULL, NULL);
+ ok(status == NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE, "Expected status NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE, got %d\n", status);
+
+ if (0) /* crashes on windows */
+ {
+ status = pNvAPI_GPU_GetFullName(gpuHandle[0], NULL);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+ }
+
+ status = pNvAPI_GPU_GetFullName(NULL, str);
+ ok(status == NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE, "Expected status NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE, got %d\n", status);
+
+ status = pNvAPI_GPU_GetFullName((void*)0xdeadbeef, str);
+ ok(status == NVAPI_INVALID_HANDLE, "Expected status NVAPI_INVALID_HANDLE, got %d\n", status);
+
+ memset(str, 0, sizeof(str));
+ status = pNvAPI_GPU_GetFullName(gpuHandle[0], str);
+ ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
+ ok(str[0] != 0, "Expected non emptry string");
+ trace("GPU-0 name: %s\n", str);
+}
START_TEST( nvapi )
{
@@ -424,4 +473,5 @@ START_TEST( nvapi )
test_NvAPI_EnumLogicalGPUs();
test_NvAPI_GetPhysicalGPUsFromLogicalGPU();
test_NvAPI_EnumPhysicalGPUs();
+ test_NvAPI_GPU_GetFullName();
}
--
1.9.1

View File

@ -0,0 +1,27 @@
From be91056d36eb806068d23dcc40201c8030436658 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 12 Jan 2015 23:32:45 +0100
Subject: nvapi: Explicity return NULL for 0x33c7358c and 0x593e8644.
---
dlls/nvapi/nvapi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index 51c6688..1bdff9a 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -521,7 +521,9 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0xfb9bc2ab, NvAPI_EnumLogicalGPUs_unknown},
{0xaea3fa32, NvAPI_GetPhysicalGPUsFromLogicalGPU},
{0xe5ac921f, NvAPI_EnumPhysicalGPUs},
- {0xceee8e9f, NvAPI_GPU_GetFullName}
+ {0xceee8e9f, NvAPI_GPU_GetFullName},
+ {0x33c7358c, NULL}, /* This functions seems to be optional */
+ {0x593e8644, NULL} /* This functions seems to be optional */
};
unsigned int i;
TRACE("(%x)\n", offset);
--
1.9.1

View File

@ -0,0 +1,114 @@
From d910c47cc81c2b2bcb2fae736e60307cd6323728 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 12 Jan 2015 23:54:30 +0100
Subject: nvapi: Add stub for NvAPI_DISP_GetGDIPrimaryDisplayId.
---
dlls/nvapi/nvapi.c | 15 ++++++++++++++-
dlls/nvapi/tests/nvapi.c | 24 ++++++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index 1bdff9a..bbd1d66 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(nvapi);
#define FAKE_PHYSICAL_GPU ((NvPhysicalGpuHandle)0xdead0001)
#define FAKE_DISPLAY ((NvDisplayHandle)0xdead0002)
#define FAKE_LOGICAL_GPU ((NvLogicalGpuHandle)0xdead0003)
+#define FAKE_DISPLAY_ID ((NvU32)0xdead0004)
#if defined(__i386__) || defined(__x86_64__)
@@ -490,6 +491,17 @@ static NvAPI_Status CDECL NvAPI_GPU_GetFullName(NvPhysicalGpuHandle hPhysicalGpu
return NVAPI_OK;
}
+static NvAPI_Status CDECL NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId)
+{
+ TRACE("(%p)\n", displayId);
+
+ if (!displayId)
+ return NVAPI_INVALID_ARGUMENT;
+
+ *displayId = FAKE_DISPLAY_ID;
+ return NVAPI_OK;
+}
+
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
@@ -523,7 +535,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0xe5ac921f, NvAPI_EnumPhysicalGPUs},
{0xceee8e9f, NvAPI_GPU_GetFullName},
{0x33c7358c, NULL}, /* This functions seems to be optional */
- {0x593e8644, NULL} /* This functions seems to be optional */
+ {0x593e8644, NULL}, /* This functions seems to be optional */
+ {0x1e9d8a31, NvAPI_DISP_GetGDIPrimaryDisplayId}
};
unsigned int i;
TRACE("(%x)\n", offset);
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
index e205662..acdd10d 100644
--- a/dlls/nvapi/tests/nvapi.c
+++ b/dlls/nvapi/tests/nvapi.c
@@ -38,6 +38,7 @@
#define NvAPI_GetPhysicalGPUsFromLogicalGPU_Offset 0xaea3fa32
#define NvAPI_EnumPhysicalGPUs_Offset 0xe5ac921f
#define NvAPI_GPU_GetFullName_Offset 0xceee8e9f
+#define NvAPI_DISP_GetGDIPrimaryDisplayId_Offset 0x1e9d8a31
static void* (CDECL *pnvapi_QueryInterface)(unsigned int offset);
static NvAPI_Status (CDECL *pNvAPI_Initialize)(void);
@@ -50,6 +51,7 @@ static NvAPI_Status (CDECL *pNvAPI_EnumLogicalGPUs)(NvLogicalGpuHandle nvGPUHand
static NvAPI_Status (CDECL *pNvAPI_GetPhysicalGPUsFromLogicalGPU)(NvLogicalGpuHandle hLogicalGPU, NvPhysicalGpuHandle hPhysicalGPU[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
static NvAPI_Status (CDECL *pNvAPI_EnumPhysicalGPUs)(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
static NvAPI_Status (CDECL* pNvAPI_GPU_GetFullName)(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName);
+static NvAPI_Status (CDECL* pNvAPI_DISP_GetGDIPrimaryDisplayId)(NvU32* displayId);
static BOOL init(void)
{
@@ -82,6 +84,7 @@ static BOOL init(void)
pNvAPI_GetPhysicalGPUsFromLogicalGPU = pnvapi_QueryInterface(NvAPI_GetPhysicalGPUsFromLogicalGPU_Offset);
pNvAPI_EnumPhysicalGPUs = pnvapi_QueryInterface(NvAPI_EnumPhysicalGPUs_Offset);
pNvAPI_GPU_GetFullName = pnvapi_QueryInterface(NvAPI_GPU_GetFullName_Offset);
+ pNvAPI_DISP_GetGDIPrimaryDisplayId = pnvapi_QueryInterface(NvAPI_DISP_GetGDIPrimaryDisplayId_Offset);
if (!pNvAPI_Initialize)
{
@@ -461,6 +464,26 @@ static void test_NvAPI_GPU_GetFullName(void)
trace("GPU-0 name: %s\n", str);
}
+static void test_NvAPI_DISP_GetGDIPrimaryDisplayId(void)
+{
+ NvAPI_Status status;
+ NvU32 disp;
+
+ if (!pNvAPI_DISP_GetGDIPrimaryDisplayId)
+ {
+ win_skip("NvAPI_DISP_GetGDIPrimaryDisplayId export not found.\n");
+ return;
+ }
+
+ status = pNvAPI_DISP_GetGDIPrimaryDisplayId(NULL);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ disp = 0;
+ status = pNvAPI_DISP_GetGDIPrimaryDisplayId(&disp);
+ ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
+ ok(disp != 0, "Expected disp to be non null");
+}
+
START_TEST( nvapi )
{
if (!init())
@@ -474,4 +497,5 @@ START_TEST( nvapi )
test_NvAPI_GetPhysicalGPUsFromLogicalGPU();
test_NvAPI_EnumPhysicalGPUs();
test_NvAPI_GPU_GetFullName();
+ test_NvAPI_DISP_GetGDIPrimaryDisplayId();
}
--
1.9.1

View File

@ -0,0 +1,153 @@
From ebd22c15b9beac466f1c5f2cbe262a75ea2a3622 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 13 Jan 2015 00:22:26 +0100
Subject: nvapi: Add stub for EnumNvidiaDisplayHandle.
---
dlls/nvapi/nvapi.c | 17 ++++++++++++++++-
dlls/nvapi/tests/nvapi.c | 43 +++++++++++++++++++++++++++++++++++++++++++
include/nvapi.h | 4 ++++
3 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index bbd1d66..4c009b5 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -502,6 +502,20 @@ static NvAPI_Status CDECL NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId)
return NVAPI_OK;
}
+static NvAPI_Status CDECL NvAPI_EnumNvidiaDisplayHandle(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle)
+{
+ TRACE("(%u, %p)\n", thisEnum, pNvDispHandle);
+
+ if (thisEnum >= NVAPI_MAX_DISPLAYS || !pNvDispHandle)
+ return NVAPI_INVALID_ARGUMENT;
+
+ if (thisEnum > 0)
+ return NVAPI_END_ENUMERATION;
+
+ *pNvDispHandle = FAKE_DISPLAY;
+ return NVAPI_OK;
+}
+
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
@@ -536,7 +550,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0xceee8e9f, NvAPI_GPU_GetFullName},
{0x33c7358c, NULL}, /* This functions seems to be optional */
{0x593e8644, NULL}, /* This functions seems to be optional */
- {0x1e9d8a31, NvAPI_DISP_GetGDIPrimaryDisplayId}
+ {0x1e9d8a31, NvAPI_DISP_GetGDIPrimaryDisplayId},
+ {0x9abdd40d, NvAPI_EnumNvidiaDisplayHandle}
};
unsigned int i;
TRACE("(%x)\n", offset);
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
index acdd10d..8d15382 100644
--- a/dlls/nvapi/tests/nvapi.c
+++ b/dlls/nvapi/tests/nvapi.c
@@ -39,6 +39,7 @@
#define NvAPI_EnumPhysicalGPUs_Offset 0xe5ac921f
#define NvAPI_GPU_GetFullName_Offset 0xceee8e9f
#define NvAPI_DISP_GetGDIPrimaryDisplayId_Offset 0x1e9d8a31
+#define NvAPI_EnumNvidiaDisplayHandle_Offset 0x9abdd40d
static void* (CDECL *pnvapi_QueryInterface)(unsigned int offset);
static NvAPI_Status (CDECL *pNvAPI_Initialize)(void);
@@ -52,6 +53,7 @@ static NvAPI_Status (CDECL *pNvAPI_GetPhysicalGPUsFromLogicalGPU)(NvLogicalGpuHa
static NvAPI_Status (CDECL *pNvAPI_EnumPhysicalGPUs)(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
static NvAPI_Status (CDECL* pNvAPI_GPU_GetFullName)(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName);
static NvAPI_Status (CDECL* pNvAPI_DISP_GetGDIPrimaryDisplayId)(NvU32* displayId);
+static NvAPI_Status (CDECL* pNvAPI_EnumNvidiaDisplayHandle)(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle);
static BOOL init(void)
{
@@ -85,6 +87,7 @@ static BOOL init(void)
pNvAPI_EnumPhysicalGPUs = pnvapi_QueryInterface(NvAPI_EnumPhysicalGPUs_Offset);
pNvAPI_GPU_GetFullName = pnvapi_QueryInterface(NvAPI_GPU_GetFullName_Offset);
pNvAPI_DISP_GetGDIPrimaryDisplayId = pnvapi_QueryInterface(NvAPI_DISP_GetGDIPrimaryDisplayId_Offset);
+ pNvAPI_EnumNvidiaDisplayHandle = pnvapi_QueryInterface(NvAPI_EnumNvidiaDisplayHandle_Offset);
if (!pNvAPI_Initialize)
{
@@ -484,6 +487,45 @@ static void test_NvAPI_DISP_GetGDIPrimaryDisplayId(void)
ok(disp != 0, "Expected disp to be non null");
}
+static void test_NvAPI_EnumNvidiaDisplayHandle(void)
+{
+ NvAPI_Status status;
+ NvDisplayHandle disp;
+ int i = 0;
+
+ if (!pNvAPI_EnumNvidiaDisplayHandle)
+ {
+ win_skip("NvAPI_EnumNvidiaDisplayHandle export not found.\n");
+ return;
+ }
+
+ status = pNvAPI_EnumNvidiaDisplayHandle(0, NULL);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ disp = NULL;
+ status = pNvAPI_EnumNvidiaDisplayHandle(i, &disp);
+ ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
+ ok(disp != NULL, "Expected disp to be non null");
+
+ while (!pNvAPI_EnumNvidiaDisplayHandle(i, &disp))
+ i++;
+
+ disp = NULL;
+ status = pNvAPI_EnumNvidiaDisplayHandle(i, &disp);
+ ok(status == NVAPI_END_ENUMERATION, "Expected status NVAPI_END_ENUMERATION, got %d\n", status);
+ ok(disp == NULL, "Expected disp to be null");
+
+ disp = NULL;
+ status = pNvAPI_EnumNvidiaDisplayHandle(NVAPI_MAX_DISPLAYS - 1, &disp);
+ ok(status == NVAPI_END_ENUMERATION, "Expected status NVAPI_END_ENUMERATION, got %d\n", status);
+ ok(disp == NULL, "Expected disp to be null");
+
+ disp = NULL;
+ status = pNvAPI_EnumNvidiaDisplayHandle(NVAPI_MAX_DISPLAYS, &disp);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+ ok(disp == NULL, "Expected disp to be null");
+}
+
START_TEST( nvapi )
{
if (!init())
@@ -498,4 +540,5 @@ START_TEST( nvapi )
test_NvAPI_EnumPhysicalGPUs();
test_NvAPI_GPU_GetFullName();
test_NvAPI_DISP_GetGDIPrimaryDisplayId();
+ test_NvAPI_EnumNvidiaDisplayHandle();
}
diff --git a/include/nvapi.h b/include/nvapi.h
index e3c94d8..2a13277 100644
--- a/include/nvapi.h
+++ b/include/nvapi.h
@@ -29,6 +29,7 @@ typedef unsigned int NvU32;
#define NVAPI_OK 0
#define NVAPI_ERROR -1
#define NVAPI_INVALID_ARGUMENT -5
+#define NVAPI_END_ENUMERATION -7
#define NVAPI_INVALID_HANDLE -8
#define NVAPI_INCOMPATIBLE_STRUCT_VERSION -9
#define NVAPI_INVALID_POINTER -14
@@ -38,8 +39,11 @@ typedef unsigned int NvU32;
#define NVAPI_UNREGISTERED_RESOURCE -170
#define NVAPI_SHORT_STRING_MAX 64
+#define NVAPI_PHYSICAL_GPUS 32
#define NVAPI_MAX_PHYSICAL_GPUS 64
#define NVAPI_MAX_LOGICAL_GPUS 64
+#define NVAPI_ADVANCED_DISPLAY_HEADS 4
+#define NVAPI_MAX_DISPLAYS (NVAPI_PHYSICAL_GPUS * NVAPI_ADVANCED_DISPLAY_HEADS)
typedef char NvAPI_ShortString[NVAPI_SHORT_STRING_MAX];
--
1.9.1

View File

@ -0,0 +1,126 @@
From 13ee123115eef55e23ab7574e13f9e8f68b34555 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 13 Jan 2015 00:39:43 +0100
Subject: nvapi: Add stub for NvAPI_SYS_GetDriverAndBranchVersion.
---
dlls/nvapi/nvapi.c | 18 +++++++++++++++++-
dlls/nvapi/tests/nvapi.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index 4c009b5..43c0375 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -516,6 +516,21 @@ static NvAPI_Status CDECL NvAPI_EnumNvidiaDisplayHandle(NvU32 thisEnum, NvDispla
return NVAPI_OK;
}
+static NvAPI_Status CDECL NvAPI_SYS_GetDriverAndBranchVersion(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString)
+{
+ NvAPI_ShortString build_str = {'r','3','3','7','_','0','0',0};
+
+ TRACE("(%p, %p)\n", pDriverVersion, szBuildBranchString);
+
+ if (!pDriverVersion || !szBuildBranchString)
+ return NVAPI_INVALID_POINTER;
+
+ memcpy(szBuildBranchString, build_str, sizeof(build_str));
+ *pDriverVersion = 33788;
+
+ return NVAPI_OK;
+}
+
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
@@ -551,7 +566,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0x33c7358c, NULL}, /* This functions seems to be optional */
{0x593e8644, NULL}, /* This functions seems to be optional */
{0x1e9d8a31, NvAPI_DISP_GetGDIPrimaryDisplayId},
- {0x9abdd40d, NvAPI_EnumNvidiaDisplayHandle}
+ {0x9abdd40d, NvAPI_EnumNvidiaDisplayHandle},
+ {0x2926aaad, NvAPI_SYS_GetDriverAndBranchVersion}
};
unsigned int i;
TRACE("(%x)\n", offset);
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
index 8d15382..aeca45f 100644
--- a/dlls/nvapi/tests/nvapi.c
+++ b/dlls/nvapi/tests/nvapi.c
@@ -40,6 +40,7 @@
#define NvAPI_GPU_GetFullName_Offset 0xceee8e9f
#define NvAPI_DISP_GetGDIPrimaryDisplayId_Offset 0x1e9d8a31
#define NvAPI_EnumNvidiaDisplayHandle_Offset 0x9abdd40d
+#define NvAPI_SYS_GetDriverAndBranchVersion_Offset 0x2926aaad
static void* (CDECL *pnvapi_QueryInterface)(unsigned int offset);
static NvAPI_Status (CDECL *pNvAPI_Initialize)(void);
@@ -54,6 +55,7 @@ static NvAPI_Status (CDECL *pNvAPI_EnumPhysicalGPUs)(NvPhysicalGpuHandle nvGPUHa
static NvAPI_Status (CDECL* pNvAPI_GPU_GetFullName)(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName);
static NvAPI_Status (CDECL* pNvAPI_DISP_GetGDIPrimaryDisplayId)(NvU32* displayId);
static NvAPI_Status (CDECL* pNvAPI_EnumNvidiaDisplayHandle)(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle);
+static NvAPI_Status (CDECL* pNvAPI_SYS_GetDriverAndBranchVersion)(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString);
static BOOL init(void)
{
@@ -88,6 +90,7 @@ static BOOL init(void)
pNvAPI_GPU_GetFullName = pnvapi_QueryInterface(NvAPI_GPU_GetFullName_Offset);
pNvAPI_DISP_GetGDIPrimaryDisplayId = pnvapi_QueryInterface(NvAPI_DISP_GetGDIPrimaryDisplayId_Offset);
pNvAPI_EnumNvidiaDisplayHandle = pnvapi_QueryInterface(NvAPI_EnumNvidiaDisplayHandle_Offset);
+ pNvAPI_SYS_GetDriverAndBranchVersion = pnvapi_QueryInterface(NvAPI_SYS_GetDriverAndBranchVersion_Offset);
if (!pNvAPI_Initialize)
{
@@ -526,6 +529,42 @@ static void test_NvAPI_EnumNvidiaDisplayHandle(void)
ok(disp == NULL, "Expected disp to be null");
}
+static void test_NvAPI_SYS_GetDriverAndBranchVersion(void)
+{
+ NvAPI_Status status;
+ NvU32 version;
+ NvAPI_ShortString branch;
+
+ if (!pNvAPI_SYS_GetDriverAndBranchVersion)
+ {
+ win_skip("NvAPI_SYS_GetDriverAndBranchVersion export not found.\n");
+ return;
+ }
+
+ status = pNvAPI_SYS_GetDriverAndBranchVersion(NULL, NULL);
+ ok(status == NVAPI_INVALID_POINTER, "Expected status NVAPI_INVALID_POINTER, got %d\n", status);
+
+ status = pNvAPI_SYS_GetDriverAndBranchVersion(NULL, branch);
+ ok(status == NVAPI_INVALID_POINTER, "Expected status NVAPI_INVALID_POINTER, got %d\n", status);
+
+ if (0) /* crashes on windows */
+ {
+ status = pNvAPI_SYS_GetDriverAndBranchVersion(&version, NULL);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+ }
+
+ version = 0;
+ memset(branch, 0, sizeof(branch));
+ status = pNvAPI_SYS_GetDriverAndBranchVersion(&version, branch);
+ ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
+ ok(version != 0, "Expected non null version");
+ ok(branch[0] != 0, "Expected non emptry branch string");
+
+ trace("Version: %d\n", version);
+ trace("Branch: %s\n", branch);
+}
+
+
START_TEST( nvapi )
{
if (!init())
@@ -541,4 +580,5 @@ START_TEST( nvapi )
test_NvAPI_GPU_GetFullName();
test_NvAPI_DISP_GetGDIPrimaryDisplayId();
test_NvAPI_EnumNvidiaDisplayHandle();
+ test_NvAPI_SYS_GetDriverAndBranchVersion();
}
--
1.9.1

View File

@ -0,0 +1,39 @@
From 1f87d8b802f5182067afcfd1b157f1fe00088fbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 13 Jan 2015 00:48:47 +0100
Subject: nvapi: Add stub for NvAPI_Unload.
---
dlls/nvapi/nvapi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index 43c0375..78ffdc9 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -531,6 +531,12 @@ static NvAPI_Status CDECL NvAPI_SYS_GetDriverAndBranchVersion(NvU32* pDriverVers
return NVAPI_OK;
}
+static NvAPI_Status CDECL NvAPI_Unload(void)
+{
+ TRACE("()\n");
+ return NVAPI_OK;
+}
+
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
@@ -567,7 +573,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0x593e8644, NULL}, /* This functions seems to be optional */
{0x1e9d8a31, NvAPI_DISP_GetGDIPrimaryDisplayId},
{0x9abdd40d, NvAPI_EnumNvidiaDisplayHandle},
- {0x2926aaad, NvAPI_SYS_GetDriverAndBranchVersion}
+ {0x2926aaad, NvAPI_SYS_GetDriverAndBranchVersion},
+ {0xd22bdd7e, NvAPI_Unload}
};
unsigned int i;
TRACE("(%x)\n", offset);
--
1.9.1

View File

@ -0,0 +1,246 @@
From 711a5534ea1772eefcb664969bd9f6a6bad7c0bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 13 Jan 2015 02:06:40 +0100
Subject: nvapi: Add stub for NvAPI_D3D_GetCurrentSLIState.
---
dlls/nvapi/nvapi.c | 16 ++++++-
dlls/nvapi/tests/Makefile.in | 2 +-
dlls/nvapi/tests/nvapi.c | 107 +++++++++++++++++++++++++++++++++++++++++++
include/nvapi.h | 14 ++++++
4 files changed, 137 insertions(+), 2 deletions(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index 78ffdc9..287e681 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -537,6 +537,19 @@ static NvAPI_Status CDECL NvAPI_Unload(void)
return NVAPI_OK;
}
+static NvAPI_Status CDECL NvAPI_D3D_GetCurrentSLIState(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState)
+{
+ TRACE("(%p, %p)\n", pDevice, pSliState);
+
+ if (!pDevice || !pSliState)
+ return NVAPI_INVALID_ARGUMENT;
+
+ if (pSliState->version != NV_GET_CURRENT_SLI_STATE_VER)
+ return NVAPI_INCOMPATIBLE_STRUCT_VERSION;
+
+ return NVAPI_NO_ACTIVE_SLI_TOPOLOGY;
+}
+
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
@@ -574,7 +587,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0x1e9d8a31, NvAPI_DISP_GetGDIPrimaryDisplayId},
{0x9abdd40d, NvAPI_EnumNvidiaDisplayHandle},
{0x2926aaad, NvAPI_SYS_GetDriverAndBranchVersion},
- {0xd22bdd7e, NvAPI_Unload}
+ {0xd22bdd7e, NvAPI_Unload},
+ {0x4b708b54, NvAPI_D3D_GetCurrentSLIState}
};
unsigned int i;
TRACE("(%x)\n", offset);
diff --git a/dlls/nvapi/tests/Makefile.in b/dlls/nvapi/tests/Makefile.in
index a94df01..8f950f4 100644
--- a/dlls/nvapi/tests/Makefile.in
+++ b/dlls/nvapi/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = nvapi.dll
-IMPORTS = user32 shlwapi
+IMPORTS = user32 shlwapi d3d9
C_SRCS = \
nvapi.c
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
index aeca45f..f4edcab 100644
--- a/dlls/nvapi/tests/nvapi.c
+++ b/dlls/nvapi/tests/nvapi.c
@@ -25,6 +25,7 @@
#include "shlwapi.h"
#include "winerror.h"
#include "nvapi.h"
+#include <d3d9.h>
#include "wine/test.h"
@@ -41,6 +42,7 @@
#define NvAPI_DISP_GetGDIPrimaryDisplayId_Offset 0x1e9d8a31
#define NvAPI_EnumNvidiaDisplayHandle_Offset 0x9abdd40d
#define NvAPI_SYS_GetDriverAndBranchVersion_Offset 0x2926aaad
+#define NvAPI_D3D_GetCurrentSLIState_Offset 0x4b708b54
static void* (CDECL *pnvapi_QueryInterface)(unsigned int offset);
static NvAPI_Status (CDECL *pNvAPI_Initialize)(void);
@@ -56,6 +58,7 @@ static NvAPI_Status (CDECL* pNvAPI_GPU_GetFullName)(NvPhysicalGpuHandle hPhysica
static NvAPI_Status (CDECL* pNvAPI_DISP_GetGDIPrimaryDisplayId)(NvU32* displayId);
static NvAPI_Status (CDECL* pNvAPI_EnumNvidiaDisplayHandle)(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle);
static NvAPI_Status (CDECL* pNvAPI_SYS_GetDriverAndBranchVersion)(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString);
+static NvAPI_Status (CDECL* pNvAPI_D3D_GetCurrentSLIState)(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState);
static BOOL init(void)
{
@@ -91,6 +94,7 @@ static BOOL init(void)
pNvAPI_DISP_GetGDIPrimaryDisplayId = pnvapi_QueryInterface(NvAPI_DISP_GetGDIPrimaryDisplayId_Offset);
pNvAPI_EnumNvidiaDisplayHandle = pnvapi_QueryInterface(NvAPI_EnumNvidiaDisplayHandle_Offset);
pNvAPI_SYS_GetDriverAndBranchVersion = pnvapi_QueryInterface(NvAPI_SYS_GetDriverAndBranchVersion_Offset);
+ pNvAPI_D3D_GetCurrentSLIState = pnvapi_QueryInterface(NvAPI_D3D_GetCurrentSLIState_Offset);
if (!pNvAPI_Initialize)
{
@@ -564,9 +568,105 @@ static void test_NvAPI_SYS_GetDriverAndBranchVersion(void)
trace("Branch: %s\n", branch);
}
+static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window)
+{
+ D3DPRESENT_PARAMETERS present_parameters = {0};
+ IDirect3DDevice9 *device;
+ DWORD behavior_flags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
+
+ if (!d3d9 || !focus_window)
+ return NULL;
+
+ present_parameters.BackBufferWidth = 640;
+ present_parameters.BackBufferHeight = 480;
+ present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
+ present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ present_parameters.hDeviceWindow = focus_window;
+ present_parameters.Windowed = TRUE;
+ present_parameters.EnableAutoDepthStencil = FALSE;
+
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ behavior_flags, &present_parameters, &device)))
+ return device;
+
+ return NULL;
+}
+
+static void test_NvAPI_D3D_GetCurrentSLIState(void)
+{
+ HWND window;
+ IDirect3DDevice9 *device;
+ IDirect3D9 *d3d;
+ NV_GET_CURRENT_SLI_STATE sli_state;
+ NvAPI_Status status;
+
+ if (!pNvAPI_D3D_GetCurrentSLIState)
+ {
+ win_skip("NvAPI_D3D_GetCurrentSLIState export not found.\n");
+ return;
+ }
+
+ status = pNvAPI_D3D_GetCurrentSLIState(NULL, NULL);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ status = pNvAPI_D3D_GetCurrentSLIState(NULL, &sli_state);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ memset(&sli_state, 0, sizeof(sli_state));
+ sli_state.version = NV_GET_CURRENT_SLI_STATE_VER;
+ status = pNvAPI_D3D_GetCurrentSLIState(NULL, &sli_state);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ window = CreateWindowA("d3d9_nvapi_test_wc", "d3d9_nvapi_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, NULL, NULL, NULL, NULL);
+ ok(window != NULL, "Failed to create a window.\n");
+
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ ok(d3d != NULL, "Failed to create a D3D object.\n");
+
+ if (!(device = create_device(d3d, window)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ goto cleanup;
+ }
+
+ status = pNvAPI_D3D_GetCurrentSLIState((IUnknown*)device, NULL);
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
+
+ memset(&sli_state, 0, sizeof(sli_state));
+ status = pNvAPI_D3D_GetCurrentSLIState((IUnknown*)device, &sli_state);
+ ok(status == NVAPI_INCOMPATIBLE_STRUCT_VERSION, "Expected status NVAPI_INCOMPATIBLE_STRUCT_VERSION, got %d\n", status);
+
+ memset(&sli_state, 0, sizeof(sli_state));
+ sli_state.version = NV_GET_CURRENT_SLI_STATE_VER;
+ status = pNvAPI_D3D_GetCurrentSLIState((IUnknown*)device, &sli_state);
+ ok(status == NVAPI_OK || status == NVAPI_NO_ACTIVE_SLI_TOPOLOGY,
+ "Expected status NVAPI_OK or NVAPI_NO_ACTIVE_SLI_TOPOLOGY, got %d\n", status);
+
+ if (status == NVAPI_OK)
+ {
+ trace("maxNumAFRGroups: %u\n", sli_state.maxNumAFRGroups);
+ trace("numAFRGroups: %u\n", sli_state.numAFRGroups);
+ trace("currentAFRIndex: %u\n", sli_state.currentAFRIndex);
+ trace("nextFrameAFRIndex: %u\n", sli_state.nextFrameAFRIndex);
+ trace("previousFrameAFRIndex: %u\n", sli_state.previousFrameAFRIndex);
+ trace("bIsCurAFRGroupNew: %u\n", sli_state.bIsCurAFRGroupNew);
+ }
+
+cleanup:
+ if (device)
+ {
+ UINT refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ }
+ if (d3d) IDirect3D9_Release(d3d);
+ if (window) DestroyWindow(window);
+}
START_TEST( nvapi )
{
+ WNDCLASSA wc = {0};
+
if (!init())
return;
@@ -581,4 +681,11 @@ START_TEST( nvapi )
test_NvAPI_DISP_GetGDIPrimaryDisplayId();
test_NvAPI_EnumNvidiaDisplayHandle();
test_NvAPI_SYS_GetDriverAndBranchVersion();
+
+ /* d3d9 tests */
+ wc.lpfnWndProc = DefWindowProcA;
+ wc.lpszClassName = "d3d9_nvapi_test_wc";
+ RegisterClassA(&wc);
+
+ test_NvAPI_D3D_GetCurrentSLIState();
}
diff --git a/include/nvapi.h b/include/nvapi.h
index 2a13277..30c02cd 100644
--- a/include/nvapi.h
+++ b/include/nvapi.h
@@ -35,6 +35,7 @@ typedef unsigned int NvU32;
#define NVAPI_INVALID_POINTER -14
#define NVAPI_EXPECTED_LOGICAL_GPU_HANDLE -100
#define NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE -101
+#define NVAPI_NO_ACTIVE_SLI_TOPOLOGY -113
#define NVAPI_STEREO_NOT_INITIALIZED -140
#define NVAPI_UNREGISTERED_RESOURCE -170
@@ -65,6 +66,19 @@ typedef struct
#define NV_DISPLAY_DRIVER_VERSION_VER MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_VERSION, 1)
+typedef struct
+{
+ NvU32 version;
+ NvU32 maxNumAFRGroups;
+ NvU32 numAFRGroups;
+ NvU32 currentAFRIndex;
+ NvU32 nextFrameAFRIndex;
+ NvU32 previousFrameAFRIndex;
+ NvU32 bIsCurAFRGroupNew;
+} NV_GET_CURRENT_SLI_STATE;
+
+#define NV_GET_CURRENT_SLI_STATE_VER MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE, 1)
+
/* undocumented stuff */
typedef struct
{
--
1.9.1

View File

@ -0,0 +1,25 @@
From 3927bd79cfd73dde183947e688eb2563ad001705 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 13 Jan 2015 02:21:07 +0100
Subject: nvapi: Print fixme message for NvAPI_D3D9_StretchRectEx.
---
dlls/nvapi/nvapi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
index 287e681..6852e24 100644
--- a/dlls/nvapi/nvapi.c
+++ b/dlls/nvapi/nvapi.c
@@ -402,7 +402,7 @@ static NvAPI_Status CDECL NvAPI_D3D9_StretchRectEx(IDirect3DDevice9 *pDevice, ID
const RECT *pSourceRect, IDirect3DResource9 *pDestResource,
const RECT *pDestRect, D3DTEXTUREFILTERTYPE Filter)
{
- TRACE("(%p, %p, %p, %p, %p, %d)\n", pDevice, pSourceResource, pSourceRect, pDestResource, pDestRect, Filter);
+ FIXME("(%p, %p, %p, %p, %p, %d): stub\n", pDevice, pSourceResource, pSourceRect, pDestResource, pDestRect, Filter);
return NVAPI_UNREGISTERED_RESOURCE;
}
--
1.9.1

View File

@ -2158,10 +2158,28 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then
patch_apply nvapi-Stub_DLL/0001-nvapi-First-implementation.patch
patch_apply nvapi-Stub_DLL/0002-nvapi-Add-stubs-for-NvAPI_EnumLogicalGPUs-and-undocu.patch
patch_apply nvapi-Stub_DLL/0003-nvapi-Add-NvAPI_GetPhysicalGPUsFromLogicalGPU.patch
patch_apply nvapi-Stub_DLL/0004-nvapi-Add-stub-for-NvAPI_EnumPhysicalGPUs.patch
patch_apply nvapi-Stub_DLL/0005-nvapi-Add-stubs-for-NvAPI_GPU_GetFullName.patch
patch_apply nvapi-Stub_DLL/0006-nvapi-Explicity-return-NULL-for-0x33c7358c-and-0x593.patch
patch_apply nvapi-Stub_DLL/0007-nvapi-Add-stub-for-NvAPI_DISP_GetGDIPrimaryDisplayId.patch
patch_apply nvapi-Stub_DLL/0008-nvapi-Add-stub-for-EnumNvidiaDisplayHandle.patch
patch_apply nvapi-Stub_DLL/0009-nvapi-Add-stub-for-NvAPI_SYS_GetDriverAndBranchVersi.patch
patch_apply nvapi-Stub_DLL/0010-nvapi-Add-stub-for-NvAPI_Unload.patch
patch_apply nvapi-Stub_DLL/0011-nvapi-Add-stub-for-NvAPI_D3D_GetCurrentSLIState.patch
patch_apply nvapi-Stub_DLL/0012-nvapi-Print-fixme-message-for-NvAPI_D3D9_StretchRect.patch
(
echo '+ { "Michael Müller", "nvapi: First implementation.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stubs for NvAPI_EnumLogicalGPUs and undocumented equivalent.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add NvAPI_GetPhysicalGPUsFromLogicalGPU.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stub for NvAPI_EnumPhysicalGPUs.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stubs for NvAPI_GPU_GetFullName.", 1 },';
echo '+ { "Michael Müller", "nvapi: Explicity return NULL for 0x33c7358c and 0x593e8644.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stub for NvAPI_DISP_GetGDIPrimaryDisplayId.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stub for EnumNvidiaDisplayHandle.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stub for NvAPI_SYS_GetDriverAndBranchVersion.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stub for NvAPI_Unload.", 1 },';
echo '+ { "Michael Müller", "nvapi: Add stub for NvAPI_D3D_GetCurrentSLIState.", 1 },';
echo '+ { "Michael Müller", "nvapi: Print fixme message for NvAPI_D3D9_StretchRectEx.", 1 },';
) >> "$patchlist"
fi