Skip to content

Commit bda1dcf

Browse files
committed
Add new generic API in Clientcontext for getting DeviceCB
and saving this in clientcontext for later use. unlink getting same info from the existing API's CreatePageatlbMgrObject. use the saved info from the ClientContext. Change-Id: I477db65c161701d002880ab04f874c2761f4d3e3
1 parent a09c68f commit bda1dcf

File tree

4 files changed

+93
-14
lines changed

4 files changed

+93
-14
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 10)
27+
set(GMMLIB_API_MAJOR_VERSION 11)
2828
set(GMMLIB_API_MINOR_VERSION 0)
2929

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

3434
if(NOT DEFINED MINOR_VERSION)

Source/GmmLib/GlobalInfo/GmmClientContext.cpp

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ OTHER DEALINGS IN THE SOFTWARE.
3737
GmmLib::GmmClientContext::GmmClientContext(GMM_CLIENT ClientType)
3838
: ClientType(),
3939
pUmdAdapter(),
40-
pGmmUmdContext()
40+
pGmmUmdContext(),
41+
DeviceCB(),
42+
IsDeviceCbReceived(0)
4143
{
4244
this->ClientType = ClientType;
4345
}
@@ -466,12 +468,29 @@ void GMM_STDCALL GmmLib::GmmClientContext::DestroyResInfoObject(GMM_RESOURCE_INF
466468
}
467469
}
468470

471+
/////////////////////////////////////////////////////////////////////////////////////
472+
/// Member function of ClientContext class for creation of PAgeTableMgr Object .
473+
/// @see GmmLib::GMM_PAGETABLE_MGR::GMM_PAGETABLE_MGR
474+
///
475+
/// @param[in] TTFags
476+
/// @return Pointer to GMM_PAGETABLE_MGR class.
477+
/////////////////////////////////////////////////////////////////////////////////////
478+
GMM_PAGETABLE_MGR* GMM_STDCALL GmmLib::GmmClientContext::CreatePageTblMgrObject(uint32_t TTFlags)
479+
{
480+
if (!IsDeviceCbReceived)
481+
{
482+
GMM_ASSERTDPF(0, "Device_callbacks not set");
483+
return NULL;
484+
}
485+
486+
return CreatePageTblMgrObject(&DeviceCB, TTFlags);
487+
}
488+
469489
/////////////////////////////////////////////////////////////////////////////////////
470490
/// Member function of ClientContext class for creation of PAgeTableMgr Object .
471491
/// @see GmmLib::GMM_PAGETABLE_MGR::GMM_PAGETABLE_MGR
472492
///
473493
/// @param[in] pDevCb: Pointer to GMM_DEVICE_CALLBACKS_INT
474-
/// @param[in] pTTCB: Pointer to GMM_TRANSLATIONTABLE_CALLBACKS
475494
/// @param[in] TTFags
476495
/// @return Pointer to GMM_PAGETABLE_MGR class.
477496
//TBD: move the code to new overloaded the API and remove this API once all clients are moved to new API.
@@ -603,12 +622,33 @@ void GMM_STDCALL GmmLib::GmmClientContext::DestroyResInfoObject(GMM_RESOURCE_INF
603622
}
604623
}
605624
#endif
625+
626+
/////////////////////////////////////////////////////////////////////////////////////
627+
/// Member function of ClientContext class for creation of PAgeTableMgr Object .
628+
/// @see GmmLib::GMM_PAGETABLE_MGR::GMM_PAGETABLE_MGR
629+
///
630+
/// @param[in] TTFags
631+
/// @return Pointer to GMM_PAGETABLE_MGR class.
632+
/////////////////////////////////////////////////////////////////////////////////////
633+
GMM_PAGETABLE_MGR* GMM_STDCALL GmmLib::GmmClientContext::CreatePageTblMgrObject(uint32_t TTFlags,
634+
GmmClientAllocationCallbacks* pAllocCbs)
635+
{
636+
if (!IsDeviceCbReceived)
637+
{
638+
GMM_ASSERTDPF(0, "Device_callbacks not set");
639+
return NULL;
640+
}
641+
return CreatePageTblMgrObject(
642+
&DeviceCB,
643+
TTFlags,
644+
pAllocCbs);
645+
}
646+
606647
/////////////////////////////////////////////////////////////////////////////////////
607648
/// Member function of ClientContext class for creation of PAgeTableMgr Object .
608649
/// @see GmmLib::GMM_PAGETABLE_MGR::GMM_PAGETABLE_MGR
609650
///
610651
/// @param[in] pDevCb: Pointer to GMM_DEVICE_CALLBACKS_INT
611-
/// @param[in] pTTCB: Pointer to GMM_TRANSLATIONTABLE_CALLBACKS
612652
/// @param[in] TTFags
613653
/// @return Pointer to GMM_PAGETABLE_MGR class.
614654
/// TBD: move the code to new overloaded the API and remove this API once all clients are moved to new API.
@@ -646,6 +686,27 @@ void GMM_STDCALL GmmLib::GmmClientContext::DestroyPageTblMgrObject(GMM_PAGETABLE
646686
}
647687
}
648688

689+
////////////////////////////////////////////////////////////////////////////////////
690+
/// Member function of ClientContext class for doing device specific operations.
691+
/// Clients must call it before any Gfx resource (incl. svm)
692+
/// is mapped, must happen before any use of GfxPartition, or PageTableMgr init.
693+
/// @param[in] DeviceInfo : Pointer to info related to Device Operations.
694+
/// @return GMM_STATUS.
695+
//////////////////////////////////////////////////////////////////////////////////////////
696+
GMM_STATUS GMM_STDCALL GmmLib::GmmClientContext::GmmSetDeviceInfo(GMM_DEVICE_INFO* DeviceInfo)
697+
{
698+
GMM_STATUS Status = GMM_SUCCESS;
699+
700+
if (DeviceInfo == NULL || DeviceInfo->pDeviceCb == NULL)
701+
{
702+
return GMM_INVALIDPARAM;
703+
}
704+
705+
DeviceCB = *(DeviceInfo->pDeviceCb);
706+
IsDeviceCbReceived = 1;
707+
return Status;
708+
}
709+
649710
/////////////////////////////////////////////////////////////////////////////////////
650711
/// Gmm lib DLL exported C wrapper for creating GmmLib::GmmClientContext object
651712
/// @see Class GmmLib::GmmClientContext

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

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ typedef struct _GmmClientAllocationCallbacks_
4747
PFN_ClientFreeFunction pfnFree;
4848
} GmmClientAllocationCallbacks;
4949

50+
//===========================================================================
51+
// typedef:
52+
// GMM_DEVICE_OPERATION
53+
//
54+
// Description:
55+
// Decribes compoents required for device operations.
56+
//---------------------------------------------- ------------------------------
57+
typedef struct _GMM_DEVICE_INFO_REC
58+
{
59+
GMM_DEVICE_CALLBACKS_INT *pDeviceCb;
60+
}GMM_DEVICE_INFO;
5061

5162
#ifdef __cplusplus
5263
#include "GmmMemAllocator.hpp"
@@ -71,7 +82,9 @@ namespace GmmLib
7182
///< Placeholders for storing UMD context. Actual UMD context that needs to be stored here is TBD
7283
void *pUmdAdapter;
7384
GMM_UMD_CONTEXT *pGmmUmdContext;
74-
85+
GMM_DEVICE_CALLBACKS_INT DeviceCB; //OS-specific defn: Will be used by Clients to send as input arguments.
86+
// Flag to indicate Device_callbacks received.
87+
uint8_t IsDeviceCbReceived;
7588
public:
7689
/* Constructor */
7790
GmmClientContext(GMM_CLIENT ClientType);
@@ -122,6 +135,12 @@ namespace GmmLib
122135
GMM_VIRTUAL GMM_RESOURCE_INFO* GMM_STDCALL CopyResInfoObject(GMM_RESOURCE_INFO *pSrcRes);
123136
GMM_VIRTUAL void GMM_STDCALL ResMemcpy(void *pDst, void *pSrc);
124137
GMM_VIRTUAL void GMM_STDCALL DestroyResInfoObject(GMM_RESOURCE_INFO *pResInfo);
138+
/* PageTableMgr Creation and Destroy API's */
139+
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(GMM_DEVICE_CALLBACKS_INT* pDevCb, uint32_t TTFlags);
140+
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(uint32_t TTFlags);
141+
/* PageTableMgr Creation and Destroy API's */
142+
GMM_VIRTUAL void GMM_STDCALL DestroyPageTblMgrObject(GMM_PAGETABLE_MGR* pPageTableMgr);
143+
125144

126145
#ifdef GMM_LIB_DLL
127146
/* ResourceInfo and PageTableMgr Create and Destroy APIs with Client provided Memory Allocators */
@@ -130,18 +149,17 @@ namespace GmmLib
130149
GMM_VIRTUAL void GMM_STDCALL DestroyResInfoObject(GMM_RESOURCE_INFO *pResInfo,
131150
GmmClientAllocationCallbacks *pAllocCbs);
132151
#endif
133-
134-
/* PageTableMgr Creation and Destroy API's */
135-
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(GMM_DEVICE_CALLBACKS_INT *pDevCb, uint32_t TTFlags);
136-
/* PageTableMgr Creation and Destroy API's */
137-
GMM_VIRTUAL void GMM_STDCALL DestroyPageTblMgrObject(GMM_PAGETABLE_MGR *pPageTableMgr);
138-
152+
139153
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(
140154
GMM_DEVICE_CALLBACKS_INT* pDevCb,
141155
uint32_t TTFlags,
142156
GmmClientAllocationCallbacks* pAllocCbs);
157+
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(
158+
uint32_t TTFlags,
159+
GmmClientAllocationCallbacks* pAllocCbs);
143160
GMM_VIRTUAL void GMM_STDCALL DestroyPageTblMgrObject(GMM_PAGETABLE_MGR* pPageTableMgr,
144161
GmmClientAllocationCallbacks* pAllocCbs);
162+
GMM_VIRTUAL GMM_STATUS GMM_STDCALL GmmSetDeviceInfo(GMM_DEVICE_INFO* DeviceInfo);
145163
};
146164
}
147165

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
2929
#if defined(_WIN64)
3030
#define GMM_UMD_DLL "igdgmm64.dll"
3131
#else
32-
#define GMM_UMD_DLL "libigdgmm.so.10"
32+
#define GMM_UMD_DLL "libigdgmm.so.11"
3333
#endif
3434
#else
3535
#define GMM_ENTRY_NAME "_OpenGmm@4"
@@ -40,6 +40,6 @@ OTHER DEALINGS IN THE SOFTWARE.
4040
#if defined(_WIN32)
4141
#define GMM_UMD_DLL "igdgmm32.dll"
4242
#else
43-
#define GMM_UMD_DLL "libigdgmm.so.10"
43+
#define GMM_UMD_DLL "libigdgmm.so.11"
4444
#endif
4545
#endif

0 commit comments

Comments
 (0)