Skip to content

Commit 8bee050

Browse files
committed
Adding Lakefield support
Refactoring internal classes Change-Id: Ifd38919c99e6414b0b63fb8c26ccb84c32e062de Signed-off-by: drprjap <[email protected]>
1 parent 19fa882 commit 8bee050

21 files changed

+1242
-264
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 6)
27+
set(GMMLIB_API_MAJOR_VERSION 7)
2828
set(GMMLIB_API_MINOR_VERSION 0)
2929

3030
if(NOT DEFINED MAJOR_VERSION)
31-
set(MAJOR_VERSION 6)
31+
set(MAJOR_VERSION 7)
3232
endif()
3333

3434
if(NOT DEFINED MINOR_VERSION)

Source/GmmLib/CachePolicy/GmmCachePolicyConditionals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ OTHER DEALINGS IN THE SOFTWARE.
2222

2323
#define PRODUCT(X) (GFX_GET_CURRENT_PRODUCT(pGmmGlobalContext->GetPlatformInfo().Platform) == IGFX_##X)
2424

25+
#define FROMPRODUCT(X) (GFX_GET_CURRENT_PRODUCT(pGmmGlobalContext->GetPlatformInfo().Platform) >= IGFX_##X)
26+
2527
#define SKU(FtrXxx) (pGmmGlobalContext->GetSkuTable().FtrXxx != 0)
2628

2729
#define WA(WaXxx) (pGmmGlobalContext->GetWaTable().WaXxx != 0)

Source/GmmLib/Platform/GmmGen10Platform.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ OTHER DEALINGS IN THE SOFTWARE.
2121
============================================================================*/
2222

2323

24-
#if(IGFX_GEN >= IGFX_GEN10)
2524

2625
#include "Internal/Common/GmmLibInc.h"
2726
#include "Internal/Common/Platform/GmmGen10Platform.h"
@@ -509,4 +508,3 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform)
509508
Data.MaxGpuVirtualAddressBitsPerResource = 38;
510509
Data.HiZPixelsPerByte = 2;
511510
}
512-
#endif // #if (IGFX_GEN >= IGFX_GEN10)

Source/GmmLib/Platform/GmmGen11Platform.cpp

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ GmmLib::PlatformInfoGen11::PlatformInfoGen11(PLATFORM &Platform)
3737
Data.TexAlign.CCS.MaxPitchinTiles = 1024;
3838
}
3939

40+
if(GFX_GET_CURRENT_PRODUCT(Data.Platform) == IGFX_LAKEFIELD)
41+
{
42+
Data.SurfaceMaxSize = GMM_GBYTE(64);
43+
Data.MaxGpuVirtualAddressBitsPerResource = 36;
44+
}
4045
}
4146

4247
/////////////////////////////////////////////////////////////////////////////////////
@@ -56,6 +61,17 @@ uint8_t GmmLib::PlatformInfoGen11::ValidateMMC(GMM_TEXTURE_INFO &Surf)
5661
return 0;
5762
}
5863

64+
if(GFX_GET_CURRENT_PRODUCT(pGmmGlobalContext->GetPlatformInfo().Platform) == IGFX_LAKEFIELD)
65+
{
66+
if(Surf.Flags.Gpu.MMC &&
67+
Surf.Flags.Gpu.UnifiedAuxSurface &&
68+
!(Surf.Flags.Info.TiledY &&
69+
(Surf.Format == GMM_FORMAT_NV12 || GmmIsP0xx(Surf.Format))))
70+
{
71+
GMM_ASSERTDPF(0, "Invalid MMC usage for LKF!");
72+
return 0;
73+
}
74+
}
5975
return 1;
6076
}
6177

@@ -71,7 +87,9 @@ uint8_t GmmLib::PlatformInfoGen11::ValidateUnifiedAuxSurface(GMM_TEXTURE_INFO &S
7187
if((Surf.Flags.Gpu.UnifiedAuxSurface) &&
7288
!( //--- Legitimate UnifiedAuxSurface Case ------------------------------------------
7389
Surf.Flags.Gpu.CCS &&
74-
((Surf.MSAA.NumSamples <= 1 && (Surf.Flags.Gpu.RenderTarget || Surf.Flags.Gpu.Texture)))))
90+
((Surf.MSAA.NumSamples <= 1 && (Surf.Flags.Gpu.RenderTarget || Surf.Flags.Gpu.Texture))) ||
91+
((GFX_GET_CURRENT_PRODUCT(pGmmGlobalContext->GetPlatformInfo().Platform) == IGFX_LAKEFIELD) && Surf.Flags.Gpu.MMC &&
92+
(Surf.MSAA.NumSamples <= 1))))
7593
{
7694
GMM_ASSERTDPF(0, "Invalid UnifiedAuxSurface usage!");
7795
return 0;
@@ -103,12 +121,32 @@ uint8_t GmmLib::PlatformInfoGen11::CheckFmtDisplayDecompressible(GMM_TEXTURE_INF
103121
bool IsMediaCompressed = false;
104122
GMM_UNREFERENCED_PARAMETER(IsSupportedMediaFormats);
105123

106-
if(IsSupportedRGB32_8_8_8_8 || //RGB32 8 : 8 : 8 : 8
107-
(GFX_GET_CURRENT_PRODUCT(pGmmGlobalContext->GetPlatformInfo().Platform) == IGFX_ICELAKE &&
108-
IsSupportedRGB64_16_16_16_16)) //RGB64 16:16 : 16 : 16 FP16
109-
{
110-
IsRenderCompressed = true;
111-
}
124+
if(GFX_GET_CURRENT_PRODUCT(pGmmGlobalContext->GetPlatformInfo().Platform) == IGFX_LAKEFIELD)
125+
{
126+
if(Surf.Flags.Gpu.MMC &&
127+
Surf.Flags.Info.TiledY &&
128+
(Surf.Format == GMM_FORMAT_NV12 ||
129+
Surf.Format == GMM_FORMAT_P010))
130+
{
131+
IsMediaCompressed = true;
132+
}
112133

134+
if(IsSupportedRGB64_16_16_16_16 || //RGB64 16:16 : 16 : 16 FP16
135+
IsSupportedRGB32_8_8_8_8 || //RGB32 8 : 8 : 8 : 8
136+
IsSupportedRGB32_2_10_10_10) //RGB32 2 : 10 : 10 : 10
137+
{
138+
IsRenderCompressed = true;
139+
}
140+
}
141+
else
142+
{
143+
// Pre-LKF1
144+
if(IsSupportedRGB32_8_8_8_8 || //RGB32 8 : 8 : 8 : 8
145+
(GFX_GET_CURRENT_PRODUCT(pGmmGlobalContext->GetPlatformInfo().Platform) == IGFX_ICELAKE &&
146+
IsSupportedRGB64_16_16_16_16)) //RGB64 16:16 : 16 : 16 FP16
147+
{
148+
IsRenderCompressed = true;
149+
}
150+
}
113151
return IsRenderCompressed || IsMediaCompressed;
114152
}

Source/GmmLib/Platform/GmmPlatform.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ GmmLib::PlatformInfo::PlatformInfo(PLATFORM &Platform)
3838
#define GMM_FORMAT_SKU(FtrXxx) (pGmmGlobalContext->GetSkuTable().FtrXxx != 0)
3939
#define GMM_FORMAT_WA(WaXxx) (pGmmGlobalContext->GetWaTable().WaXxx != 0)
4040
#define GMM_FORMAT(Name, bpe, _Width, _Height, _Depth, IsRT, IsASTC, RcsSurfaceFormat, AuxL1Format, Availability) \
41-
\
42-
{ \
41+
\
42+
{ \
4343
GmmFormat = GMM_FORMAT_##Name; \
4444
Data.FormatTable[GmmFormat].ASTC = (IsASTC); \
4545
Data.FormatTable[GmmFormat].Element.BitsPer = (bpe); \
@@ -54,8 +54,7 @@ GmmLib::PlatformInfo::PlatformInfo(PLATFORM &Platform)
5454
{ \
5555
Data.FormatTable[GmmFormat].Compressed = 1; \
5656
} \
57-
\
58-
}
57+
}
5958

6059
#include "External/Common/GmmFormatTable.h"
6160
}

Source/GmmLib/Resource/GmmResourceInfoCommon.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
320320
Surf.ExistingSysMem.IsPageAligned = 1;
321321

322322
// Adjust memory size to compensate for Gfx alignment.
323-
GetRestrictions(Restrictions);
323+
pTextureCalc->GetResRestrictions(&Surf, Restrictions);
324324
ExistingSysMem.Size = Restrictions.Alignment + Surf.Size;
325325

326326
ExistingSysMem.pVirtAddress = (uint64_t)GMM_MALLOC(GFX_ULONG_CAST(ExistingSysMem.Size));
@@ -1865,6 +1865,27 @@ uint32_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::GetPackedMipTailStartLod()
18651865
//the number of mips. So + 1 to bring them to same units.
18661866
}
18671867

1868+
/////////////////////////////////////////////////////////////////////////////////////
1869+
/// Verifies if all mips are RCC-aligned
1870+
/// @return true/false
1871+
/////////////////////////////////////////////////////////////////////////////////////
1872+
bool GMM_STDCALL GmmLib::GmmResourceInfoCommon::IsMipRCCAligned(uint8_t &MisAlignedLod)
1873+
{
1874+
const uint8_t RCCCachelineWidth = 32;
1875+
const uint8_t RCCCachelineHeight = 4;
1876+
1877+
for(uint8_t lod = 0; lod <= GetMaxLod(); lod++)
1878+
{
1879+
if(!(GFX_IS_ALIGNED(GetMipWidth(lod), RCCCachelineWidth) &&
1880+
GFX_IS_ALIGNED(GetMipHeight(lod), RCCCachelineHeight)))
1881+
{
1882+
MisAlignedLod = lod;
1883+
return false;
1884+
}
1885+
}
1886+
return true;
1887+
}
1888+
18681889
/////////////////////////////////////////////////////////////////////////////////////
18691890
/// Returns the resource's compressions block width
18701891
/// @return Compression block width

Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams()
214214
{
215215
__GMM_BUFFER_TYPE Restrictions = {0};
216216
const __GMM_PLATFORM_RESOURCE *pPlatformResource = NULL;
217+
GMM_TEXTURE_CALC * pTextureCalc = NULL;
217218
bool AllowMaxWidthViolations = false;
218219
bool AllowMaxHeightViolations = false;
219220
uint8_t Status = 0;
@@ -264,6 +265,7 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams()
264265
#endif
265266

266267
pPlatformResource = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
268+
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf);
267269

268270
__GMM_ASSERT(!(
269271
Surf.Flags.Gpu.Query &&

0 commit comments

Comments
 (0)