1 /*===================== begin_copyright_notice ==================================
2
3 Copyright (c) 2021, 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_xe.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 #define THREADS_NUMBER_PER_EU_HP 8
37
38 //extern template class DeviceInfoFactory<GfxDeviceInfo>;
39 typedef DeviceInfoFactory<GfxDeviceInfo> base_fact;
40
InitXeHPMediaSysInfo(struct GfxDeviceInfo * devInfo,MEDIA_GT_SYSTEM_INFO * sysInfo)41 bool InitXeHPMediaSysInfo(struct GfxDeviceInfo *devInfo,
42 MEDIA_GT_SYSTEM_INFO *sysInfo)
43 {
44 if ((devInfo == nullptr) || (sysInfo == nullptr))
45 {
46 DEVINFO_ERROR("null ptr is passed\n");
47 return false;
48 }
49
50 if (!sysInfo->SliceCount)
51 {
52 sysInfo->SliceCount = devInfo->SliceCount;
53 }
54
55 if (!sysInfo->SubSliceCount)
56 {
57 sysInfo->SubSliceCount = devInfo->SubSliceCount;
58 }
59
60 if (!sysInfo->EUCount)
61 {
62 sysInfo->EUCount = devInfo->EUCount;
63 }
64
65 sysInfo->L3BankCount = devInfo->L3BankCount;
66 sysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled = 1;
67 sysInfo->MaxEuPerSubSlice = devInfo->MaxEuPerSubSlice;
68 sysInfo->MaxSlicesSupported = sysInfo->SliceCount;
69 sysInfo->MaxSubSlicesSupported = sysInfo->SubSliceCount;
70
71 sysInfo->VEBoxInfo.NumberOfVEBoxEnabled = 0; /*Query the VEBox engine info from KMD*/
72 sysInfo->VDBoxInfo.NumberOfVDBoxEnabled = 0; /*Query the VDBox engine info from KMD*/
73
74 sysInfo->ThreadCount = sysInfo->EUCount * THREADS_NUMBER_PER_EU_HP;
75
76 sysInfo->VEBoxInfo.IsValid = true;
77 sysInfo->VDBoxInfo.IsValid = true;
78
79 //Media driver does not set the other gtsysinfo fileds such as L3CacheSizeInKb, EdramSizeInKb and LLCCacheSizeInKb now.
80 //If needed in the future, query them from KMD.
81
82 return true;
83 }
84
85
InitXeHPShadowSku(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_FEATURE_TABLE * skuTable,struct LinuxDriverInfo * drvInfo)86 bool InitXeHPShadowSku(struct GfxDeviceInfo *devInfo,
87 SHADOW_MEDIA_FEATURE_TABLE *skuTable,
88 struct LinuxDriverInfo *drvInfo)
89 {
90 if ((devInfo == nullptr) || (skuTable == nullptr) || (drvInfo == nullptr))
91 {
92 DEVINFO_ERROR("null ptr is passed\n");
93 return false;
94 }
95
96 skuTable->FtrVERing = 0;
97 if (drvInfo->hasVebox)
98 {
99 skuTable->FtrVERing = 1;
100 }
101
102 skuTable->FtrVcs2 = 0;
103
104 skuTable->FtrULT = 0;
105
106 skuTable->FtrPPGTT = 1;
107 skuTable->FtrIA32eGfxPTEs = 1;
108
109 skuTable->FtrDisplayYTiling = 0;
110 skuTable->FtrEDram = devInfo->hasERAM;
111
112 skuTable->FtrE2ECompression = 1;
113 // Disable MMC for all components if set reg key
114 MOS_USER_FEATURE_VALUE_DATA userFeatureData;
115 MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData));
116 MOS_UserFeature_ReadValue_ID(
117 nullptr,
118 __MEDIA_USER_FEATURE_VALUE_DISABLE_MMC_ID,
119 &userFeatureData,
120 (MOS_CONTEXT_HANDLE)nullptr);
121 if (userFeatureData.bData)
122 {
123 skuTable->FtrE2ECompression = 0;
124 }
125
126 skuTable->FtrLinearCCS = 1;
127 skuTable->FtrFlatPhysCCS = 1;
128 skuTable->FtrTileY = 0;
129
130 skuTable->FtrLocalMemory = 1;
131
132 return true;
133 }
134
InitPvcShadowSku(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_FEATURE_TABLE * skuTable,struct LinuxDriverInfo * drvInfo)135 bool InitPvcShadowSku(struct GfxDeviceInfo *devInfo,
136 SHADOW_MEDIA_FEATURE_TABLE *skuTable,
137 struct LinuxDriverInfo *drvInfo)
138 {
139 if ((devInfo == nullptr) || (skuTable == nullptr) || (drvInfo == nullptr))
140 {
141 DEVINFO_ERROR("null ptr is passed\n");
142 return false;
143 }
144
145 skuTable->FtrVERing = 0;
146 if (drvInfo->hasVebox)
147 {
148 skuTable->FtrVERing = 1;
149 }
150
151 skuTable->FtrVcs2 = 0;
152
153 skuTable->FtrULT = 0;
154
155 skuTable->FtrPPGTT = 1;
156 skuTable->FtrIA32eGfxPTEs = 1;
157
158 skuTable->FtrDisplayYTiling = 0;
159 skuTable->FtrEDram = devInfo->hasERAM;
160
161 skuTable->FtrE2ECompression = 1;
162 skuTable->FtrUnified3DMediaCompressionFormats = 1;
163 // Disable MMC for all components if set reg key
164 MOS_USER_FEATURE_VALUE_DATA userFeatureData;
165 MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData));
166 MOS_UserFeature_ReadValue_ID(
167 nullptr,
168 __MEDIA_USER_FEATURE_VALUE_DISABLE_MMC_ID,
169 &userFeatureData,
170 (MOS_CONTEXT_HANDLE)nullptr);
171 if (userFeatureData.bData)
172 {
173 skuTable->FtrE2ECompression = 0;
174 }
175
176 skuTable->FtrLinearCCS = 1;
177 skuTable->FtrFlatPhysCCS = 1;
178 skuTable->FtrTileY = 0;
179
180 skuTable->FtrLocalMemory = 1;
181
182 return true;
183 }
184
185
InitXeHPShadowWa(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_WA_TABLE * waTable,struct LinuxDriverInfo * drvInfo)186 bool InitXeHPShadowWa(struct GfxDeviceInfo *devInfo,
187 SHADOW_MEDIA_WA_TABLE *waTable,
188 struct LinuxDriverInfo *drvInfo)
189 {
190 if ((devInfo == nullptr) || (waTable == nullptr) || (drvInfo == nullptr))
191 {
192 DEVINFO_ERROR("null ptr is passed\n");
193 return false;
194 }
195
196 /* by default PPGTT is enabled */
197 waTable->WaForceGlobalGTT = 0;
198 if (drvInfo->hasPpgtt == 0)
199 {
200 waTable->WaForceGlobalGTT = 1;
201 }
202
203 waTable->WaDisregardPlatformChecks = 1;
204 waTable->Wa4kAlignUVOffsetNV12LinearSurface = 1;
205
206 waTable->Wa_15010089951 = 1;
207
208 return true;
209 }
210
InitPvcShadowWa(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_WA_TABLE * waTable,struct LinuxDriverInfo * drvInfo)211 bool InitPvcShadowWa(struct GfxDeviceInfo *devInfo,
212 SHADOW_MEDIA_WA_TABLE *waTable,
213 struct LinuxDriverInfo *drvInfo)
214 {
215 if ((devInfo == nullptr) || (waTable == nullptr) || (drvInfo == nullptr))
216 {
217 DEVINFO_ERROR("null ptr is passed\n");
218 return false;
219 }
220
221 /* by default PPGTT is enabled */
222 waTable->WaForceGlobalGTT = 0;
223 if (drvInfo->hasPpgtt == 0)
224 {
225 waTable->WaForceGlobalGTT = 1;
226 }
227
228 waTable->WaDisregardPlatformChecks = 1;
229 waTable->Wa4kAlignUVOffsetNV12LinearSurface = 1;
230
231 // Set it to 0 if need to support 256B compress mode
232 waTable->WaLimit128BMediaCompr = 0;
233
234 return true;
235 }
236
237 static struct GfxDeviceInfo xehpGt4Info = {
238 .platformType = PLATFORM_MOBILE,
239 .productFamily = IGFX_XE_HP_SDV,
240 .displayFamily = IGFX_XE_HP_CORE,
241 .renderFamily = IGFX_XE_HP_CORE,
242 .mediaFamily = IGFX_UNKNOWN_CORE,
243 .eGTType = GTTYPE_GT4,
244 .L3CacheSizeInKb = 0,
245 .L3BankCount = 0,
246 .EUCount = 0,
247 .SliceCount = 0,
248 .SubSliceCount = 0,
249 .MaxEuPerSubSlice = 0,
250 .isLCIA = 0,
251 .hasLLC = 0,
252 .hasERAM = 0,
253 .InitMediaSysInfo = InitXeHPMediaSysInfo,
254 .InitShadowSku = InitXeHPShadowSku,
255 .InitShadowWa = InitXeHPShadowWa,
256 };
257
258 static struct GfxDeviceInfo pvcGt4Info = {
259 .platformType = PLATFORM_MOBILE,
260 .productFamily = IGFX_PVC,
261 .displayFamily = IGFX_GEN12_CORE,
262 .renderFamily = IGFX_XE_HPC_CORE,
263 .mediaFamily = IGFX_UNKNOWN_CORE,
264 .eGTType = GTTYPE_GT4,
265 .L3CacheSizeInKb = 0,
266 .L3BankCount = 0,
267 .EUCount = 0,
268 .SliceCount = 0,
269 .SubSliceCount = 0,
270 .MaxEuPerSubSlice = 0,
271 .isLCIA = 0,
272 .hasLLC = 0,
273 .hasERAM = 0,
274 .InitMediaSysInfo = InitXeHPMediaSysInfo,
275 .InitShadowSku = InitPvcShadowSku,
276 .InitShadowWa = InitPvcShadowWa,
277 };
278
279 static struct GfxDeviceInfo dg2Gt4Info = {
280 .platformType = PLATFORM_MOBILE,
281 .productFamily = IGFX_DG2,
282 .displayFamily = IGFX_GEN12_CORE,
283 .renderFamily = IGFX_XE_HPG_CORE,
284 .mediaFamily = IGFX_UNKNOWN_CORE,
285 .eGTType = GTTYPE_UNDEFINED,
286 .L3CacheSizeInKb = 0,
287 .L3BankCount = 0,
288 .EUCount = 0,
289 .SliceCount = 0,
290 .SubSliceCount = 0,
291 .MaxEuPerSubSlice = 0,
292 .isLCIA = 0,
293 .hasLLC = 0,
294 .hasERAM = 0,
295 .InitMediaSysInfo = InitXeHPMediaSysInfo,
296 .InitShadowSku = InitXeHPShadowSku,
297 .InitShadowWa = InitXeHPShadowWa,
298 };
299
300 static bool xehpGt4Devicef2d2 = DeviceInfoFactory<GfxDeviceInfo>::
301 RegisterDevice(0xF2D2, &xehpGt4Info);
302
303 static bool xehpGt4Device0201 = DeviceInfoFactory<GfxDeviceInfo>::
304 RegisterDevice(0x0201, &xehpGt4Info);
305
306 static bool xehpGt4Device0202 = DeviceInfoFactory<GfxDeviceInfo>::
307 RegisterDevice(0x0202, &xehpGt4Info);
308
309 static bool xehpGt4Device0203 = DeviceInfoFactory<GfxDeviceInfo>::
310 RegisterDevice(0x0203, &xehpGt4Info);
311
312 static bool xehpGt4Device0204 = DeviceInfoFactory<GfxDeviceInfo>::
313 RegisterDevice(0x0204, &xehpGt4Info);
314
315 static bool xehpGt4Device0205 = DeviceInfoFactory<GfxDeviceInfo>::
316 RegisterDevice(0x0205, &xehpGt4Info);
317
318 static bool xehpGt4Device0206 = DeviceInfoFactory<GfxDeviceInfo>::
319 RegisterDevice(0x0206, &xehpGt4Info);
320
321 static bool xehpGt4Device0207 = DeviceInfoFactory<GfxDeviceInfo>::
322 RegisterDevice(0x0207, &xehpGt4Info);
323
324 static bool xehpGt4Device0208 = DeviceInfoFactory<GfxDeviceInfo>::
325 RegisterDevice(0x0208, &xehpGt4Info);
326
327 static bool xehpGt4Device0209 = DeviceInfoFactory<GfxDeviceInfo>::
328 RegisterDevice(0x0209, &xehpGt4Info);
329
330 static bool xehpGt4Device020A = DeviceInfoFactory<GfxDeviceInfo>::
331 RegisterDevice(0x020A, &xehpGt4Info);
332
333 static bool xehpGt4Device020B = DeviceInfoFactory<GfxDeviceInfo>::
334 RegisterDevice(0x020B, &xehpGt4Info);
335
336 static bool xehpGt4Device020C = DeviceInfoFactory<GfxDeviceInfo>::
337 RegisterDevice(0x020C, &xehpGt4Info);
338
339 static bool xehpGt4Device020D = DeviceInfoFactory<GfxDeviceInfo>::
340 RegisterDevice(0x020D, &xehpGt4Info);
341
342 static bool xehpGt4Device020E = DeviceInfoFactory<GfxDeviceInfo>::
343 RegisterDevice(0x020E, &xehpGt4Info);
344
345 static bool xehpGt4Device020F = DeviceInfoFactory<GfxDeviceInfo>::
346 RegisterDevice(0x020F, &xehpGt4Info);
347
348 static bool xehpGt4Device0210 = DeviceInfoFactory<GfxDeviceInfo>::
349 RegisterDevice(0x0210, &xehpGt4Info);
350
351 static bool pvcGt4Device0bd0 = DeviceInfoFactory<GfxDeviceInfo>::
352 RegisterDevice(0x0bd0, &pvcGt4Info);
353
354 static bool pvcGt4Device0bd5 = DeviceInfoFactory<GfxDeviceInfo>::
355 RegisterDevice(0x0bd5, &pvcGt4Info);
356
357 static bool pvcGt4Device0bd6 = DeviceInfoFactory<GfxDeviceInfo>::
358 RegisterDevice(0x0bd6, &pvcGt4Info);
359
360 static bool pvcGt4Device0bd7 = DeviceInfoFactory<GfxDeviceInfo>::
361 RegisterDevice(0x0bd7, &pvcGt4Info);
362
363 static bool pvcGt4Device0bd8 = DeviceInfoFactory<GfxDeviceInfo>::
364 RegisterDevice(0x0bd8, &pvcGt4Info);
365
366 static bool pvcGt4Device0bd9 = DeviceInfoFactory<GfxDeviceInfo>::
367 RegisterDevice(0x0bd9, &pvcGt4Info);
368
369 static bool pvcGt4Device0bda = DeviceInfoFactory<GfxDeviceInfo>::
370 RegisterDevice(0x0bda, &pvcGt4Info);
371
372 static bool pvcGt4Device0bdb = DeviceInfoFactory<GfxDeviceInfo>::
373 RegisterDevice(0x0bdb, &pvcGt4Info);
374
375 static bool pvcGt4Device0be0 = DeviceInfoFactory<GfxDeviceInfo>::
376 RegisterDevice(0x0be0, &pvcGt4Info);
377
378 static bool pvcGt4Device0be1 = DeviceInfoFactory<GfxDeviceInfo>::
379 RegisterDevice(0x0be1, &pvcGt4Info);
380
381 static bool pvcGt4Device0be5 = DeviceInfoFactory<GfxDeviceInfo>::
382 RegisterDevice(0x0be5, &pvcGt4Info);
383
384 static bool dg2Gt4Device4F80 = DeviceInfoFactory<GfxDeviceInfo>::
385 RegisterDevice(0x4F80, &dg2Gt4Info);
386
387 static bool dg2Gt4Device4F81 = DeviceInfoFactory<GfxDeviceInfo>::
388 RegisterDevice(0x4F81, &dg2Gt4Info);
389
390 static bool dg2Gt4Device4F82 = DeviceInfoFactory<GfxDeviceInfo>::
391 RegisterDevice(0x4F82, &dg2Gt4Info);
392
393 static bool dg2Gt4Device4F83 = DeviceInfoFactory<GfxDeviceInfo>::
394 RegisterDevice(0x4F83, &dg2Gt4Info);
395
396 static bool dg2Gt4Device4F84 = DeviceInfoFactory<GfxDeviceInfo>::
397 RegisterDevice(0x4F84, &dg2Gt4Info);
398
399 static bool dg2Gt4Device4F85 = DeviceInfoFactory<GfxDeviceInfo>::
400 RegisterDevice(0x4F85, &dg2Gt4Info);
401
402 static bool dg2Gt4Device4F86 = DeviceInfoFactory<GfxDeviceInfo>::
403 RegisterDevice(0x4F86, &dg2Gt4Info);
404
405 static bool dg2Gt4Device4F87 = DeviceInfoFactory<GfxDeviceInfo>::
406 RegisterDevice(0x4F87, &dg2Gt4Info);
407
408 static bool dg2Gt4Device4F88 = DeviceInfoFactory<GfxDeviceInfo>::
409 RegisterDevice(0x4F88, &dg2Gt4Info);
410
411 static bool dg2Gt4Device5690 = DeviceInfoFactory<GfxDeviceInfo>::
412 RegisterDevice(0x5690, &dg2Gt4Info);
413
414 static bool dg2Gt4Device5691 = DeviceInfoFactory<GfxDeviceInfo>::
415 RegisterDevice(0x5691, &dg2Gt4Info);
416
417 static bool dg2Gt4Device5692 = DeviceInfoFactory<GfxDeviceInfo>::
418 RegisterDevice(0x5692, &dg2Gt4Info);
419
420 static bool dg2Gt4Device5693 = DeviceInfoFactory<GfxDeviceInfo>::
421 RegisterDevice(0x5693, &dg2Gt4Info);
422
423 static bool dg2Gt4Device5694 = DeviceInfoFactory<GfxDeviceInfo>::
424 RegisterDevice(0x5694, &dg2Gt4Info);
425
426 static bool dg2Gt4Device5695 = DeviceInfoFactory<GfxDeviceInfo>::
427 RegisterDevice(0x5695, &dg2Gt4Info);
428
429 static bool dg2Gt4Device5696 = DeviceInfoFactory<GfxDeviceInfo>::
430 RegisterDevice(0x5696, &dg2Gt4Info);
431
432 static bool dg2Gt4Device5697 = DeviceInfoFactory<GfxDeviceInfo>::
433 RegisterDevice(0x5697, &dg2Gt4Info);
434
435 static bool dg2Gt4Device56A0 = DeviceInfoFactory<GfxDeviceInfo>::
436 RegisterDevice(0x56A0, &dg2Gt4Info);
437
438 static bool dg2Gt4Device56A1 = DeviceInfoFactory<GfxDeviceInfo>::
439 RegisterDevice(0x56A1, &dg2Gt4Info);
440
441 static bool dg2Gt4Device56A2 = DeviceInfoFactory<GfxDeviceInfo>::
442 RegisterDevice(0x56A2, &dg2Gt4Info);
443
444 static bool dg2Gt4Device56A3 = DeviceInfoFactory<GfxDeviceInfo>::
445 RegisterDevice(0x56A3, &dg2Gt4Info);
446
447 static bool dg2Gt4Device56A4 = DeviceInfoFactory<GfxDeviceInfo>::
448 RegisterDevice(0x56A4, &dg2Gt4Info);
449
450 static bool dg2Gt4Device56A5 = DeviceInfoFactory<GfxDeviceInfo>::
451 RegisterDevice(0x56A5, &dg2Gt4Info);
452
453 static bool dg2Gt4Device56A6 = DeviceInfoFactory<GfxDeviceInfo>::
454 RegisterDevice(0x56A6, &dg2Gt4Info);
455
456 static bool dg2Gt4Device56B0 = DeviceInfoFactory<GfxDeviceInfo>::
457 RegisterDevice(0x56B0, &dg2Gt4Info);
458
459 static bool dg2Gt4Device56B1 = DeviceInfoFactory<GfxDeviceInfo>::
460 RegisterDevice(0x56B1, &dg2Gt4Info);
461
462 static bool dg2Gt4Device56BA = DeviceInfoFactory<GfxDeviceInfo>::
463 RegisterDevice(0x56BA, &dg2Gt4Info);
464
465 static bool dg2Gt4Device56BB = DeviceInfoFactory<GfxDeviceInfo>::
466 RegisterDevice(0x56BB, &dg2Gt4Info);
467
468 static bool dg2Gt4Device56BC = DeviceInfoFactory<GfxDeviceInfo>::
469 RegisterDevice(0x56BC, &dg2Gt4Info);
470
471 static bool dg2Gt4Device56BD = DeviceInfoFactory<GfxDeviceInfo>::
472 RegisterDevice(0x56BD, &dg2Gt4Info);
473
474 static bool dg2Gt4Device56B2 = DeviceInfoFactory<GfxDeviceInfo>::
475 RegisterDevice(0x56B2, &dg2Gt4Info);
476
477 static bool dg2Gt4Device56B3 = DeviceInfoFactory<GfxDeviceInfo>::
478 RegisterDevice(0x56B3, &dg2Gt4Info);
479
480 static bool dg2Gt4Device56C0 = DeviceInfoFactory<GfxDeviceInfo>::
481 RegisterDevice(0x56C0, &dg2Gt4Info);
482
483 static bool dg2Gt4Device56C1 = DeviceInfoFactory<GfxDeviceInfo>::
484 RegisterDevice(0x56C1, &dg2Gt4Info);
485
486 static bool dg2Gt4Device56C2 = DeviceInfoFactory<GfxDeviceInfo>::
487 RegisterDevice(0x56C2, &dg2Gt4Info);
488
489 static bool dg2Gt4Device56BE = DeviceInfoFactory<GfxDeviceInfo>::
490 RegisterDevice(0x56BE, &dg2Gt4Info);
491
492 static bool dg2Gt4Device56BF = DeviceInfoFactory<GfxDeviceInfo>::
493 RegisterDevice(0x56BF, &dg2Gt4Info);
494
495 static bool dg2Gt4Device56AF = DeviceInfoFactory<GfxDeviceInfo>::
496 RegisterDevice(0x56AF, &dg2Gt4Info);
497
498