Commit 314fca4e authored by Michael Müller's avatar Michael Müller Committed by Vitaly Lipatov

nvapi: Add stub for NvAPI_GetLogicalGPUFromDisplay.

parent cbbc5876
......@@ -548,6 +548,20 @@ static NvAPI_Status CDECL NvAPI_D3D_GetCurrentSLIState(IUnknown *pDevice, NV_GET
return NVAPI_NO_ACTIVE_SLI_TOPOLOGY;
}
static NvAPI_Status CDECL NvAPI_GetLogicalGPUFromDisplay(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU)
{
TRACE("(%p, %p)\n", hNvDisp, pLogicalGPU);
if (!pLogicalGPU)
return NVAPI_INVALID_POINTER;
if (hNvDisp && hNvDisp != FAKE_DISPLAY)
return NVAPI_NVIDIA_DEVICE_NOT_FOUND;
*pLogicalGPU = FAKE_LOGICAL_GPU;
return NVAPI_OK;
}
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
......@@ -587,6 +601,7 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0x2926aaad, NvAPI_SYS_GetDriverAndBranchVersion},
{0xd22bdd7e, NvAPI_Unload},
{0x4b708b54, NvAPI_D3D_GetCurrentSLIState},
{0xee1370cf, NvAPI_GetLogicalGPUFromDisplay},
};
unsigned int i;
TRACE("(%x)\n", offset);
......
......@@ -44,6 +44,7 @@ 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 NvAPI_Status (CDECL* pNvAPI_GetLogicalGPUFromDisplay)(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU);
static const struct
{
......@@ -66,6 +67,7 @@ function_list[] =
{0x9abdd40d, (void**) &pNvAPI_EnumNvidiaDisplayHandle},
{0x2926aaad, (void**) &pNvAPI_SYS_GetDriverAndBranchVersion},
{0x4b708b54, (void**) &pNvAPI_D3D_GetCurrentSLIState},
{0xee1370cf, (void**) &pNvAPI_GetLogicalGPUFromDisplay},
};
static BOOL init(void)
......@@ -565,6 +567,49 @@ static void test_NvAPI_SYS_GetDriverAndBranchVersion(void)
trace("Branch: %s\n", branch);
}
static void test_NvAPI_GetLogicalGPUFromDisplay(void)
{
NvAPI_Status status;
NvDisplayHandle disp;
NvLogicalGpuHandle gpuHandle;
if (!pNvAPI_GetLogicalGPUFromDisplay)
{
win_skip("NvAPI_SYS_GetDriverAndBranchVersion export not found.\n");
return;
}
if (!pNvAPI_EnumNvidiaDisplayHandle)
{
win_skip("NvAPI_EnumNvidiaDisplayHandle export not found.\n");
return;
}
disp = NULL;
status = pNvAPI_EnumNvidiaDisplayHandle(0, &disp);
ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
ok(disp != NULL, "Expected disp to be non null\n");
status = pNvAPI_GetLogicalGPUFromDisplay(NULL, NULL);
ok(status == NVAPI_INVALID_POINTER, "Expected status NVAPI_INVALID_POINTER, got %d\n", status);
status = pNvAPI_GetLogicalGPUFromDisplay(disp, NULL);
ok(status == NVAPI_INVALID_POINTER, "Expected status NVAPI_INVALID_POINTER, got %d\n", status);
status = pNvAPI_GetLogicalGPUFromDisplay((void*)0xdeadbeef, &gpuHandle);
ok(status == NVAPI_NVIDIA_DEVICE_NOT_FOUND, "Expected status NVAPI_NVIDIA_DEVICE_NOT_FOUND, got %d\n", status);
gpuHandle = NULL;
status = pNvAPI_GetLogicalGPUFromDisplay(NULL, &gpuHandle);
ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
ok(gpuHandle != NULL, "Expected gpuHandle to be non null\n");
gpuHandle = NULL;
status = pNvAPI_GetLogicalGPUFromDisplay(disp, &gpuHandle);
ok(status == NVAPI_OK, "Expected status NVAPI_OK, got %d\n", status);
ok(gpuHandle != NULL, "Expected gpuHandle to be non null\n");
}
static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
......@@ -678,6 +723,7 @@ START_TEST( nvapi )
test_NvAPI_DISP_GetGDIPrimaryDisplayId();
test_NvAPI_EnumNvidiaDisplayHandle();
test_NvAPI_SYS_GetDriverAndBranchVersion();
test_NvAPI_GetLogicalGPUFromDisplay();
/* d3d9 tests */
wc.lpfnWndProc = DefWindowProcA;
......
......@@ -29,6 +29,7 @@ typedef unsigned int NvU32;
#define NVAPI_OK 0
#define NVAPI_ERROR -1
#define NVAPI_INVALID_ARGUMENT -5
#define NVAPI_NVIDIA_DEVICE_NOT_FOUND -6
#define NVAPI_END_ENUMERATION -7
#define NVAPI_INVALID_HANDLE -8
#define NVAPI_INCOMPATIBLE_STRUCT_VERSION -9
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment