diff --git a/Source/GmmLib/CachePolicy/GmmGen12dGPUCachePolicy.cpp b/Source/GmmLib/CachePolicy/GmmGen12dGPUCachePolicy.cpp index b5eaf19..1b07c49 100644 --- a/Source/GmmLib/CachePolicy/GmmGen12dGPUCachePolicy.cpp +++ b/Source/GmmLib/CachePolicy/GmmGen12dGPUCachePolicy.cpp @@ -106,8 +106,9 @@ GMM_STATUS GmmLib::GmmGen12dGPUCachePolicy::InitCachePolicy() { SetUpMOCSTable(); } - - if(GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_PVC) + + const GMM_PLATFORM_INFO &ContextInfo = pGmmLibContext->GetPlatformInfo(); + if(GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_PVC) { SetupPAT(); } @@ -135,7 +136,7 @@ GMM_STATUS GmmLib::GmmGen12dGPUCachePolicy::InitCachePolicy() GMM_PRIVATE_PAT UsagePATElement = {0}; - switch(GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform)) + switch(GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform)) { case IGFX_DG1: case IGFX_XE_HP_SDV: @@ -152,14 +153,14 @@ GMM_STATUS GmmLib::GmmGen12dGPUCachePolicy::InitCachePolicy() } // No Special MOCS handling for next platform - if(GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) < IGFX_DG2) + if(GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) < IGFX_DG2) { CPTblIdx = IsSpecialMOCSUsage((GMM_RESOURCE_USAGE_TYPE)Usage, SpecialMOCS); } // Applicable upto Xe_HP only if(pCachePolicy[Usage].HDCL1 && - (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) <= IGFX_XE_HP_SDV)) + (GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) <= IGFX_XE_HP_SDV)) { UsageEle.HDCL1 = 1; } @@ -176,7 +177,7 @@ GMM_STATUS GmmLib::GmmGen12dGPUCachePolicy::InitCachePolicy() UsageEle.L3.SCC = (uint16_t)pCachePolicy[Usage].L3_SCC; } - if(GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_PVC) + if(GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_PVC) { pCachePolicy[Usage].GlbGo = 0; pCachePolicy[Usage].UcLookup = 0; @@ -187,7 +188,7 @@ GMM_STATUS GmmLib::GmmGen12dGPUCachePolicy::InitCachePolicy() // Applicable for IGFX_XE_HP_SDV and DG2 only if(!SpecialMOCS && (FROMPRODUCT(XE_HP_SDV)) && - (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) != IGFX_PVC)) + (GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) != IGFX_PVC)) { if(pCachePolicy[Usage].L3 == 0) { @@ -277,7 +278,7 @@ GMM_STATUS GmmLib::GmmGen12dGPUCachePolicy::InitCachePolicy() pCachePolicy[Usage].PTE.DwordValue = PTEValue & 0xFFFFFFFF; pCachePolicy[Usage].PTE.HighDwordValue = 0; - pCachePolicy[Usage].MemoryObjectOverride.Gen12.Index = CPTblIdx; + pCachePolicy[Usage].MemoryObjectOverride.Gen12.Index = CPTblIdx; pCachePolicy[Usage].Override = ALWAYS_OVERRIDE; @@ -286,7 +287,7 @@ GMM_STATUS GmmLib::GmmGen12dGPUCachePolicy::InitCachePolicy() GMM_ASSERTDPF("Cache Policy Init Error: Invalid Cache Programming - Element %d", Usage); } - if(GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_PVC) + if(GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_PVC) { // PAT data { @@ -369,7 +370,8 @@ void GmmLib::GmmGen12dGPUCachePolicy::SetUpMOCSTable() // clang-format off - if (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_DG1) + const GMM_PLATFORM_INFO &ContextInfo = pGmmLibContext->GetPlatformInfo(); + if (GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_DG1) { //Default MOCS Table for(int index = 0; index < GMM_MAX_NUMBER_MOCS_INDEXES; index++) @@ -399,7 +401,7 @@ void GmmLib::GmmGen12dGPUCachePolicy::SetUpMOCSTable() CurrentMaxSpecialMocsIndex = 63; } - else if (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_XE_HP_SDV) + else if (GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_XE_HP_SDV) { //Default MOCS Table for(int index = 0; index < GMM_MAX_NUMBER_MOCS_INDEXES; index++) @@ -425,7 +427,7 @@ void GmmLib::GmmGen12dGPUCachePolicy::SetUpMOCSTable() CurrentMaxSpecialMocsIndex = 63; } - else if ((GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_DG2)) + else if ((GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_DG2)) { //Default MOCS Table for(int index = 0; index < GMM_MAX_NUMBER_MOCS_INDEXES; index++) @@ -441,7 +443,7 @@ void GmmLib::GmmGen12dGPUCachePolicy::SetUpMOCSTable() CurrentMaxMocsIndex = 3; } - else if (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_PVC) + else if (GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_PVC) { //Default MOCS Table for(int index = 0; index < GMM_MAX_NUMBER_MOCS_INDEXES; index++) diff --git a/Source/GmmLib/CachePolicy/GmmXe2_LPGCachePolicy.cpp b/Source/GmmLib/CachePolicy/GmmXe2_LPGCachePolicy.cpp index d8c7642..1059069 100644 --- a/Source/GmmLib/CachePolicy/GmmXe2_LPGCachePolicy.cpp +++ b/Source/GmmLib/CachePolicy/GmmXe2_LPGCachePolicy.cpp @@ -350,10 +350,11 @@ void GmmLib::GmmXe2_LPGCachePolicy::GetL3L4(GMM_CACHE_POLICY_TBL_ELEMENT *pUsage ///////////////////////////////////////////////////////////////////////////////////// uint32_t GMM_STDCALL GmmLib::GmmXe2_LPGCachePolicy::CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable) { - __GMM_ASSERT(pGmmLibContext->GetCachePolicyElement(Usage).Initialized); + const GMM_CACHE_POLICY_ELEMENT &CachePolicyElement = pGmmLibContext->GetCachePolicyElement(Usage); + __GMM_ASSERT(CachePolicyElement.Initialized); - uint32_t PATIndex = pGmmLibContext->GetCachePolicyElement(Usage).PATIndex; - GMM_CACHE_POLICY_ELEMENT TempElement = pGmmLibContext->GetCachePolicyElement(Usage); + uint32_t PATIndex = CachePolicyElement.PATIndex; + GMM_CACHE_POLICY_ELEMENT TempElement = CachePolicyElement; uint32_t TempCoherentPATIndex = 0; // This is to check if PATIndexCompressed, CoherentPATIndex are valid @@ -364,7 +365,7 @@ uint32_t GMM_STDCALL GmmLib::GmmXe2_LPGCachePolicy::CachePolicyGetPATIndex(GMM_R // Higher bit of CoherentPATIndex would tell us if its a valid or not.0--> valid, 1-->invalid uint32_t CoherentPATIndex = (uint32_t)((GET_COHERENT_PATINDEX_HIGHER_BIT(TempCoherentPATIndex) == 1) ? GMM_PAT_ERROR : GET_COHERENT_PATINDEX_VALUE(pGmmLibContext, Usage)); //For PATIndexCompressed, rollover value would be 0 if its invalid - uint32_t PATIndexCompressed = (uint32_t)(TempElement.PATIndexCompressed == 0 ? GMM_PAT_ERROR : pGmmLibContext->GetCachePolicyElement(Usage).PATIndexCompressed); + uint32_t PATIndexCompressed = (uint32_t)(TempElement.PATIndexCompressed == 0 ? GMM_PAT_ERROR : CachePolicyElement.PATIndexCompressed); uint32_t ReturnPATIndex = GMM_PAT_ERROR; bool CompressionEnable = (pCompressionEnable) ? *pCompressionEnable : false; diff --git a/Source/GmmLib/GlobalInfo/GmmInfo.cpp b/Source/GmmLib/GlobalInfo/GmmInfo.cpp index f7038ec..9cec652 100644 --- a/Source/GmmLib/GlobalInfo/GmmInfo.cpp +++ b/Source/GmmLib/GlobalInfo/GmmInfo.cpp @@ -1057,17 +1057,18 @@ void GMM_STDCALL GmmLib::Context::DestroyContext() void GMM_STDCALL GmmLib::Context::OverrideSkuWa() { - if((GFX_GET_CURRENT_PRODUCT(this->GetPlatformInfo().Platform) < IGFX_XE_HP_SDV)) + const GMM_PLATFORM_INFO &ContextInfo = this->GetPlatformInfo(); + if((GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) < IGFX_XE_HP_SDV)) { SkuTable.FtrTileY = true; } - if(GFX_GET_CURRENT_PRODUCT(this->GetPlatformInfo().Platform) == IGFX_PVC) + if(GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) == IGFX_PVC) { SkuTable.Ftr57bGPUAddressing = true; } - if (GFX_GET_CURRENT_PRODUCT(this->GetPlatformInfo().Platform) >= IGFX_LUNARLAKE) + if (GFX_GET_CURRENT_PRODUCT(ContextInfo.Platform) >= IGFX_LUNARLAKE) { // FtrL3TransientDataFlush is always enabled for XE2 adding GMM Override if UMDs might have reset this. SkuTable.FtrL3TransientDataFlush = true; diff --git a/Source/GmmLib/Platform/GmmGen10Platform.cpp b/Source/GmmLib/Platform/GmmGen10Platform.cpp index d5fe83d..d00f2f0 100644 --- a/Source/GmmLib/Platform/GmmGen10Platform.cpp +++ b/Source/GmmLib/Platform/GmmGen10Platform.cpp @@ -207,12 +207,13 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform, Context *pGmmLi // RT & Texture2DSurface restrictions. Inst Ref: SURFACE_STATE // Greatest common restriction source comes from 8bpp RT // -------------------------- + const WA_TABLE &WaTable = pGmmLibContext->GetWaTable(); Data.Texture2DSurface.Alignment = PAGE_SIZE; Data.Texture2DSurface.PitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.LockPitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.RenderPitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.MinPitch = GMM_BYTES(32); - Data.Texture2DSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.Texture2DSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.Texture2DSurface.MinAllocationSize = PAGE_SIZE; Data.Texture2DSurface.MinHeight = GMM_SCANLINES(1); Data.Texture2DSurface.MinWidth = GMM_PIXELS(1); @@ -277,7 +278,7 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform, Context *pGmmLi Data.CubeSurface.LockPitchAlignment = GMM_BYTES(32); Data.CubeSurface.RenderPitchAlignment = GMM_BYTES(32); Data.CubeSurface.MinPitch = GMM_BYTES(32); - Data.CubeSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.CubeSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.CubeSurface.MinAllocationSize = PAGE_SIZE; Data.CubeSurface.MinHeight = GMM_SCANLINES(1); Data.CubeSurface.MinWidth = GMM_PIXELS(1); @@ -296,7 +297,7 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform, Context *pGmmLi Data.Texture3DSurface.LockPitchAlignment = GMM_BYTES(32); Data.Texture3DSurface.RenderPitchAlignment = GMM_BYTES(32); Data.Texture3DSurface.MinPitch = GMM_BYTES(32); - Data.Texture3DSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.Texture3DSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.Texture3DSurface.MinAllocationSize = PAGE_SIZE; Data.Texture3DSurface.MinHeight = GMM_SCANLINES(1); Data.Texture3DSurface.MinWidth = GMM_PIXELS(1); @@ -328,7 +329,7 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform, Context *pGmmLi // -------------------------- // Cursor surface restricion. Register Ref: CURACNTR, CURABASE // -------------------------- - Data.Cursor.Alignment = pGmmLibContext->GetWaTable().WaCursor16K ? GMM_KBYTE(16) : PAGE_SIZE; + Data.Cursor.Alignment = WaTable.WaCursor16K ? GMM_KBYTE(16) : PAGE_SIZE; Data.Cursor.PitchAlignment = 1; Data.Cursor.LockPitchAlignment = 1; Data.Cursor.RenderPitchAlignment = 1; @@ -439,7 +440,7 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform, Context *pGmmLi //-------------------------- // Fence paramaters. Register Ref: FENCE //-------------------------- - Data.NumberFenceRegisters = pGmmLibContext->GetWaTable().Wa16TileFencesOnly ? 16 : 32; + Data.NumberFenceRegisters = WaTable.Wa16TileFencesOnly ? 16 : 32; Data.FenceLowBoundShift = 12; Data.FenceLowBoundMask = GFX_MASK(12, 31); Data.MinFenceSize = GMM_MBYTE(1); @@ -483,12 +484,12 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform, Context *pGmmLi // ---------------------------------- // Restrictions for Cross adapter resource // ---------------------------------- - Data.XAdapter.Alignment = GMM_KBYTE(64); //64KB for DX12/StdSwizzle—-Not worth special-casing. + Data.XAdapter.Alignment = GMM_KBYTE(64); //64KB for DX12/StdSwizzle�-Not worth special-casing. Data.XAdapter.PitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT); Data.XAdapter.RenderPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT); Data.XAdapter.LockPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT); Data.XAdapter.MinPitch = GMM_BYTES(32); - Data.XAdapter.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.XAdapter.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.XAdapter.MinAllocationSize = PAGE_SIZE; Data.XAdapter.MinHeight = GMM_SCANLINES(1); Data.XAdapter.MinWidth = GMM_PIXELS(1); diff --git a/Source/GmmLib/Platform/GmmGen8Platform.cpp b/Source/GmmLib/Platform/GmmGen8Platform.cpp index 05f03b0..b4ce935 100644 --- a/Source/GmmLib/Platform/GmmGen8Platform.cpp +++ b/Source/GmmLib/Platform/GmmGen8Platform.cpp @@ -224,12 +224,13 @@ GmmLib::PlatformInfoGen8::PlatformInfoGen8(PLATFORM &Platform, Context *pGmmLibC // RT & Texture2DSurface restrictions. Inst Ref: SURFACE_STATE // Greatest common restriction source comes from 8bpp RT // -------------------------- + const WA_TABLE &WaTable = pGmmLibContext->GetWaTable(); Data.Texture2DSurface.Alignment = PAGE_SIZE; Data.Texture2DSurface.PitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.LockPitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.RenderPitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.MinPitch = GMM_BYTES(32); - Data.Texture2DSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.Texture2DSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.Texture2DSurface.MinAllocationSize = PAGE_SIZE; Data.Texture2DSurface.MinHeight = GMM_SCANLINES(1); Data.Texture2DSurface.MinWidth = GMM_PIXELS(1); @@ -289,7 +290,7 @@ GmmLib::PlatformInfoGen8::PlatformInfoGen8(PLATFORM &Platform, Context *pGmmLibC Data.CubeSurface.LockPitchAlignment = GMM_BYTES(32); Data.CubeSurface.RenderPitchAlignment = GMM_BYTES(32); Data.CubeSurface.MinPitch = GMM_BYTES(32); - Data.CubeSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.CubeSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.CubeSurface.MinAllocationSize = PAGE_SIZE; Data.CubeSurface.MinHeight = GMM_SCANLINES(1); Data.CubeSurface.MinWidth = GMM_PIXELS(1); @@ -308,7 +309,7 @@ GmmLib::PlatformInfoGen8::PlatformInfoGen8(PLATFORM &Platform, Context *pGmmLibC Data.Texture3DSurface.LockPitchAlignment = GMM_BYTES(32); Data.Texture3DSurface.RenderPitchAlignment = GMM_BYTES(32); Data.Texture3DSurface.MinPitch = GMM_BYTES(32); - Data.Texture3DSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.Texture3DSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.Texture3DSurface.MinAllocationSize = PAGE_SIZE; Data.Texture3DSurface.MinHeight = GMM_SCANLINES(1); Data.Texture3DSurface.MinWidth = GMM_PIXELS(1); @@ -340,7 +341,7 @@ GmmLib::PlatformInfoGen8::PlatformInfoGen8(PLATFORM &Platform, Context *pGmmLibC // -------------------------- // Cursor surface restricion. Register Ref: CURACNTR, CURABASE // -------------------------- - Data.Cursor.Alignment = pGmmLibContext->GetWaTable().WaCursor16K ? GMM_KBYTE(16) : PAGE_SIZE; + Data.Cursor.Alignment = WaTable.WaCursor16K ? GMM_KBYTE(16) : PAGE_SIZE; Data.Cursor.PitchAlignment = 1; Data.Cursor.LockPitchAlignment = 1; Data.Cursor.RenderPitchAlignment = 1; @@ -364,7 +365,7 @@ GmmLib::PlatformInfoGen8::PlatformInfoGen8(PLATFORM &Platform, Context *pGmmLibC //-------------------------- // Fence paramaters. Register Ref: FENCE //-------------------------- - Data.NumberFenceRegisters = pGmmLibContext->GetWaTable().Wa16TileFencesOnly ? 16 : 32; + Data.NumberFenceRegisters = WaTable.Wa16TileFencesOnly ? 16 : 32; Data.FenceLowBoundShift = 12; Data.FenceLowBoundMask = GFX_MASK(12, 31); Data.MinFenceSize = GMM_MBYTE(1); @@ -413,7 +414,7 @@ GmmLib::PlatformInfoGen8::PlatformInfoGen8(PLATFORM &Platform, Context *pGmmLibC Data.XAdapter.RenderPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT); Data.XAdapter.LockPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT); Data.XAdapter.MinPitch = GMM_BYTES(32); - Data.XAdapter.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.XAdapter.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.XAdapter.MinAllocationSize = PAGE_SIZE; Data.XAdapter.MinHeight = GMM_SCANLINES(1); Data.XAdapter.MinWidth = GMM_PIXELS(1); diff --git a/Source/GmmLib/Platform/GmmGen9Platform.cpp b/Source/GmmLib/Platform/GmmGen9Platform.cpp index d02fbc5..d8b2a78 100644 --- a/Source/GmmLib/Platform/GmmGen9Platform.cpp +++ b/Source/GmmLib/Platform/GmmGen9Platform.cpp @@ -207,12 +207,13 @@ GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform, Context *pGmmLibC // RT & Texture2DSurface restrictions. Inst Ref: SURFACE_STATE // Greatest common restriction source comes from 8bpp RT // -------------------------- + const WA_TABLE &WaTable = pGmmLibContext->GetWaTable(); Data.Texture2DSurface.Alignment = PAGE_SIZE; Data.Texture2DSurface.PitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.LockPitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.RenderPitchAlignment = GMM_BYTES(32); Data.Texture2DSurface.MinPitch = GMM_BYTES(32); - Data.Texture2DSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.Texture2DSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.Texture2DSurface.MinAllocationSize = PAGE_SIZE; Data.Texture2DSurface.MinHeight = GMM_SCANLINES(1); Data.Texture2DSurface.MinWidth = GMM_PIXELS(1); @@ -277,7 +278,7 @@ GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform, Context *pGmmLibC Data.CubeSurface.LockPitchAlignment = GMM_BYTES(32); Data.CubeSurface.RenderPitchAlignment = GMM_BYTES(32); Data.CubeSurface.MinPitch = GMM_BYTES(32); - Data.CubeSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.CubeSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.CubeSurface.MinAllocationSize = PAGE_SIZE; Data.CubeSurface.MinHeight = GMM_SCANLINES(1); Data.CubeSurface.MinWidth = GMM_PIXELS(1); @@ -296,7 +297,7 @@ GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform, Context *pGmmLibC Data.Texture3DSurface.LockPitchAlignment = GMM_BYTES(32); Data.Texture3DSurface.RenderPitchAlignment = GMM_BYTES(32); Data.Texture3DSurface.MinPitch = GMM_BYTES(32); - Data.Texture3DSurface.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.Texture3DSurface.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.Texture3DSurface.MinAllocationSize = PAGE_SIZE; Data.Texture3DSurface.MinHeight = GMM_SCANLINES(1); Data.Texture3DSurface.MinWidth = GMM_PIXELS(1); @@ -328,7 +329,7 @@ GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform, Context *pGmmLibC // -------------------------- // Cursor surface restricion. Register Ref: CURACNTR, CURABASE // -------------------------- - Data.Cursor.Alignment = pGmmLibContext->GetWaTable().WaCursor16K ? GMM_KBYTE(16) : PAGE_SIZE; + Data.Cursor.Alignment = WaTable.WaCursor16K ? GMM_KBYTE(16) : PAGE_SIZE; Data.Cursor.PitchAlignment = 1; Data.Cursor.LockPitchAlignment = 1; Data.Cursor.RenderPitchAlignment = 1; @@ -415,7 +416,7 @@ GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform, Context *pGmmLibC //-------------------------- // Fence paramaters. Register Ref: FENCE //-------------------------- - Data.NumberFenceRegisters = pGmmLibContext->GetWaTable().Wa16TileFencesOnly ? 16 : 32; + Data.NumberFenceRegisters = WaTable.Wa16TileFencesOnly ? 16 : 32; Data.FenceLowBoundShift = 12; Data.FenceLowBoundMask = GFX_MASK(12, 31); Data.MinFenceSize = GMM_MBYTE(1); @@ -464,7 +465,7 @@ GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform, Context *pGmmLibC Data.XAdapter.RenderPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT); Data.XAdapter.LockPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT); Data.XAdapter.MinPitch = GMM_BYTES(32); - Data.XAdapter.MaxPitch = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); + Data.XAdapter.MaxPitch = (WaTable.WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256); Data.XAdapter.MinAllocationSize = PAGE_SIZE; Data.XAdapter.MinHeight = GMM_SCANLINES(1); Data.XAdapter.MinWidth = GMM_PIXELS(1); diff --git a/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp b/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp index b1e428f..68a628a 100644 --- a/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp +++ b/Source/GmmLib/Resource/GmmResourceInfoCommon.cpp @@ -36,13 +36,15 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::Is64KBPageSuitable() __GMM_ASSERT(Size); + const SKU_FEATURE_TABLE &SkuTable = GetGmmLibContext()->GetSkuTable(); + // All ESM resources and VirtuaPadding are exempt from 64KB paging if(Surf.Flags.Info.ExistingSysMem || Surf.Flags.Info.XAdapter || Surf.Flags.Gpu.CameraCapture || Surf.Flags.Info.KernelModeMapped || (Surf.Flags.Gpu.S3d && !Surf.Flags.Gpu.S3dDx && - !GetGmmLibContext()->GetSkuTable().FtrDisplayEngineS3d) + !SkuTable.FtrDisplayEngineS3d) #if(LHDM) || (Surf.Flags.Info.AllowVirtualPadding && ExistingSysMem.hParentAllocation) @@ -52,11 +54,11 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::Is64KBPageSuitable() Ignore64KBPadding = true; } - if(GetGmmLibContext()->GetSkuTable().FtrLocalMemory) + if(SkuTable.FtrLocalMemory) { Ignore64KBPadding |= (Surf.Flags.Info.Shared && !Surf.Flags.Info.NotLockable); - Ignore64KBPadding |= ((GetGmmLibContext()->GetSkuTable().FtrLocalMemoryAllows4KB) && Surf.Flags.Info.NoOptimizationPadding); - Ignore64KBPadding |= ((GetGmmLibContext()->GetSkuTable().FtrLocalMemoryAllows4KB || Surf.Flags.Info.NonLocalOnly) && (((Size * (100 + (GMM_GFX_SIZE_T)GetGmmLibContext()->GetAllowedPaddingFor64KbPagesPercentage())) / 100) < GFX_ALIGN(Size, GMM_KBYTE(64)))); + Ignore64KBPadding |= ((SkuTable.FtrLocalMemoryAllows4KB) && Surf.Flags.Info.NoOptimizationPadding); + Ignore64KBPadding |= ((SkuTable.FtrLocalMemoryAllows4KB || Surf.Flags.Info.NonLocalOnly) && (((Size * (100 + (GMM_GFX_SIZE_T)GetGmmLibContext()->GetAllowedPaddingFor64KbPagesPercentage())) / 100) < GFX_ALIGN(Size, GMM_KBYTE(64)))); } else { @@ -69,7 +71,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::Is64KBPageSuitable() } // If 64KB paging is enabled pad out the resource to 64KB alignment - if(GetGmmLibContext()->GetSkuTable().FtrWddm2_1_64kbPages && + if(SkuTable.FtrWddm2_1_64kbPages && // Ignore the padding for the above VirtualPadding or ESM cases (!Ignore64KBPadding) && // Resource must be 64KB aligned @@ -427,6 +429,8 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont pGmmUmdLibContext = reinterpret_cast(&GmmLibContext); __GMM_ASSERTPTR(pGmmUmdLibContext, GMM_ERROR); + const SKU_FEATURE_TABLE &SkuTable = GetGmmLibContext()->GetSkuTable(); + if(CreateParams.Flags.Info.ExistingSysMem && (CreateParams.Flags.Info.TiledW || CreateParams.Flags.Info.TiledX || @@ -497,17 +501,17 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont if(Surf.Flags.Gpu.IndirectClearColor || Surf.Flags.Gpu.ColorDiscard) { - if(GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS && AuxSurf.Type == RESOURCE_INVALID) + if(SkuTable.FtrFlatPhysCCS && AuxSurf.Type == RESOURCE_INVALID) { //ie only AuxType is CCS, doesn't exist with FlatCCS, enable it for CC - if (!GetGmmLibContext()->GetSkuTable().FtrXe2Compression || (GetGmmLibContext()->GetSkuTable().FtrXe2Compression && (Surf.MSAA.NumSamples > 1))) + if (!SkuTable.FtrXe2Compression || (SkuTable.FtrXe2Compression && (Surf.MSAA.NumSamples > 1))) { AuxSurf.Type = Surf.Type; } } if (!Surf.Flags.Gpu.TiledResource) { - if (!GetGmmLibContext()->GetSkuTable().FtrXe2Compression) + if (!SkuTable.FtrXe2Compression) { AuxSurf.CCSize = PAGE_SIZE; // 128bit Float Value + 32bit RT Native Value + Padding. AuxSurf.Size += PAGE_SIZE; @@ -524,7 +528,7 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont } else { - if (!GetGmmLibContext()->GetSkuTable().FtrXe2Compression) + if (!SkuTable.FtrXe2Compression) { AuxSurf.CCSize = GMM_KBYTE(64); // 128bit Float Value + 32bit RT Native Value + Padding. AuxSurf.Size += GMM_KBYTE(64); @@ -660,7 +664,7 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont } } - if(Is64KBPageSuitable() && GetGmmLibContext()->GetSkuTable().FtrLocalMemory) + if(Is64KBPageSuitable() && SkuTable.FtrLocalMemory) { // BaseAlignment can be greater than 64KB and needs to be aligned to 64KB Surf.Alignment.BaseAlignment = GFX_MAX(GFX_ALIGN(Surf.Alignment.BaseAlignment, GMM_KBYTE(64)), GMM_KBYTE(64)); diff --git a/Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp b/Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp index 5222cf4..275f975 100644 --- a/Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp +++ b/Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp @@ -44,6 +44,9 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat GMM_ASSERTDPF(0, "Format Error"); return false; } + + const SKU_FEATURE_TABLE &SkuTable = GetGmmLibContext()->GetSkuTable(); + { // Promote tiling options if caller does not provide any. // X/Y/W/L are tiling formats, and Yf/Ys are modifiers to the internal @@ -61,7 +64,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat CreateParams.Flags.Info.Linear = true; } - if(GetGmmLibContext()->GetSkuTable().FtrTileY) + if(SkuTable.FtrTileY) { CreateParams.Flags.Info.TiledYs |= CreateParams.Flags.Info.StdSwizzle || CreateParams.Flags.Gpu.TiledResource; @@ -87,7 +90,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat { GMM_ASSERTDPF(!CreateParams.Flags.Info.StdSwizzle, "StdSwizzle not supported on current platform"); - if(!GetGmmLibContext()->GetSkuTable().FtrForceTile4) // FtrForceTile4 should never be set by default, used for debug purpose only + if(!SkuTable.FtrForceTile4) // FtrForceTile4 should never be set by default, used for debug purpose only { // Default Tiling is set to Tile64 on FtrTileY disabled platforms uint8_t IsYUVSurface = GmmIsPlanar(CreateParams.Format) || @@ -100,7 +103,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat CreateParams.Flags.Info.Tile4 = ((!GMM_IS_SUPPORTED_BPP_ON_TILE_64_YF_YS(BitsPerPixel)) || // 24,48,96 bpps are not supported on Tile64, Tile4 is bpp independent ((CreateParams.Type == RESOURCE_3D) && (CreateParams.Flags.Gpu.Depth || CreateParams.Flags.Gpu.SeparateStencil)) || - ((!GetGmmLibContext()->GetSkuTable().FtrDisplayDisabled) && + ((!SkuTable.FtrDisplayDisabled) && (CreateParams.Flags.Gpu.FlipChain || CreateParams.Flags.Gpu.Overlay) ) || IsYUVSurface || IsYCrCbSurface); @@ -125,7 +128,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat GMM_ASSERTDPF(0, "Tile Yf/Ys not supported on given platform"); // Overrides the flags. - if(GetGmmLibContext()->GetSkuTable().FtrForceTile4)// FtrForceTile4 should never be set by default, used for debug purpose only. + if(SkuTable.FtrForceTile4)// FtrForceTile4 should never be set by default, used for debug purpose only. { CreateParams.Flags.Info.Tile64 = CreateParams.Flags.Info.TiledYs || (CreateParams.MSAA.NumSamples > 1) || CreateParams.Flags.Gpu.TiledResource; // Colour & Depth/Stencil(IMS) MSAA should use Tile64 @@ -140,7 +143,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat //Convert non linear & non-tiledX tiling selection by client to proper tiling. else if(CreateParams.Flags.Info.Linear + CreateParams.Flags.Info.TiledX == 0) { - if(!GetGmmLibContext()->GetSkuTable().FtrTileY) + if(!SkuTable.FtrTileY) { __GMM_ASSERT(!(CreateParams.Flags.Info.TiledYs || CreateParams.Flags.Info.TiledYf || @@ -148,7 +151,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat // On Xe_HP onwards translate UMD's TileY/TileYs request to Tile4/Tile64 respectively // Exclude TileX, Linear from override - if((GetGmmLibContext()->GetSkuTable().FtrForceTile4) && (CreateParams.Flags.Info.TiledYs || CreateParams.Flags.Info.TiledY)) + if((SkuTable.FtrForceTile4) && (CreateParams.Flags.Info.TiledYs || CreateParams.Flags.Info.TiledY)) { CreateParams.Flags.Info.Tile64 = CreateParams.Flags.Info.TiledYs || @@ -163,10 +166,10 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat } // Displayable surfaces cannot be Tiled4/64. - __GMM_ASSERT(!GetGmmLibContext()->GetSkuTable().FtrDisplayYTiling); + __GMM_ASSERT(!SkuTable.FtrDisplayYTiling); //override displayable surfaces to TileX - if(GetGmmLibContext()->GetSkuTable().FtrDisplayXTiling) + if(SkuTable.FtrDisplayXTiling) { if(CreateParams.Flags.Gpu.FlipChain || CreateParams.Flags.Gpu.Overlay || CreateParams.Flags.Gpu.Presentable) @@ -185,7 +188,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat CreateParams.Flags.Info.Linear); } - if(GetGmmLibContext()->GetSkuTable().FtrMultiTileArch) + if(SkuTable.FtrMultiTileArch) { // For Naive apps, UMD does not populate multi tile arch params. // Gmm will populate them based on the kmd assigned tile to the umd process @@ -196,10 +199,10 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat __GMM_ASSERT(CreateParams.MultiTileArch.LocalMemEligibilitySet == 0); __GMM_ASSERT(CreateParams.MultiTileArch.LocalMemPreferredSet == 0); - __GMM_ASSERT(GetGmmLibContext()->GetSkuTable().FtrAssignedGpuTile < 4); + __GMM_ASSERT(SkuTable.FtrAssignedGpuTile < 4); #if !__GMM_KMD__ - GpuTile = GetGmmLibContext()->GetSkuTable().FtrAssignedGpuTile; + GpuTile = SkuTable.FtrAssignedGpuTile; CreateParams.MultiTileArch.GpuVaMappingSet = __BIT(GpuTile); #else GpuTile = 0; @@ -234,8 +237,8 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat Surf.Flags.Info.__PreWddm2SVM = Surf.Flags.Info.SVM && - !(GetGmmLibContext()->GetSkuTable().FtrWddm2GpuMmu || - GetGmmLibContext()->GetSkuTable().FtrWddm2Svm); + !(SkuTable.FtrWddm2GpuMmu || + SkuTable.FtrWddm2Svm); #if !__GMM_KMD__ && LHDM if(GetGmmLibContext()->GetWaTable().WaLLCCachingUnsupported) @@ -245,7 +248,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat GMM_GTT_CACHETYPE_UNCACHED; } - if(GetGmmLibContext()->GetSkuTable().FtrCameraCaptureCaching == false && + if(SkuTable.FtrCameraCaptureCaching == false && CreateParams.Flags.Gpu.CameraCapture) { Surf.Flags.Info.Cacheable = 0; @@ -268,7 +271,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat // Reject non displayable tiling modes if(Surf.Flags.Gpu.FlipChain || Surf.Flags.Gpu.Overlay) { - if(Surf.Flags.Info.TiledY && !GetGmmLibContext()->GetSkuTable().FtrDisplayYTiling) + if(Surf.Flags.Info.TiledY && !SkuTable.FtrDisplayYTiling) { if(Surf.Flags.Gpu.FlipChainPreferred) { @@ -284,9 +287,9 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat } // Memory optimization for 64KB tiled Surface. - if (!GetGmmLibContext()->GetSkuTable().FtrTileY) + if (!SkuTable.FtrTileY) { - if ((GetGmmLibContext()->GetSkuTable().FtrTile64Optimization) && Optimize64KBTile) + if ((SkuTable.FtrTile64Optimization) && Optimize64KBTile) { if ((GetGmmLibContext()->GetWaTable().Wa_14020040029) && (Surf.Flags.Gpu.Depth)) { @@ -325,7 +328,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat { //GMM_ASSERTDPF(Surf.Flags.Gpu.HiZ, "Lossless Z compression supported when Depth+HiZ+CCS is unified"); AuxSecSurf = Surf; - AuxSecSurf.Type = GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS ? RESOURCE_INVALID : AuxSecSurf.Type; + AuxSecSurf.Type = SkuTable.FtrFlatPhysCCS ? RESOURCE_INVALID : AuxSecSurf.Type; Surf.Flags.Gpu.HiZ = 0; //Its depth buffer, so clear HiZ AuxSecSurf.Flags.Gpu.HiZ = 0; AuxSurf.Flags.Gpu.IndirectClearColor = 0; //Clear Depth flags from HiZ, contained with separate/legacy HiZ when Depth isn't compressible. @@ -349,13 +352,13 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat return false; } Surf.Flags.Gpu.CCS = 1; - AuxSurf.Type = GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS ? RESOURCE_INVALID : AuxSurf.Type; + AuxSurf.Type = SkuTable.FtrFlatPhysCCS ? RESOURCE_INVALID : AuxSurf.Type; } else if(Surf.MSAA.NumSamples > 1 && Surf.Flags.Gpu.CCS) //MSAA+MCS+CCS { GMM_ASSERTDPF(Surf.Flags.Gpu.MCS, "Lossless MSAA supported when MSAA+MCS+CCS is unified"); AuxSecSurf = Surf; - AuxSecSurf.Type = GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS ? RESOURCE_INVALID : AuxSecSurf.Type; + AuxSecSurf.Type = SkuTable.FtrFlatPhysCCS ? RESOURCE_INVALID : AuxSecSurf.Type; AuxSecSurf.Flags.Gpu.MCS = 0; AuxSurf.Flags.Gpu.CCS = 0; AuxSurf.Flags.Info.RenderCompressed = AuxSurf.Flags.Info.MediaCompressed = 0; @@ -363,7 +366,7 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat } else if(Surf.Flags.Gpu.CCS) { - AuxSurf.Type = (GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS && !Surf.Flags.Gpu.ProceduralTexture) ? RESOURCE_INVALID : AuxSurf.Type; + AuxSurf.Type = (SkuTable.FtrFlatPhysCCS && !Surf.Flags.Gpu.ProceduralTexture) ? RESOURCE_INVALID : AuxSurf.Type; } if(AuxSurf.Type != RESOURCE_INVALID && @@ -387,13 +390,13 @@ bool GmmLib::GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &Creat RotateInfo = CreateParams.RotateInfo; - if(GetGmmLibContext()->GetSkuTable().FtrMultiTileArch) + if(SkuTable.FtrMultiTileArch) { MultiTileArch = CreateParams.MultiTileArch; } // For Xe2 RenderCompressed and MediaCompressed to be unset - if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression) + if (SkuTable.FtrXe2Compression) { //Deny compression Surf.Flags.Info.RenderCompressed = 0; @@ -464,6 +467,8 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() } #endif + const SKU_FEATURE_TABLE &SkuTable = GetGmmLibContext()->GetSkuTable(); + pPlatformResource = GMM_OVERRIDE_PLATFORM_INFO(&Surf, GetGmmLibContext()); pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf, GetGmmLibContext()); @@ -553,9 +558,9 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() GMM_ASSERTDPF(0, "Overlay and FlipChain flags set. S3D logic may fail."); goto ERROR_CASE; } - + // Displayable surfaces must remain Tile4 - if(((!GetGmmLibContext()->GetSkuTable().FtrDisplayDisabled) && + if(((!SkuTable.FtrDisplayDisabled) && (Surf.Flags.Gpu.Overlay || Surf.Flags.Gpu.FlipChain)) && (!(Surf.Flags.Info.Linear || Surf.Flags.Info.TiledX || GMM_IS_4KB_TILE(Surf.Flags)))) { @@ -563,7 +568,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() goto ERROR_CASE; } - if(GetGmmLibContext()->GetSkuTable().FtrLocalMemory) + if(SkuTable.FtrLocalMemory) { GMM_ASSERTDPF(((Surf.Flags.Info.NonLocalOnly && Surf.Flags.Info.LocalOnly) == 0), "Incorrect segment preference, cannot be both local and system memory."); @@ -587,8 +592,8 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() Surf.Flags.Info.LocalOnly = 1; Surf.Flags.Info.NonLocalOnly = 0; } - if(GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS && - !GetGmmLibContext()->GetSkuTable().FtrXe2Compression && + if(SkuTable.FtrFlatPhysCCS && + !SkuTable.FtrXe2Compression && (Surf.Flags.Info.RenderCompressed || Surf.Flags.Info.MediaCompressed)) { @@ -624,7 +629,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() } if(GetGmmLibContext()->GetWaTable().Wa64kbMappingAt2mbGranularity && - (!GetGmmLibContext()->GetSkuTable().FtrLocalMemoryAllows4KB) && + (!SkuTable.FtrLocalMemoryAllows4KB) && !Surf.Flags.Info.NonLocalOnly) { Surf.Flags.Info.LocalOnly = true; @@ -634,7 +639,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() else { Surf.Flags.Info.LocalOnly = false; //Zero out on iGPU - if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression && Surf.Flags.Info.XAdapter) + if (SkuTable.FtrXe2Compression && Surf.Flags.Info.XAdapter) { Surf.Flags.Info.NotCompressed = 1; // disable compression for XAdapter resources on iGPU, Surf.Flags.Gpu.CCS = 0; @@ -643,7 +648,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() Surf.Flags.Gpu.MCS = 0; } } - if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression) + if (SkuTable.FtrXe2Compression) { if (Surf.Flags.Info.TiledX) { @@ -691,7 +696,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() goto ERROR_CASE; } - if(!GetGmmLibContext()->GetSkuTable().FtrTileY) + if(!SkuTable.FtrTileY) { if(Surf.Flags.Gpu.TiledResource && ((Surf.Flags.Info.Linear && !(Surf.Type == RESOURCE_BUFFER)) || Surf.Flags.Info.TiledYs || @@ -716,7 +721,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() } } - __GMM_ASSERT(!(GetGmmLibContext()->GetSkuTable().FtrTileY && + __GMM_ASSERT(!(SkuTable.FtrTileY && (Surf.Flags.Info.Tile4 || Surf.Flags.Info.Tile64))); //GMM asserts that ExistingSysMem allocation (whose malloc is outside GmmLib) are either @@ -844,11 +849,11 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() ((GFX_GET_CURRENT_RENDERCORE(pPlatformResource->Platform) >= IGFX_GEN10_CORE) || !Surf.Flags.Info.TiledYf) && // Tile64 MSAA (Xe_HP) - (GetGmmLibContext()->GetSkuTable().FtrTileY || + (SkuTable.FtrTileY || !GMM_IS_64KB_TILE(Surf.Flags) || (Surf.MaxLod == 0)) && // Tile4 does not support MSAA - (GetGmmLibContext()->GetSkuTable().FtrTileY || + (SkuTable.FtrTileY || !GMM_IS_4KB_TILE(Surf.Flags)) && // Non-Compressed/YUV... !GmmIsCompressed(GetGmmLibContext(), Surf.Format) && @@ -912,7 +917,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams() } //MultiTileArch params - if(GetGmmLibContext()->GetSkuTable().FtrMultiTileArch) + if(SkuTable.FtrMultiTileArch) { /* MultiTileArch validation criteria diff --git a/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h b/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h index f3020ca..8c9bc6d 100644 --- a/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h +++ b/Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h @@ -512,11 +512,12 @@ namespace GmmLib if ((Surf.Flags.Gpu.Depth || Surf.Flags.Gpu.SeparateStencil) && (Surf.MSAA.NumSamples > 1 && (GMM_IS_64KB_TILE(Surf.Flags) || Surf.Flags.Info.TiledYf))) { + const SKU_FEATURE_TABLE &SkuTable = GetGmmLibContext()->GetSkuTable(); switch (Surf.MSAA.NumSamples) { case 2: MSAASpecialFactorForDepthAndStencil = 2; - if (GetGmmLibContext()->GetSkuTable().FtrXe2PlusTiling && (Surf.BitsPerPixel == 128)) + if (SkuTable.FtrXe2PlusTiling && (Surf.BitsPerPixel == 128)) { MSAASpecialFactorForDepthAndStencil = 1; } @@ -526,28 +527,28 @@ namespace GmmLib break; case 8: MSAASpecialFactorForDepthAndStencil = 4; - if (GetGmmLibContext()->GetSkuTable().FtrXe2PlusTiling) + if (SkuTable.FtrXe2PlusTiling) { if (Surf.BitsPerPixel == 32 || Surf.BitsPerPixel == 8) { MSAASpecialFactorForDepthAndStencil = 2; } } - else if (!GetGmmLibContext()->GetSkuTable().FtrTileY && !GetGmmLibContext()->GetSkuTable().FtrXe2PlusTiling) + else if (!SkuTable.FtrTileY && !SkuTable.FtrXe2PlusTiling) { MSAASpecialFactorForDepthAndStencil = 2; // same as 4X } break; case 16: MSAASpecialFactorForDepthAndStencil = 4; - if (GetGmmLibContext()->GetSkuTable().FtrXe2PlusTiling) + if (SkuTable.FtrXe2PlusTiling) { if (Surf.BitsPerPixel == 64) { MSAASpecialFactorForDepthAndStencil = 8; } } - else if (!GetGmmLibContext()->GetSkuTable().FtrTileY && !GetGmmLibContext()->GetSkuTable().FtrXe2PlusTiling) + else if (!SkuTable.FtrTileY && !SkuTable.FtrXe2PlusTiling) { MSAASpecialFactorForDepthAndStencil = 2; // same as 4X }