Skip to content

Commit

Permalink
Fixing the ABI break
Browse files Browse the repository at this point in the history
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
  • Loading branch information
johnbash committed Dec 20, 2019
1 parent eb2db6f commit ebfcfd5
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 29 deletions.
43 changes: 42 additions & 1 deletion Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp
Expand Up @@ -84,6 +84,37 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFu
return Status;
}

/////////////////////////////////////////////////////////////////////////////////////
/// First Call to GMM Lib DLL/so to initialize singleton global context
/// and create client context
///
/////////////////////////////////////////////////////////////////////////////////////
#ifdef _WIN32
extern "C" GMM_LIB_API GMM_CLIENT_CONTEXT *GMM_STDCALL GmmInit(const PLATFORM Platform,
const SKU_FEATURE_TABLE *pSkuTable,
const WA_TABLE * pWaTable,
const GT_SYSTEM_INFO * pGtSysInfo,
GMM_CLIENT ClientType)
#else
extern "C" GMM_LIB_API GMM_CLIENT_CONTEXT *GMM_STDCALL GmmInit(const PLATFORM Platform,
const void * pSkuTable,
const void * pWaTable,
const void * pGtSysInfo,
GMM_CLIENT ClientType)
#endif
{
GMM_STATUS Status = GMM_SUCCESS;
GMM_CLIENT_CONTEXT *pClientContext = NULL;

Status = GmmCreateSingletonContext(Platform, pSkuTable, pWaTable, pGtSysInfo);

if(Status == GMM_SUCCESS)
{
pClientContext = GmmCreateClientContext(ClientType);
}

return pClientContext;
}
/////////////////////////////////////////////////////////////////////////////////////
// First Call to GMM Lib DLL/so to initialize singleton global context
// and create client context
Expand All @@ -106,10 +137,20 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pI
return Status;
}

/////////////////////////////////////////////////////////////////////////////////////
/// Destroys singleton global context and client context
///
/////////////////////////////////////////////////////////////////////////////////////
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_CLIENT_CONTEXT *pGmmClientContext)
{
GmmDestroySingletonContext();
GmmDeleteClientContext(pGmmClientContext);
}

/////////////////////////////////////////////////////////////////////////////////////
// Destroys singleton global context and client context
/////////////////////////////////////////////////////////////////////////////////////
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_INIT_OUT_ARGS *pInArgs)
extern "C" GMM_LIB_API void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs)
{
if(pInArgs && pInArgs->pGmmClientContext)
{
Expand Down
23 changes: 7 additions & 16 deletions Source/GmmLib/ULT/GmmCommonULT.cpp
Expand Up @@ -57,9 +57,6 @@ void CommonULT::SetUpTestCase()
{
printf("%s\n", __FUNCTION__);

GMM_INIT_IN_ARGS InArgs;
GMM_INIT_OUT_ARGS OutArgs;

if(GfxPlatform.eProductFamily == IGFX_UNKNOWN ||
GfxPlatform.eRenderCoreFamily == IGFX_UNKNOWN_CORE)
{
Expand All @@ -69,23 +66,20 @@ void CommonULT::SetUpTestCase()

AllocateAdapterInfo();

InArgs.ClientType = GMM_EXCITE_VISTA;
InArgs.pGtSysInfo = &pGfxAdapterInfo->SystemInfo;
InArgs.pSkuTable = &pGfxAdapterInfo->SkuTable;
InArgs.pWaTable = &pGfxAdapterInfo->WaTable;
InArgs.Platform = GfxPlatform;

hGmmLib = dlopen(GMM_UMD_DLL, RTLD_LAZY);
ASSERT_TRUE(hGmmLib);

*(void **)(&pfnGmmInit) = dlsym(hGmmLib, "InitializeGmm");
*(void **)(&pfnGmmInit) = dlsym(hGmmLib, "GmmInit");
*(void **)(&pfnGmmDestroy) = dlsym(hGmmLib, "GmmDestroy");

ASSERT_TRUE(pfnGmmInit);
ASSERT_TRUE(pfnGmmDestroy);

pfnGmmInit(&InArgs, &OutArgs);
pGmmULTClientContext = OutArgs.pGmmClientContext;
pGmmULTClientContext = pfnGmmInit(GfxPlatform,
&pGfxAdapterInfo->SkuTable,
&pGfxAdapterInfo->WaTable,
&pGfxAdapterInfo->SystemInfo,
GMM_EXCITE_VISTA);

ASSERT_TRUE(pGmmULTClientContext);
}
Expand All @@ -94,10 +88,7 @@ void CommonULT::TearDownTestCase()
{
printf("%s\n", __FUNCTION__);

GMM_INIT_OUT_ARGS OutArgs;
OutArgs.pGmmClientContext = static_cast<GMM_CLIENT_CONTEXT *>(pGmmULTClientContext);

pfnGmmDestroy(&OutArgs);
pfnGmmDestroy(static_cast<GMM_CLIENT_CONTEXT *>(pGmmULTClientContext));

if(hGmmLib)
{
Expand Down
17 changes: 15 additions & 2 deletions Source/GmmLib/ULT/GmmCommonULT.h
Expand Up @@ -24,8 +24,21 @@ OTHER DEALINGS IN THE SOFTWARE.

#include "stdafx.h"

typedef GMM_STATUS (GMM_STDCALL *PFNGMMINIT)(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs);
typedef void(GMM_STDCALL *PFNGMMDESTROY)(GMM_INIT_OUT_ARGS *pInArgs);
typedef GMM_CLIENT_CONTEXT *(GMM_STDCALL * PFNGMMINIT)
#ifdef _WIN32
(const PLATFORM,
const SKU_FEATURE_TABLE *,
const WA_TABLE *,
const GT_SYSTEM_INFO *,
GMM_CLIENT);
#else
(const PLATFORM Platform,
const void * pSkuTable,
const void * pWaTable,
const void * pGtSysInfo,
GMM_CLIENT ClientType);
#endif
typedef void(GMM_STDCALL *PFNGMMDESTROY)(GMM_CLIENT_CONTEXT *);

class CommonULT : public testing::Test
{
Expand Down
2 changes: 1 addition & 1 deletion Source/GmmLib/inc/External/Common/GmmLibDll.h
Expand Up @@ -70,7 +70,7 @@ extern "C" {
/////////////////////////////////////////////////////////////////////////////////////
GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFuncs);
GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs);
GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_INIT_OUT_ARGS *pInArgs);
GMM_LIB_API void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs);

#ifdef __cplusplus
}
Expand Down
21 changes: 12 additions & 9 deletions Source/GmmLib/inc/External/Common/GmmLibDllName.h
Expand Up @@ -22,20 +22,23 @@ OTHER DEALINGS IN THE SOFTWARE.
#pragma once

#if defined(_WIN64 ) || defined(__x86_64__) || defined(__LP64__)
#define GMM_ENTRY_NAME "OpenGmm"
#define GMM_INIT_NAME "InitializeGmm"
#define GMM_DESTROY_NAME "GmmDestroy"
#define GMM_ENTRY_NAME "OpenGmm"
#define GMM_INIT_NAME "GmmInit"
#define GMM_ADAPTER_INIT_NAME "InitializeGmm"
#define GMM_DESTROY_NAME "GmmDestroy"
#define GMM_ADAPTER_DESTROY_NAME "GmmAdapterDestroy"

#if defined(_WIN64)
#define GMM_UMD_DLL "igdgmm64.dll"
#define GMM_UMD_DLL "igdgmm64.dll"
#else
#define GMM_UMD_DLL "libigdgmm.so.11"
#define GMM_UMD_DLL "libigdgmm.so.11"
#endif
#else
#define GMM_ENTRY_NAME "_OpenGmm@4"

#define GMM_INIT_NAME "_InitializeGmm@8"
#define GMM_DESTROY_NAME "_GmmDestroy@4"
#define GMM_ENTRY_NAME "_OpenGmm@4"
#define GMM_INIT_NAME "_GmmInit@48"
#define GMM_ADAPTER_INIT_NAME "_InitializeGmm@8"
#define GMM_DESTROY_NAME "_GmmDestroy@4"
#define GMM_ADAPTER_DESTROY_NAME "_GmmAdapterDestroy@4"

#if defined(_WIN32)
#define GMM_UMD_DLL "igdgmm32.dll"
Expand Down

0 comments on commit ebfcfd5

Please sign in to comment.