Skip to content

Commit 94306f5

Browse files
committed
Initial Multi adapter changes.
Change-Id: Iedfd8928e887c6412f8df9a2fba2aac13e285ef3
1 parent 77699a1 commit 94306f5

File tree

7 files changed

+76
-57
lines changed

7 files changed

+76
-57
lines changed

Source/GmmLib/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ cmake_minimum_required(VERSION 3.5)
2424
project(igfx_gmmumd)
2525

2626
# GmmLib Api Version used for so naming
27-
set(GMMLIB_API_MAJOR_VERSION 11)
27+
set(GMMLIB_API_MAJOR_VERSION 12)
2828
set(GMMLIB_API_MINOR_VERSION 0)
2929

3030
if(NOT DEFINED MAJOR_VERSION)
31-
set(MAJOR_VERSION 11)
31+
set(MAJOR_VERSION 12)
3232
endif()
3333

3434
if(NOT DEFINED MINOR_VERSION)

Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -85,46 +85,36 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFu
8585
}
8686

8787
/////////////////////////////////////////////////////////////////////////////////////
88-
/// First Call to GMM Lib DLL/so to initialize singleton global context
89-
/// and create client context
90-
///
88+
// First Call to GMM Lib DLL/so to initialize singleton global context
89+
// and create client context
9190
/////////////////////////////////////////////////////////////////////////////////////
92-
#ifdef _WIN32
93-
extern "C" GMM_LIB_API GMM_CLIENT_CONTEXT *GMM_STDCALL GmmInit(const PLATFORM Platform,
94-
const SKU_FEATURE_TABLE *pSkuTable,
95-
const WA_TABLE * pWaTable,
96-
const GT_SYSTEM_INFO * pGtSysInfo,
97-
GMM_CLIENT ClientType)
98-
#else
99-
extern "C" GMM_LIB_API GMM_CLIENT_CONTEXT *GMM_STDCALL GmmInit(const PLATFORM Platform,
100-
const void * pSkuTable,
101-
const void * pWaTable,
102-
const void * pGtSysInfo,
103-
GMM_CLIENT ClientType)
104-
#endif
91+
extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs)
10592
{
106-
GMM_STATUS Status = GMM_SUCCESS;
107-
GMM_CLIENT_CONTEXT *pClientContext = NULL;
93+
GMM_STATUS Status = GMM_ERROR;
10894

95+
if(pInArgs && pOutArgs)
96+
{
10997

110-
Status = GmmCreateSingletonContext(Platform, pSkuTable, pWaTable, pGtSysInfo);
98+
Status = GmmCreateSingletonContext(pInArgs->Platform, pInArgs->pSkuTable, pInArgs->pWaTable, pInArgs->pGtSysInfo);
11199

112-
if(Status == GMM_SUCCESS)
113-
{
114-
pClientContext = GmmCreateClientContext(ClientType);
100+
if(Status == GMM_SUCCESS)
101+
{
102+
pOutArgs->pGmmClientContext = GmmCreateClientContext(pInArgs->ClientType);
103+
}
115104
}
116105

117-
return pClientContext;
106+
return Status;
118107
}
119108

120-
121109
/////////////////////////////////////////////////////////////////////////////////////
122-
/// Destroys singleton global context and client context
123-
///
110+
// Destroys singleton global context and client context
124111
/////////////////////////////////////////////////////////////////////////////////////
125-
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_CLIENT_CONTEXT *pGmmClientContext)
112+
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_INIT_OUT_ARGS *pInArgs)
126113
{
127-
GmmDestroySingletonContext();
128-
GmmDeleteClientContext(pGmmClientContext);
114+
if(pInArgs && pInArgs->pGmmClientContext)
115+
{
116+
GmmDeleteClientContext(pInArgs->pGmmClientContext);
117+
GmmDestroySingletonContext();
118+
}
129119
}
130120
#endif // GMM_LIB_DLL

Source/GmmLib/ULT/GmmCommonULT.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ void CommonULT::SetUpTestCase()
5757
{
5858
printf("%s\n", __FUNCTION__);
5959

60+
GMM_INIT_IN_ARGS InArgs;
61+
GMM_INIT_OUT_ARGS OutArgs;
62+
6063
if(GfxPlatform.eProductFamily == IGFX_UNKNOWN ||
6164
GfxPlatform.eRenderCoreFamily == IGFX_UNKNOWN_CORE)
6265
{
@@ -66,20 +69,23 @@ void CommonULT::SetUpTestCase()
6669

6770
AllocateAdapterInfo();
6871

72+
InArgs.ClientType = GMM_EXCITE_VISTA;
73+
InArgs.pGtSysInfo = &pGfxAdapterInfo->SystemInfo;
74+
InArgs.pSkuTable = &pGfxAdapterInfo->SkuTable;
75+
InArgs.pWaTable = &pGfxAdapterInfo->WaTable;
76+
InArgs.Platform = GfxPlatform;
77+
6978
hGmmLib = dlopen(GMM_UMD_DLL, RTLD_LAZY);
7079
ASSERT_TRUE(hGmmLib);
7180

72-
*(void **)(&pfnGmmInit) = dlsym(hGmmLib, "GmmInit");
81+
*(void **)(&pfnGmmInit) = dlsym(hGmmLib, "InitializeGmm");
7382
*(void **)(&pfnGmmDestroy) = dlsym(hGmmLib, "GmmDestroy");
7483

7584
ASSERT_TRUE(pfnGmmInit);
7685
ASSERT_TRUE(pfnGmmDestroy);
7786

78-
pGmmULTClientContext = pfnGmmInit(GfxPlatform,
79-
&pGfxAdapterInfo->SkuTable,
80-
&pGfxAdapterInfo->WaTable,
81-
&pGfxAdapterInfo->SystemInfo,
82-
GMM_EXCITE_VISTA);
87+
pfnGmmInit(&InArgs, &OutArgs);
88+
pGmmULTClientContext = OutArgs.pGmmClientContext;
8389

8490
ASSERT_TRUE(pGmmULTClientContext);
8591
}
@@ -88,7 +94,10 @@ void CommonULT::TearDownTestCase()
8894
{
8995
printf("%s\n", __FUNCTION__);
9096

91-
pfnGmmDestroy(static_cast<GMM_CLIENT_CONTEXT *>(pGmmULTClientContext));
97+
GMM_INIT_OUT_ARGS OutArgs;
98+
OutArgs.pGmmClientContext = static_cast<GMM_CLIENT_CONTEXT *>(pGmmULTClientContext);
99+
100+
pfnGmmDestroy(&OutArgs);
92101

93102
if(hGmmLib)
94103
{

Source/GmmLib/ULT/GmmCommonULT.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,8 @@ OTHER DEALINGS IN THE SOFTWARE.
2424

2525
#include "stdafx.h"
2626

27-
typedef GMM_CLIENT_CONTEXT *(GMM_STDCALL * PFNGMMINIT)
28-
#ifdef _WIN32
29-
(const PLATFORM,
30-
const SKU_FEATURE_TABLE *,
31-
const WA_TABLE *,
32-
const GT_SYSTEM_INFO *,
33-
GMM_CLIENT);
34-
#else
35-
(const PLATFORM Platform,
36-
const void * pSkuTable,
37-
const void * pWaTable,
38-
const void * pGtSysInfo,
39-
GMM_CLIENT ClientType);
40-
#endif
41-
typedef void(GMM_STDCALL *PFNGMMDESTROY)(GMM_CLIENT_CONTEXT *);
27+
typedef GMM_STATUS (GMM_STDCALL *PFNGMMINIT)(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs);
28+
typedef void(GMM_STDCALL *PFNGMMDESTROY)(GMM_INIT_OUT_ARGS *pInArgs);
4229

4330
class CommonULT : public testing::Test
4431
{

Source/GmmLib/inc/External/Common/GmmLibDll.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ OTHER DEALINGS IN THE SOFTWARE.
2424
#include "GmmCommonExt.h"
2525
#include "GmmInfo.h"
2626

27+
typedef struct _GMM_INIT_IN_ARGS_
28+
{
29+
PLATFORM Platform;
30+
void *pSkuTable;
31+
void *pWaTable;
32+
void *pGtSysInfo;
33+
uint32_t FileDescriptor;
34+
GMM_CLIENT ClientType;
35+
} GMM_INIT_IN_ARGS;
36+
37+
typedef struct _GMM_INIT_OUT_ARGS_
38+
{
39+
GMM_CLIENT_CONTEXT *pGmmClientContext;
40+
} GMM_INIT_OUT_ARGS;
41+
2742
// Interfaces exported from GMM Lib DLL
2843
typedef struct _GmmExportEntries
2944
{
@@ -54,6 +69,8 @@ extern "C" {
5469
/// Only function exported from GMM lib DLL.
5570
/////////////////////////////////////////////////////////////////////////////////////
5671
GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFuncs);
72+
GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs);
73+
GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_INIT_OUT_ARGS *pInArgs);
5774

5875
#ifdef __cplusplus
5976
}

Source/GmmLib/inc/External/Common/GmmLibDllName.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ OTHER DEALINGS IN THE SOFTWARE.
2323

2424
#if defined(_WIN64 ) || defined(__x86_64__) || defined(__LP64__)
2525
#define GMM_ENTRY_NAME "OpenGmm"
26-
#define GMM_INIT_NAME "GmmInit"
26+
#define GMM_INIT_NAME "InitializeGmm"
2727
#define GMM_DESTROY_NAME "GmmDestroy"
2828

2929
#if defined(_WIN64)
3030
#define GMM_UMD_DLL "igdgmm64.dll"
3131
#else
32-
#define GMM_UMD_DLL "libigdgmm.so.11"
32+
#define GMM_UMD_DLL "libigdgmm.so.12"
3333
#endif
3434
#else
3535
#define GMM_ENTRY_NAME "_OpenGmm@4"
3636

37-
#define GMM_INIT_NAME "_GmmInit@48"
37+
#define GMM_INIT_NAME "_InitializeGmm@8"
3838
#define GMM_DESTROY_NAME "_GmmDestroy@4"
3939

4040
#if defined(_WIN32)
4141
#define GMM_UMD_DLL "igdgmm32.dll"
4242
#else
43-
#define GMM_UMD_DLL "libigdgmm.so.11"
43+
#define GMM_UMD_DLL "libigdgmm.so.12"
4444
#endif
4545
#endif

Source/inc/umKmInc/sharedata.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,22 @@ typedef struct _KM_DEFERRED_WAIT_INFO
134134
uint32_t ActiveDisplay;
135135
} KM_DEFERRED_WAIT_INFO;
136136

137+
// struct to hold Adapter's BDF
138+
typedef struct _ADAPTER_BDF_
139+
{
140+
union
141+
{
142+
struct
143+
{
144+
uint32_t Bus : 8;
145+
uint32_t Device : 8;
146+
uint32_t Function : 8;
147+
uint32_t Reserved : 8;
148+
};
149+
uint32_t Data;
150+
};
151+
}ADAPTER_BDF;
152+
137153
// Private data structure for D3D callback QueryAdapterInfoCB
138154

139155
//===========================================================================

0 commit comments

Comments
 (0)