Initial Multi adapter changes.

Change-Id: Iedfd8928e887c6412f8df9a2fba2aac13e285ef3
This commit is contained in:
johnbasha shaik 2019-10-22 14:44:49 +05:30
parent 77699a1c8c
commit 94306f5443
7 changed files with 77 additions and 58 deletions

View File

@ -24,11 +24,11 @@ cmake_minimum_required(VERSION 3.5)
project(igfx_gmmumd)
# GmmLib Api Version used for so naming
set(GMMLIB_API_MAJOR_VERSION 11)
set(GMMLIB_API_MAJOR_VERSION 12)
set(GMMLIB_API_MINOR_VERSION 0)
if(NOT DEFINED MAJOR_VERSION)
set(MAJOR_VERSION 11)
set(MAJOR_VERSION 12)
endif()
if(NOT DEFINED MINOR_VERSION)

View File

@ -85,46 +85,36 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFu
}
/////////////////////////////////////////////////////////////////////////////////////
/// First Call to GMM Lib DLL/so to initialize singleton global context
/// and create client context
///
// 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
extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs)
{
GMM_STATUS Status = GMM_SUCCESS;
GMM_CLIENT_CONTEXT *pClientContext = NULL;
GMM_STATUS Status = GMM_ERROR;
Status = GmmCreateSingletonContext(Platform, pSkuTable, pWaTable, pGtSysInfo);
if(Status == GMM_SUCCESS)
if(pInArgs && pOutArgs)
{
pClientContext = GmmCreateClientContext(ClientType);
Status = GmmCreateSingletonContext(pInArgs->Platform, pInArgs->pSkuTable, pInArgs->pWaTable, pInArgs->pGtSysInfo);
if(Status == GMM_SUCCESS)
{
pOutArgs->pGmmClientContext = GmmCreateClientContext(pInArgs->ClientType);
}
}
return pClientContext;
return Status;
}
/////////////////////////////////////////////////////////////////////////////////////
/// Destroys singleton global context and client context
///
// Destroys singleton global context and client context
/////////////////////////////////////////////////////////////////////////////////////
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_CLIENT_CONTEXT *pGmmClientContext)
extern "C" GMM_LIB_API void GMM_STDCALL GmmDestroy(GMM_INIT_OUT_ARGS *pInArgs)
{
GmmDestroySingletonContext();
GmmDeleteClientContext(pGmmClientContext);
if(pInArgs && pInArgs->pGmmClientContext)
{
GmmDeleteClientContext(pInArgs->pGmmClientContext);
GmmDestroySingletonContext();
}
}
#endif // GMM_LIB_DLL

View File

@ -57,6 +57,9 @@ 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)
{
@ -66,20 +69,23 @@ 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, "GmmInit");
*(void **)(&pfnGmmInit) = dlsym(hGmmLib, "InitializeGmm");
*(void **)(&pfnGmmDestroy) = dlsym(hGmmLib, "GmmDestroy");
ASSERT_TRUE(pfnGmmInit);
ASSERT_TRUE(pfnGmmDestroy);
pGmmULTClientContext = pfnGmmInit(GfxPlatform,
&pGfxAdapterInfo->SkuTable,
&pGfxAdapterInfo->WaTable,
&pGfxAdapterInfo->SystemInfo,
GMM_EXCITE_VISTA);
pfnGmmInit(&InArgs, &OutArgs);
pGmmULTClientContext = OutArgs.pGmmClientContext;
ASSERT_TRUE(pGmmULTClientContext);
}
@ -88,7 +94,10 @@ void CommonULT::TearDownTestCase()
{
printf("%s\n", __FUNCTION__);
pfnGmmDestroy(static_cast<GMM_CLIENT_CONTEXT *>(pGmmULTClientContext));
GMM_INIT_OUT_ARGS OutArgs;
OutArgs.pGmmClientContext = static_cast<GMM_CLIENT_CONTEXT *>(pGmmULTClientContext);
pfnGmmDestroy(&OutArgs);
if(hGmmLib)
{

View File

@ -24,21 +24,8 @@ OTHER DEALINGS IN THE SOFTWARE.
#include "stdafx.h"
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 *);
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);
class CommonULT : public testing::Test
{

View File

@ -24,6 +24,21 @@ OTHER DEALINGS IN THE SOFTWARE.
#include "GmmCommonExt.h"
#include "GmmInfo.h"
typedef struct _GMM_INIT_IN_ARGS_
{
PLATFORM Platform;
void *pSkuTable;
void *pWaTable;
void *pGtSysInfo;
uint32_t FileDescriptor;
GMM_CLIENT ClientType;
} GMM_INIT_IN_ARGS;
typedef struct _GMM_INIT_OUT_ARGS_
{
GMM_CLIENT_CONTEXT *pGmmClientContext;
} GMM_INIT_OUT_ARGS;
// Interfaces exported from GMM Lib DLL
typedef struct _GmmExportEntries
{
@ -54,6 +69,8 @@ extern "C" {
/// Only function exported from GMM lib DLL.
/////////////////////////////////////////////////////////////////////////////////////
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);
#ifdef __cplusplus
}

View File

@ -23,23 +23,23 @@ OTHER DEALINGS IN THE SOFTWARE.
#if defined(_WIN64 ) || defined(__x86_64__) || defined(__LP64__)
#define GMM_ENTRY_NAME "OpenGmm"
#define GMM_INIT_NAME "GmmInit"
#define GMM_INIT_NAME "InitializeGmm"
#define GMM_DESTROY_NAME "GmmDestroy"
#if defined(_WIN64)
#define GMM_UMD_DLL "igdgmm64.dll"
#else
#define GMM_UMD_DLL "libigdgmm.so.11"
#define GMM_UMD_DLL "libigdgmm.so.12"
#endif
#else
#define GMM_ENTRY_NAME "_OpenGmm@4"
#define GMM_INIT_NAME "_GmmInit@48"
#define GMM_INIT_NAME "_InitializeGmm@8"
#define GMM_DESTROY_NAME "_GmmDestroy@4"
#if defined(_WIN32)
#define GMM_UMD_DLL "igdgmm32.dll"
#else
#define GMM_UMD_DLL "libigdgmm.so.11"
#define GMM_UMD_DLL "libigdgmm.so.12"
#endif
#endif

View File

@ -134,6 +134,22 @@ typedef struct _KM_DEFERRED_WAIT_INFO
uint32_t ActiveDisplay;
} KM_DEFERRED_WAIT_INFO;
// struct to hold Adapter's BDF
typedef struct _ADAPTER_BDF_
{
union
{
struct
{
uint32_t Bus : 8;
uint32_t Device : 8;
uint32_t Function : 8;
uint32_t Reserved : 8;
};
uint32_t Data;
};
}ADAPTER_BDF;
// Private data structure for D3D callback QueryAdapterInfoCB
//===========================================================================