Skip to content

Commit ebfcfd5

Browse files
committed
Fixing the ABI break
Revert of ABI break which was introduced in 19.3.4. Added two new API to interact with Library without any ABI break. Fixes:Commit Id 94306f5 Change-Id: I6f76c5c6a4f518d6907016890ee6fc6246cc8491
1 parent eb2db6f commit ebfcfd5

File tree

5 files changed

+77
-29
lines changed

5 files changed

+77
-29
lines changed

Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,37 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFu
8484
return Status;
8585
}
8686

87+
/////////////////////////////////////////////////////////////////////////////////////
88+
/// First Call to GMM Lib DLL/so to initialize singleton global context
89+
/// and create client context
90+
///
91+
/////////////////////////////////////////////////////////////////////////////////////
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
105+
{
106+
GMM_STATUS Status = GMM_SUCCESS;
107+
GMM_CLIENT_CONTEXT *pClientContext = NULL;
108+
109+
Status = GmmCreateSingletonContext(Platform, pSkuTable, pWaTable, pGtSysInfo);
110+
111+
if(Status == GMM_SUCCESS)
112+
{
113+
pClientContext = GmmCreateClientContext(ClientType);
114+
}
115+
116+
return pClientContext;
117+
}
87118
/////////////////////////////////////////////////////////////////////////////////////
88119
// First Call to GMM Lib DLL/so to initialize singleton global context
89120
// and create client context
@@ -106,10 +137,20 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pI
106137
return Status;
107138
}
108139

140+
/////////////////////////////////////////////////////////////////////////////////////
141+
/// Destroys singleton global context and client context
142+
///
143+
/////////////////////////////////////////////////////////////////////////////////////
144+
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_CLIENT_CONTEXT *pGmmClientContext)
145+
{
146+
GmmDestroySingletonContext();
147+
GmmDeleteClientContext(pGmmClientContext);
148+
}
149+
109150
/////////////////////////////////////////////////////////////////////////////////////
110151
// Destroys singleton global context and client context
111152
/////////////////////////////////////////////////////////////////////////////////////
112-
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_INIT_OUT_ARGS *pInArgs)
153+
extern "C" GMM_LIB_API void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs)
113154
{
114155
if(pInArgs && pInArgs->pGmmClientContext)
115156
{

Source/GmmLib/ULT/GmmCommonULT.cpp

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

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

7067
AllocateAdapterInfo();
7168

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-
7869
hGmmLib = dlopen(GMM_UMD_DLL, RTLD_LAZY);
7970
ASSERT_TRUE(hGmmLib);
8071

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

8475
ASSERT_TRUE(pfnGmmInit);
8576
ASSERT_TRUE(pfnGmmDestroy);
8677

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

9084
ASSERT_TRUE(pGmmULTClientContext);
9185
}
@@ -94,10 +88,7 @@ void CommonULT::TearDownTestCase()
9488
{
9589
printf("%s\n", __FUNCTION__);
9690

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

10293
if(hGmmLib)
10394
{

Source/GmmLib/ULT/GmmCommonULT.h

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

2525
#include "stdafx.h"
2626

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);
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 *);
2942

3043
class CommonULT : public testing::Test
3144
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern "C" {
7070
/////////////////////////////////////////////////////////////////////////////////////
7171
GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFuncs);
7272
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);
73+
GMM_LIB_API void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs);
7474

7575
#ifdef __cplusplus
7676
}

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ OTHER DEALINGS IN THE SOFTWARE.
2222
#pragma once
2323

2424
#if defined(_WIN64 ) || defined(__x86_64__) || defined(__LP64__)
25-
#define GMM_ENTRY_NAME "OpenGmm"
26-
#define GMM_INIT_NAME "InitializeGmm"
27-
#define GMM_DESTROY_NAME "GmmDestroy"
25+
#define GMM_ENTRY_NAME "OpenGmm"
26+
#define GMM_INIT_NAME "GmmInit"
27+
#define GMM_ADAPTER_INIT_NAME "InitializeGmm"
28+
#define GMM_DESTROY_NAME "GmmDestroy"
29+
#define GMM_ADAPTER_DESTROY_NAME "GmmAdapterDestroy"
2830

2931
#if defined(_WIN64)
30-
#define GMM_UMD_DLL "igdgmm64.dll"
32+
#define GMM_UMD_DLL "igdgmm64.dll"
3133
#else
32-
#define GMM_UMD_DLL "libigdgmm.so.11"
34+
#define GMM_UMD_DLL "libigdgmm.so.11"
3335
#endif
3436
#else
35-
#define GMM_ENTRY_NAME "_OpenGmm@4"
36-
37-
#define GMM_INIT_NAME "_InitializeGmm@8"
38-
#define GMM_DESTROY_NAME "_GmmDestroy@4"
37+
#define GMM_ENTRY_NAME "_OpenGmm@4"
38+
#define GMM_INIT_NAME "_GmmInit@48"
39+
#define GMM_ADAPTER_INIT_NAME "_InitializeGmm@8"
40+
#define GMM_DESTROY_NAME "_GmmDestroy@4"
41+
#define GMM_ADAPTER_DESTROY_NAME "_GmmAdapterDestroy@4"
3942

4043
#if defined(_WIN32)
4144
#define GMM_UMD_DLL "igdgmm32.dll"

0 commit comments

Comments
 (0)