1 /*==============================================================================
2 Copyright(c) 2017 Intel Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files(the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and / or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21 ============================================================================*/
22
23 #include "Internal/Common/GmmLibInc.h"
24 #include "Internal/Common/Platform/GmmGen10Platform.h"
25 #include "Internal/Common/Platform/GmmGen11Platform.h"
26
PlatformInfoGen11(PLATFORM & Platform,Context * pGmmLibContext)27 GmmLib::PlatformInfoGen11::PlatformInfoGen11(PLATFORM &Platform, Context *pGmmLibContext)
28 : PlatformInfoGen10(Platform, pGmmLibContext)
29 {
30
31 Data.SurfaceMaxSize = GMM_GBYTE(16384);
32 Data.MaxGpuVirtualAddressBitsPerResource = 44;
33
34 //Override the Height VP9 VdEnc requirement for Gen11 8k resolution.
35 Data.ReconMaxHeight = GMM_KBYTE(32);
36
37 //Override CCS MaxPitch requirement
38 if(GFX_GET_CURRENT_PRODUCT(Data.Platform) == IGFX_ICELAKE)
39 {
40 Data.TexAlign.CCS.MaxPitchinTiles = 1024;
41 }
42
43 if(GFX_GET_CURRENT_PRODUCT(Data.Platform) == IGFX_LAKEFIELD)
44 {
45 Data.SurfaceMaxSize = GMM_GBYTE(64);
46 Data.MaxGpuVirtualAddressBitsPerResource = 36;
47 }
48 }
49
50 /////////////////////////////////////////////////////////////////////////////////////
51 /// Validates the MMC parameters passed in by clients to make sure they do not
52 /// conflict or ask for unsupporting combinations/features.
53 ///
54 /// @param[in] GMM_TEXTURE_INFO which specify what sort of resource to create
55 /// @return 1 is validation passed. 0 otherwise.
56 /////////////////////////////////////////////////////////////////////////////////////
ValidateMMC(GMM_TEXTURE_INFO & Surf)57 uint8_t GmmLib::PlatformInfoGen11::ValidateMMC(GMM_TEXTURE_INFO &Surf)
58 {
59
60 if(Surf.Flags.Gpu.MMC && //For Media Memory Compression --
61 ((!(GMM_IS_4KB_TILE(Surf.Flags) || GMM_IS_64KB_TILE(Surf.Flags))) ||
62 Surf.ArraySize > GMM_MAX_MMC_INDEX))
63 {
64 return 0;
65 }
66
67 if(GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_LAKEFIELD)
68 {
69 if(Surf.Flags.Gpu.MMC &&
70 Surf.Flags.Gpu.UnifiedAuxSurface &&
71 !(Surf.Flags.Info.TiledY &&
72 (Surf.Format == GMM_FORMAT_NV12 || GmmIsP0xx(Surf.Format))))
73 {
74 GMM_ASSERTDPF(0, "Invalid MMC usage for LKF!");
75 return 0;
76 }
77 }
78 return 1;
79 }
80
81 /////////////////////////////////////////////////////////////////////////////////////
82 /// Validates the UnifiedAuxSurface parameters passed in by clients to make sure they do not
83 /// conflict or ask for unsupporting combinations/features.
84 ///
85 /// @param[in] GMM_TEXTURE_INFO which specify what sort of resource to create
86 /// @return 1 is validation passed. 0 otherwise.
87 /////////////////////////////////////////////////////////////////////////////////////
ValidateUnifiedAuxSurface(GMM_TEXTURE_INFO & Surf)88 uint8_t GmmLib::PlatformInfoGen11::ValidateUnifiedAuxSurface(GMM_TEXTURE_INFO &Surf)
89 {
90 if((Surf.Flags.Gpu.UnifiedAuxSurface) &&
91 !( //--- Legitimate UnifiedAuxSurface Case ------------------------------------------
92 Surf.Flags.Gpu.CCS &&
93 ((Surf.MSAA.NumSamples <= 1 && (Surf.Flags.Gpu.RenderTarget || Surf.Flags.Gpu.Texture))) ||
94 ((GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_LAKEFIELD) && Surf.Flags.Gpu.MMC &&
95 (Surf.MSAA.NumSamples <= 1))))
96 {
97 GMM_ASSERTDPF(0, "Invalid UnifiedAuxSurface usage!");
98 return 0;
99 }
100 return 1;
101 }
102
103 //=============================================================================
104 //
105 // Function: CheckFmtDisplayDecompressible
106 //
107 // Desc: Returns true if display hw supports lossless render/media decompression
108 // else returns false.
109 // Umds can call it to decide if full resolve is required
110 //
111 // Parameters:
112 // See function arguments.
113 //
114 // Returns:
115 // uint8_t
116 //-----------------------------------------------------------------------------
CheckFmtDisplayDecompressible(GMM_TEXTURE_INFO & Surf,bool IsSupportedRGB64_16_16_16_16,bool IsSupportedRGB32_8_8_8_8,bool IsSupportedRGB32_2_10_10_10,bool IsSupportedMediaFormats)117 uint8_t GmmLib::PlatformInfoGen11::CheckFmtDisplayDecompressible(GMM_TEXTURE_INFO &Surf,
118 bool IsSupportedRGB64_16_16_16_16,
119 bool IsSupportedRGB32_8_8_8_8,
120 bool IsSupportedRGB32_2_10_10_10,
121 bool IsSupportedMediaFormats)
122 {
123 bool IsRenderCompressed = false;
124 bool IsMediaCompressed = false;
125 GMM_UNREFERENCED_PARAMETER(IsSupportedMediaFormats);
126
127 if(GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_LAKEFIELD)
128 {
129 if(Surf.Flags.Gpu.MMC &&
130 Surf.Flags.Info.TiledY &&
131 (Surf.Format == GMM_FORMAT_NV12 ||
132 Surf.Format == GMM_FORMAT_P010))
133 {
134 IsMediaCompressed = true;
135 }
136
137 if(IsSupportedRGB64_16_16_16_16 || //RGB64 16:16 : 16 : 16 FP16
138 IsSupportedRGB32_8_8_8_8 || //RGB32 8 : 8 : 8 : 8
139 IsSupportedRGB32_2_10_10_10) //RGB32 2 : 10 : 10 : 10
140 {
141 IsRenderCompressed = true;
142 }
143 }
144 else
145 {
146 // Pre-LKF1
147 if(IsSupportedRGB32_8_8_8_8 || //RGB32 8 : 8 : 8 : 8
148 (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_ICELAKE &&
149 IsSupportedRGB64_16_16_16_16)) //RGB64 16:16 : 16 : 16 FP16
150 {
151 IsRenderCompressed = true;
152 }
153 }
154 return IsRenderCompressed || IsMediaCompressed;
155 }
156