3131#include " runtime/helpers/hw_info.h"
3232#include " runtime/sku_info/operations/sku_info_transfer.h"
3333
34- extern " C" {
35-
36- void GMMDebugBreak (const char *file, const char *function, const int line) {
37- }
38-
39- void GMMPrintMessage (uint32_t debugLevel, const char *debugMessageFmt, ...) {
40- }
41-
42- typedef struct GfxDebugControlRec {
43- uint32_t Version;
44- uint32_t Size;
45- uint32_t AssertEnableMask;
46- uint32_t EnableDebugFileDump;
47- uint32_t DebugEnableMask;
48- uint32_t RingBufDbgMask;
49- uint32_t ReportAssertEnable;
50- uint32_t AssertBreakDisable;
51-
52- } GFX_DEBUG_CONTROL, *PGFX_DEBUG_CONTROL;
53- PGFX_DEBUG_CONTROL pDebugControl;
54- }
55-
5634namespace OCLRT {
5735void Gmm::create () {
5836 if (resourceParams.BaseWidth >= maxPossiblePitch) {
@@ -71,19 +49,21 @@ bool Gmm::initContext(const PLATFORM *pPlatform,
7149 _WA_TABLE gmmWaTable = {};
7250 SkuInfoTransfer::transferFtrTableForGmm (&gmmFtrTable, pSkuTable);
7351 SkuInfoTransfer::transferWaTableForGmm (&gmmWaTable, pWaTable);
74-
75- bool success = GMM_SUCCESS == GmmInitGlobalContext (*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
52+ if (!isLoaded) {
53+ loadLib ();
54+ }
55+ bool success = GMM_SUCCESS == initGlobalContextFunc (*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
7656 UNRECOVERABLE_IF (!success);
77- Gmm::gmmClientContext = GmmCreateClientContext (GMM_CLIENT::GMM_OCL_VISTA);
57+ Gmm::gmmClientContext = createClientContextFunc (GMM_CLIENT::GMM_OCL_VISTA);
7858 }
7959 return Gmm::gmmClientContext != nullptr ;
8060}
8161
8262void Gmm::destroyContext () {
8363 if (Gmm::gmmClientContext) {
84- GmmDeleteClientContext (Gmm::gmmClientContext);
64+ deleteClientContextFunc (Gmm::gmmClientContext);
8565 Gmm::gmmClientContext = nullptr ;
86- GmmDestroyGlobalContext ();
66+ destroyGlobalContextFunc ();
8767 }
8868}
8969
@@ -414,5 +394,6 @@ bool Gmm::unifiedAuxTranslationCapable() const {
414394
415395bool Gmm::useSimplifiedMocsTable = false ;
416396GMM_CLIENT_CONTEXT *Gmm::gmmClientContext = nullptr ;
397+ bool Gmm::isLoaded = false ;
417398
418399} // namespace OCLRT
0 commit comments