Skip to content

Commit b1451bb

Browse files
committed
Add ClientContext class
Special MOCS handling Remove client specific definitions for GMM_ASSERT and GMM_DEBUG macros Change-Id: I8360f07277678a67a68c311061fde3400726a874
1 parent 0154744 commit b1451bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2591
-1482
lines changed

Source/Common/AssertTracer/AssertTracer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ void __stdcall ReportAssert(
9292

9393
// Checks against maximum string size for ReportEvent lpStrings parameter.
9494
// Cuts string to the limit size.
95-
uint32_t maxSizeReached = false;
95+
uint32_t maxSizeReached = 0;
9696
if ( length > 31839 )
9797
{
9898
length = 31839;
99-
maxSizeReached = true;
99+
maxSizeReached = 1;
100100
}
101101

102102
wideMessage = ( char * ) malloc( sizeof( char ) * length );
@@ -352,7 +352,7 @@ void LogAssertion( const char *function_name, const char *file_name, unsigned in
352352
syslogEntry = fullMsg.substr( pos, MAX_SYSLOG_ENTRY_LENGTH );
353353
// Add chunk ID / part number and send to syslog
354354
syslog( LOG_MAKEPRI( LOG_USER,
355-
LOG_ERR ), "[%d/%d]%s", ( pos / MAX_SYSLOG_ENTRY_LENGTH + 1 ), numberOfChunks,
355+
LOG_ERR ), "[%zd/%d]%s", ( pos / MAX_SYSLOG_ENTRY_LENGTH + 1 ), numberOfChunks,
356356
syslogEntry.c_str() );
357357
pos += MAX_SYSLOG_ENTRY_LENGTH;
358358
}

Source/GmmLib/CMakeLists.txt

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,13 @@ foreach(lib_target ${TARGET_LIST})
9696
GmmLibSetTargetConfig(${lib_target})
9797
endforeach()
9898

99-
#GmmLibSetTargetConfig(igfx_gmmkmd)
100-
10199
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /W1 /WX-")
102100
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /W1 /WX-")
103101

104102
# GMMLIBsetLinkerFlags: apply linker flags for given configuration
105103
# linkerFlags: linker specific options
106104
# linkerTarget: optional parameter - apply linker flags for specfied target
107-
macro (GMMLIBsetLinkerFlags linkerFlags linkerTarget)
105+
macro (GMMLIBsetLinkerFlags linkerFlags linkerTarget)
108106
foreach (opt ${linkerFlags})
109107
if ("${linkerTarget}" STREQUAL "")
110108
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${opt}")
@@ -124,7 +122,7 @@ set( CMAKE_CONFIGURATION_TYPES
124122
set( CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
125123
"Reset the configurations to what we need"
126124
FORCE)
127-
125+
128126

129127
set(GMMLIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
130128

@@ -233,6 +231,7 @@ set(HEADERS_
233231

234232
set(UMD_HEADERS
235233
${HEADERS_}
234+
${BS_DIR_GMMLIB}/inc/External/Common/GmmClientContext.h
236235
)
237236

238237

@@ -270,12 +269,14 @@ set(SOURCES_
270269

271270
set(UMD_SOURCES
272271
${SOURCES_}
272+
${BS_DIR_GMMLIB}/GlobalInfo/GmmClientContext.cpp
273273
)
274274

275275
source_group("Source Files\\Cache Policy\\Client Files" FILES
276276
${BS_DIR_GMMLIB}/CachePolicy/GmmCachePolicyResourceUsageDefinitions.h
277277
${BS_DIR_GMMLIB}/CachePolicy/GmmGen10CachePolicy.h
278278
${BS_DIR_GMMLIB}/CachePolicy/GmmGen8CachePolicy.h
279+
${BS_DIR_GMMLIB}/CachePolicy/GmmGen9CachePolicy.h
279280
)
280281

281282
source_group("Source Files\\Cache Policy" ${BS_DIR_GMMLIB}/CachePolicy/*.cpp)
@@ -310,6 +311,7 @@ source_group("Header Files\\External\\Common" FILES
310311
${BS_DIR_GMMLIB}/inc/External/Common/GmmResourceInfoExt.h
311312
${BS_DIR_GMMLIB}/inc/External/Common/GmmTextureExt.h
312313
${BS_DIR_GMMLIB}/inc/External/Common/GmmUtil.h
314+
${BS_DIR_GMMLIB}/inc/External/Common/GmmClientContext.h
313315
)
314316

315317
source_group("Header Files" FILES
@@ -388,10 +390,10 @@ macro (GmmLibaddCommonTargetDefines target)
388390
endmacro()
389391

390392
#clear all default-cmake settings
391-
SET (CMAKE_SHARED_LINKER_FLAGS_RELEASEINTERNAL "")
392-
SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE "")
393-
SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG "")
394-
SET (CMAKE_SHARED_LINKER_FLAGS "")
393+
SET (CMAKE_SHARED_LINKER_FLAGS_RELEASEINTERNAL "")
394+
SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE "")
395+
SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG "")
396+
SET (CMAKE_SHARED_LINKER_FLAGS "")
395397

396398
SET (CMAKE_EXE_LINKER_FLAGS "")
397399
SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "")
@@ -431,11 +433,12 @@ if(MSVC)
431433
endforeach()
432434
endif()
433435

436+
bs_set_force_exceptions()
434437

435438
bs_set_post_target()
436439

437440
foreach(lib_target ${TARGET_LIST})
438-
bs_set_extra_target_properties( ${lib_target}
441+
bs_set_extra_target_properties(${lib_target}
439442
_ATL_NO_WIN_SUPPORT
440443
SMALL_POOL_ALLOC
441444
__GMM
@@ -448,18 +451,18 @@ foreach(lib_target ${TARGET_LIST})
448451
bs_set_extra_target_properties(${lib_target} _RELEASE_INTERNAL)
449452
endif()
450453

451-
target_include_directories(${lib_target} INTERFACE
454+
target_include_directories(${lib_target} INTERFACE
452455
${BS_DIR_GMMLIB}/inc
453456
${BS_DIR_INC}
454-
${BS_DIR_INC}/common)
455-
457+
${BS_DIR_INC}/common)
458+
456459
endforeach()
457460

458-
if("${GMM_CLIENT_TYPE}" STREQUAL "OCL")
459-
bs_set_extra_target_properties(gmm_umd
461+
if ("${GMM_CLIENT_TYPE}" STREQUAL "OCL")
462+
bs_set_extra_target_properties(gmm_umd
460463
GMM_OCL
461-
UNUSED_ISTDLIB_MT
462-
)
464+
UNUSED_ISTDLIB_MT
465+
)
463466
else()
464467
bs_set_extra_target_properties(gmm_umd
465468
GMM_OGL

Source/GmmLib/CachePolicy/GmmCachePolicy.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,15 @@ uint32_t GMM_STDCALL GmmCachePolicyGetMaxL1HdcMocsIndex(void)
143143
GmmLib::GmmGen9CachePolicy *ptr = static_cast<GmmLib::GmmGen9CachePolicy*>(pCachePolicy);
144144
return ptr->CurrentMaxL1HdcMocsIndex;
145145
}
146+
147+
/////////////////////////////////////////////////////////////////////////////////////
148+
/// Returns count of current Special MOCS values for MOCS Table programming at GMM boot
149+
///
150+
/// @param[in] none:
151+
/// @return uint32_t max special mocs index needed to program
152+
/////////////////////////////////////////////////////////////////////////////////////
153+
uint32_t GMM_STDCALL GmmCachePolicyGetMaxSpecialMocsIndex(void)
154+
{
155+
GMM_CACHE_POLICY *pCachePolicy = pGmmGlobalContext->GetCachePolicyObj();
156+
return pCachePolicy->GetMaxSpecialMocsIndex();
157+
}

Source/GmmLib/CachePolicy/GmmCachePolicyCommon.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ void GmmLib::GmmCachePolicyCommon::OverrideCachePolicy()
4242
int32_t DefaultEnable = 0, DefaultLLC = 0, DefaultELLC = 0, DefaultL3 = 0;
4343
int32_t DefaultAge = 0, DefaultWT = 0, DefaultAOM = 0, DefaultLeCC_SCC = 0;
4444
int32_t DefaultL3_SCC = 0, DefaultSCF = 0, DefaultHDCL1 = 0, DefaultSSO = 0;
45-
int32_t DefaultCoS = 0;
45+
int32_t DefaultCoS = 0, DefaultL3Eviction = 0;
4646

4747
// Variables used in the REG_OVERRIDE macro block
48-
int32_t Enable = 0, LLC = -1, ELLC = -1, L3 = -1, Age = -1, WT = -1, AOM = -1, LeCC_SCC = -1, L3_SCC = -1, SCF = -1, SSO = -1, CoS = -1, HDCL1 = -1;
48+
int32_t Enable = 0, LLC = -1, ELLC = -1, L3 = -1, Age = -1, WT = -1, AOM = -1, LeCC_SCC = -1, L3_SCC = -1, SCF = -1, SSO = -1, CoS = -1, HDCL1 = -1, L3Eviction = -1;
4949

5050
#define READ_DEFAULT_OVERRIDE(CacheParam) \
5151
{ \
@@ -108,7 +108,11 @@ void GmmLib::GmmCachePolicyCommon::OverrideCachePolicy()
108108
{ \
109109
pCachePolicy[Usage].HDCL1 = DefaultHDCL1; \
110110
} \
111-
} \
111+
if (DefaultL3Eviction != -1) \
112+
{ \
113+
pCachePolicy[Usage].L3Eviction = DefaultL3Eviction; \
114+
} \
115+
} \
112116
}
113117

114118
#ifdef __GMM_KMD__
@@ -137,6 +141,7 @@ void GmmLib::GmmCachePolicyCommon::OverrideCachePolicy()
137141
READ_DEFAULT_OVERRIDE(SSO);
138142
READ_DEFAULT_OVERRIDE(CoS);
139143
READ_DEFAULT_OVERRIDE(HDCL1);
144+
READ_DEFAULT_OVERRIDE(L3Eviction);
140145
}
141146

142147
OVERRIDE_DEFAULT(GMM_RESOURCE_USAGE_UNKNOWN); REG_OVERRIDE(GMM_RESOURCE_USAGE_UNKNOWN);

Source/GmmLib/CachePolicy/GmmCachePolicyResourceUsageDefinitions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STAGING )
7979
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STENCIL_BUFFER )
8080
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER )
8181
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILE_POOL )
82+
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MOCS_62 )
83+
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_L3_EVICTION )
84+
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_L3_EVICTION_SPECIAL )
85+
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CCS_MEDIA_WRITABLE )
8286
//TODO: To substitute with Interface to set SCF once its available for UMDs
8387
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS )
8488

Source/GmmLib/CachePolicy/GmmGen10CachePolicy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ GMM_STATUS GmmLib::GmmGen10CachePolicy::InitCachePolicy() {
4141

4242
__GMM_ASSERTPTR(pCachePolicy,GMM_ERROR);
4343

44-
#define DEFINE_CACHE_ELEMENT(usage, llc, ellc, l3, wt, age, lecc_scc, l3_scc, sso, cos, hdcl1) DEFINE_CP_ELEMENT(usage,llc,ellc,l3,wt,age,0,lecc_scc,l3_scc,0,sso,cos,hdcl1)
44+
#define DEFINE_CACHE_ELEMENT(usage, llc, ellc, l3, wt, age, lecc_scc, l3_scc, sso, cos, hdcl1) DEFINE_CP_ELEMENT(usage,llc,ellc,l3,wt,age,0,lecc_scc,l3_scc,0,sso,cos,hdcl1, 0)
4545
#include "GmmGen10CachePolicy.h"
4646

4747
#define TC_LLC (1)
@@ -354,7 +354,7 @@ GMM_STATUS GmmLib::GmmGen10CachePolicy::SetupPAT()
354354
GMM_GFX_TARGET_CACHE GfxTargetCache = GMM_GFX_TC_ELLC_LLC;
355355
uint8_t Age = 1;
356356
uint8_t ServiceClass = 0;
357-
int32_t *pPrivatePATTableMemoryType = NULL;
357+
int32_t *pPrivatePATTableMemoryType = NULL;
358358
pPrivatePATTableMemoryType = pGmmGlobalContext->GetPrivatePATTableMemoryType();
359359

360360
__GMM_ASSERT(pGmmGlobalContext->GetSkuTable().FtrIA32eGfxPTEs);

Source/GmmLib/CachePolicy/GmmGen8CachePolicy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ GMM_STATUS GmmLib::GmmGen8CachePolicy::InitCachePolicy()
3939

4040
__GMM_ASSERTPTR(pCachePolicy,GMM_ERROR);
4141

42-
#define DEFINE_CACHE_ELEMENT(usage,llc,ellc,l3,wt,age) DEFINE_CP_ELEMENT(usage,llc,ellc,l3,wt,age,0,0,0,0,0,0,0)
42+
#define DEFINE_CACHE_ELEMENT(usage,llc,ellc,l3,wt,age) DEFINE_CP_ELEMENT(usage,llc,ellc,l3,wt,age,0,0,0,0,0,0,0,0)
4343
#include "GmmGen8CachePolicy.h"
4444

4545
{
@@ -150,7 +150,7 @@ GMM_STATUS GmmLib::GmmGen8CachePolicy::SetupPAT()
150150
GMM_GFX_TARGET_CACHE GfxTargetCache = GMM_GFX_TC_ELLC_LLC;
151151
uint8_t Age = 1;
152152
uint8_t ServiceClass = 0;
153-
int32_t *pPrivatePATTableMemoryType = NULL;
153+
int32_t *pPrivatePATTableMemoryType = NULL;
154154

155155
pPrivatePATTableMemoryType = pGmmGlobalContext->GetPrivatePATTableMemoryType();
156156

Source/GmmLib/CachePolicy/GmmGen9CachePolicy.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,27 @@ GMM_STATUS GmmLib::GmmGen9CachePolicy::InitCachePolicy() {
4848
__GMM_ASSERTPTR(pCachePolicy,GMM_ERROR);
4949

5050
#if !defined(I915_GEN9_MOCS)
51-
#define DEFINE_CACHE_ELEMENT(usage, llc, ellc, l3, age, i915) DEFINE_CP_ELEMENT(usage, llc, ellc, l3, 0, age, 0, 0, 0, 0, 0, 0, 0)
51+
#define DEFINE_CACHE_ELEMENT(usage, llc, ellc, l3, age, i915) DEFINE_CP_ELEMENT(usage, llc, ellc, l3, 0, age, 0, 0, 0, 0, 0, 0, 0, 0)
5252
#else
5353
// i915 only supports three GEN9 MOCS entires:
5454
// MOCS[0]...LLC=0, ELLC=0, L3=0, AGE=0
5555
// MOCS[1]...<N/A for GmmLib Purposes>
5656
// MOCS[2]...LLC=1, ELLC=1, L3=1, AGE=3
57-
#define DEFINE_CACHE_ELEMENT(usage, llc, ellc, l3, age, i915) \
58-
do { \
59-
if((i915) == 0) \
60-
{ \
61-
DEFINE_CP_ELEMENT(usage, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); \
62-
} \
63-
else if((i915) == 2) \
64-
{ \
65-
DEFINE_CP_ELEMENT(usage, 1, 1, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0); \
66-
} \
67-
else \
68-
{ \
69-
GMM_ASSERTDPF(0 , "Invalid i915 MOCS specified"); \
70-
} \
71-
} while(0) //////////////////////////////////////////////////////////////
57+
#define DEFINE_CACHE_ELEMENT(usage, llc, ellc, l3, age, i915) \
58+
do { \
59+
if((i915) == 0) \
60+
{ \
61+
DEFINE_CP_ELEMENT(usage, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); \
62+
} \
63+
else if((i915) == 2) \
64+
{ \
65+
DEFINE_CP_ELEMENT(usage, 1, 1, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0); \
66+
} \
67+
else \
68+
{ \
69+
GMM_ASSERTDPF(0 , "Invalid i915 MOCS specified"); \
70+
} \
71+
} while(0) ////////////////////////////////////////////////////////////////
7272
#endif
7373
#include "GmmGen9CachePolicy.h"
7474

@@ -161,9 +161,9 @@ GMM_STATUS GmmLib::GmmGen9CachePolicy::InitCachePolicy() {
161161
// Process the cache policy and fill in the look up table
162162
for(uint32_t Usage = 0; Usage < GMM_RESOURCE_USAGE_MAX ; Usage++)
163163
{
164-
bool CachePolicyError = false;
165-
uint32_t PTEValue = 0;
166-
int32_t CPTblIdx = -1;
164+
bool CachePolicyError = false;
165+
uint32_t PTEValue = 0;
166+
int32_t CPTblIdx = -1;
167167
uint32_t j = 0;
168168
GMM_CACHE_POLICY_TBL_ELEMENT UsageEle = { 0 };
169169
UsageEle.LeCC.Reserved = 0; // Reserved bits zeroe'd, this is so we

0 commit comments

Comments
 (0)