1 /*===================== begin_copyright_notice ==================================
2
3 Copyright (c) 2023, Intel Corporation
4
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included
13 in all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 OTHER DEALINGS IN THE SOFTWARE.
22
23 ======================= end_copyright_notice ==================================*/
24 //!
25 //! \file media_sysinfo_mtl.cpp
26 //!
27
28 #include "igfxfmid.h"
29 #include "linux_system_info.h"
30 #include "skuwa_factory.h"
31 #include "linux_skuwa_debug.h"
32 #include "linux_media_skuwa.h"
33 #include "linux_shadow_skuwa.h"
34 #include "media_user_setting_specific.h"
35
36 //extern template class DeviceInfoFactory<GfxDeviceInfo>;
37 typedef DeviceInfoFactory<GfxDeviceInfo> base_fact;
38
39 #define THREADS_NUMBER_PER_EU 7
40
InitMtlMediaSysInfo(struct GfxDeviceInfo * devInfo,MEDIA_GT_SYSTEM_INFO * sysInfo)41 static bool InitMtlMediaSysInfo(struct GfxDeviceInfo *devInfo, MEDIA_GT_SYSTEM_INFO *sysInfo)
42 {
43 if ((devInfo == nullptr) || (sysInfo == nullptr))
44 {
45 DEVINFO_ERROR("null ptr is passed\n");
46 return false;
47 }
48
49 if (!sysInfo->SliceCount)
50 {
51 sysInfo->SliceCount = devInfo->SliceCount;
52 }
53
54 if (!sysInfo->SubSliceCount)
55 {
56 sysInfo->SubSliceCount = devInfo->SubSliceCount;
57 }
58
59 if (!sysInfo->EUCount)
60 {
61 sysInfo->EUCount = devInfo->EUCount;
62 }
63
64 sysInfo->L3BankCount = devInfo->L3BankCount;
65 sysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled = 1;
66 sysInfo->MaxEuPerSubSlice = devInfo->MaxEuPerSubSlice;
67 sysInfo->MaxSlicesSupported = sysInfo->SliceCount;
68 sysInfo->MaxSubSlicesSupported = sysInfo->SubSliceCount;
69
70 sysInfo->VEBoxInfo.NumberOfVEBoxEnabled = 0; /*Query the VEBox engine info from KMD*/
71 sysInfo->VDBoxInfo.NumberOfVDBoxEnabled = 0; /*Query the VDBox engine info from KMD*/
72
73 sysInfo->ThreadCount = sysInfo->EUCount * THREADS_NUMBER_PER_EU;
74
75 sysInfo->VEBoxInfo.IsValid = true;
76 sysInfo->VDBoxInfo.IsValid = true;
77
78 //Media driver does not set the other gtsysinfo fileds such as L3CacheSizeInKb, EdramSizeInKb and LLCCacheSizeInKb now.
79 //If needed in the future, query them from KMD.
80
81 return true;
82 }
83
InitMtlShadowSku(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_FEATURE_TABLE * skuTable,struct LinuxDriverInfo * drvInfo)84 static bool InitMtlShadowSku(struct GfxDeviceInfo *devInfo,
85 SHADOW_MEDIA_FEATURE_TABLE *skuTable,
86 struct LinuxDriverInfo *drvInfo)
87 {
88 if ((devInfo == nullptr) || (skuTable == nullptr) || (drvInfo == nullptr))
89 {
90 DEVINFO_ERROR("null ptr is passed\n");
91 return false;
92 }
93
94 skuTable->FtrVERing = 0;
95 if (drvInfo->hasVebox)
96 {
97 skuTable->FtrVERing = 1;
98 }
99
100 skuTable->FtrVcs2 = 0;
101
102 skuTable->FtrULT = 0;
103
104 skuTable->FtrPPGTT = 1;
105 skuTable->FtrIA32eGfxPTEs = 1;
106
107 skuTable->FtrDisplayYTiling = 1;
108 skuTable->FtrEDram = devInfo->hasERAM;
109
110 bool disableMMC = false;
111 skuTable->FtrE2ECompression = 1;
112 // Disable MMC for all components if set reg key
113 MOS_USER_FEATURE_VALUE_DATA userFeatureData;
114 MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData));
115 MOS_UserFeature_ReadValue_ID(
116 nullptr,
117 __MEDIA_USER_FEATURE_VALUE_DISABLE_MMC_ID,
118 &userFeatureData,
119 (MOS_CONTEXT_HANDLE)nullptr);
120 if (userFeatureData.bData)
121 {
122 disableMMC = true;
123 }
124
125 if (disableMMC)
126 {
127 skuTable->FtrE2ECompression = 0;
128 }
129
130 skuTable->FtrLinearCCS = 1;
131 skuTable->FtrTileY = 0;
132
133 return true;
134 }
135
InitMtlShadowWa(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_WA_TABLE * waTable,struct LinuxDriverInfo * drvInfo)136 static bool InitMtlShadowWa(struct GfxDeviceInfo *devInfo,
137 SHADOW_MEDIA_WA_TABLE *waTable,
138 struct LinuxDriverInfo *drvInfo)
139 {
140 if ((devInfo == nullptr) || (waTable == nullptr) || (drvInfo == nullptr))
141 {
142 DEVINFO_ERROR("null ptr is passed\n");
143 return false;
144 }
145
146 /* by default PPGTT is enabled */
147 waTable->WaForceGlobalGTT = 0;
148 if (drvInfo->hasPpgtt == 0)
149 {
150 waTable->WaForceGlobalGTT = 1;
151 }
152
153 waTable->WaDisregardPlatformChecks = 1;
154 waTable->Wa4kAlignUVOffsetNV12LinearSurface = 1;
155
156 //source and recon surfaces need to be aligned to the LCU size
157 waTable->WaAlignYUVResourceToLCU = 1;
158
159 return true;
160 }
161
162
163 static struct GfxDeviceInfo mtlInfo = {
164 .platformType = PLATFORM_MOBILE,
165 .productFamily = IGFX_METEORLAKE,
166 .displayFamily = IGFX_UNKNOWN_CORE,
167 .renderFamily = IGFX_GEN12_CORE,
168 .mediaFamily = IGFX_UNKNOWN_CORE,
169 .eGTType = GTTYPE_GT2,
170 .L3CacheSizeInKb = 0,
171 .L3BankCount = 0,
172 .EUCount = 0,
173 .SliceCount = 0,
174 .SubSliceCount = 0,
175 .MaxEuPerSubSlice = 0,
176 .isLCIA = 0,
177 .hasLLC = 0,
178 .hasERAM = 0,
179 .InitMediaSysInfo = InitMtlMediaSysInfo,
180 .InitShadowSku = InitMtlShadowSku,
181 .InitShadowWa = InitMtlShadowWa,
182 };
183
184 static bool mtlDevice7d40 = DeviceInfoFactory<GfxDeviceInfo>::
185 RegisterDevice(0x7D40, &mtlInfo);
186
187 static bool mtlDevice7d55 = DeviceInfoFactory<GfxDeviceInfo>::
188 RegisterDevice(0X7D55, &mtlInfo);
189
190 static bool mtlDevice7dd5 = DeviceInfoFactory<GfxDeviceInfo>::
191 RegisterDevice(0X7DD5, &mtlInfo);
192
193 static bool mtlDevice7d45 = DeviceInfoFactory<GfxDeviceInfo>::
194 RegisterDevice(0x7D45, &mtlInfo);
195
196 static bool mtlDevice7d60 = DeviceInfoFactory<GfxDeviceInfo>::
197 RegisterDevice(0x7D60, &mtlInfo);
198
199 static struct GfxDeviceInfo arlInfo = {
200 .platformType = PLATFORM_MOBILE,
201 .productFamily = (uint32_t)IGFX_ARROWLAKE,
202 .displayFamily = IGFX_UNKNOWN_CORE,
203 .renderFamily = IGFX_GEN12_CORE,
204 .mediaFamily = IGFX_UNKNOWN_CORE,
205 .eGTType = GTTYPE_GT2,
206 .L3CacheSizeInKb = 0,
207 .L3BankCount = 0,
208 .EUCount = 0,
209 .SliceCount = 0,
210 .SubSliceCount = 0,
211 .MaxEuPerSubSlice = 0,
212 .isLCIA = 0,
213 .hasLLC = 0,
214 .hasERAM = 0,
215 .InitMediaSysInfo = InitMtlMediaSysInfo,
216 .InitShadowSku = InitMtlShadowSku,
217 .InitShadowWa = InitMtlShadowWa,
218 };
219
220 static bool arlsDevice7d67 = DeviceInfoFactory<GfxDeviceInfo>::
221 RegisterDevice(0x7D67, &arlInfo);
222
223 static bool arlhDevice7d51 = DeviceInfoFactory<GfxDeviceInfo>::
224 RegisterDevice(0x7D51, &arlInfo);
225
226 static bool arlhDevice7dd1 = DeviceInfoFactory<GfxDeviceInfo>::
227 RegisterDevice(0x7DD1, &arlInfo);
228
229 static bool arlhDevice7d41 = DeviceInfoFactory<GfxDeviceInfo>::
230 RegisterDevice(0x7D41, &arlInfo);