1 /*
2 * Copyright (c) 2018, 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 //! \file media_sysinfo_g11.cpp
24 //!
25
26 #include "igfxfmid.h"
27 #include "linux_system_info.h"
28 #include "skuwa_factory.h"
29 #include "linux_skuwa_debug.h"
30 #include "linux_media_skuwa.h"
31 #include "linux_shadow_skuwa.h"
32
33 //extern template class DeviceInfoFactory<GfxDeviceInfo>;
34 typedef DeviceInfoFactory<GfxDeviceInfo> base_fact;
35
36 #define GEN11_THREADS_PER_EU 7
37 #define GEN11_VDBOX4_SUBSLICE_COUNT 4
38 #define GEN11_VEBOX2_SUBSLICE_COUNT 4
39
InitIclShadowSku(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_FEATURE_TABLE * skuTable,struct LinuxDriverInfo * drvInfo)40 static bool InitIclShadowSku(struct GfxDeviceInfo *devInfo,
41 SHADOW_MEDIA_FEATURE_TABLE *skuTable,
42 struct LinuxDriverInfo *drvInfo)
43 {
44 if ((devInfo == nullptr) || (skuTable == nullptr) || (drvInfo == nullptr))
45 {
46 DEVINFO_ERROR("null ptr is passed\n");
47 return false;
48 }
49
50 skuTable->FtrVERing = 0;
51 if (drvInfo->hasVebox)
52 {
53 skuTable->FtrVERing = 1;
54 }
55
56 skuTable->FtrVcs2 = 0;
57
58 skuTable->FtrULT = 0;
59
60 skuTable->FtrPPGTT = 1;
61 skuTable->FtrIA32eGfxPTEs = 1;
62
63 skuTable->FtrDisplayYTiling = 1;
64 skuTable->FtrEDram = devInfo->hasERAM;
65
66 skuTable->FtrTileY = 1;
67
68 return true;
69 }
70
InitIclShadowWa(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_WA_TABLE * waTable,struct LinuxDriverInfo * drvInfo)71 static bool InitIclShadowWa(struct GfxDeviceInfo *devInfo,
72 SHADOW_MEDIA_WA_TABLE *waTable,
73 struct LinuxDriverInfo *drvInfo)
74 {
75 if ((devInfo == nullptr) || (waTable == nullptr) || (drvInfo == nullptr))
76 {
77 DEVINFO_ERROR("null ptr is passed\n");
78 return false;
79 }
80
81 /* by default PPGTT is enabled */
82 waTable->WaForceGlobalGTT = 0;
83 if (drvInfo->hasPpgtt == 0)
84 {
85 waTable->WaForceGlobalGTT = 1;
86 }
87
88 waTable->WaDisregardPlatformChecks = 1;
89 waTable->Wa4kAlignUVOffsetNV12LinearSurface = 1;
90
91 //source and recon surfaces need to be aligned to the LCU size
92 waTable->WaAlignYUVResourceToLCU = 1;
93
94 return true;
95 }
96
InitIcllpMediaSysInfo(struct GfxDeviceInfo * devInfo,MEDIA_GT_SYSTEM_INFO * sysInfo)97 static bool InitIcllpMediaSysInfo(struct GfxDeviceInfo *devInfo, MEDIA_GT_SYSTEM_INFO *sysInfo)
98 {
99 if ((devInfo == nullptr) || (sysInfo == nullptr))
100 {
101 DEVINFO_ERROR("null ptr is passed\n");
102 return false;
103 }
104
105 if (!sysInfo->SliceCount)
106 {
107 sysInfo->SliceCount = devInfo->SliceCount;
108 }
109
110 if (!sysInfo->SubSliceCount)
111 {
112 sysInfo->SubSliceCount = devInfo->SubSliceCount;
113 }
114
115 if (!sysInfo->EUCount)
116 {
117 sysInfo->EUCount = devInfo->EUCount;
118 }
119
120 sysInfo->L3CacheSizeInKb = devInfo->L3CacheSizeInKb;
121 sysInfo->L3BankCount = devInfo->L3BankCount;
122 sysInfo->VDBoxInfo.Instances.Bits.VDBox0Enabled = 1;
123 sysInfo->VDBoxInfo.Instances.Bits.VDBox1Enabled = 0;
124 sysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled = 1;
125 sysInfo->MaxEuPerSubSlice = devInfo->MaxEuPerSubSlice;
126 sysInfo->MaxSlicesSupported = sysInfo->SliceCount;
127 sysInfo->MaxSubSlicesSupported = sysInfo->SubSliceCount;
128
129 sysInfo->VEBoxInfo.NumberOfVEBoxEnabled = 1;
130 sysInfo->VDBoxInfo.NumberOfVDBoxEnabled = 0;//Query the VDBox number from KMD
131
132 sysInfo->ThreadCount = sysInfo->EUCount * GEN11_THREADS_PER_EU;
133
134 sysInfo->VEBoxInfo.IsValid = true;
135 sysInfo->VDBoxInfo.IsValid = true;
136
137 /* the GMM doesn't care the real size of ERAM/LLC. Instead it is used to
138 * indicate whether the LLC/ERAM exists
139 */
140 if (devInfo->hasERAM)
141 {
142 // 64M
143 sysInfo->EdramSizeInKb = 64 * 1024;
144 }
145 if (devInfo->hasLLC)
146 {
147 // 2M
148 sysInfo->LLCCacheSizeInKb = 2 * 1024;
149 }
150
151 return true;
152 }
153
InitEhlShadowSku(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_FEATURE_TABLE * skuTable,struct LinuxDriverInfo * drvInfo)154 static bool InitEhlShadowSku(struct GfxDeviceInfo *devInfo,
155 SHADOW_MEDIA_FEATURE_TABLE *skuTable,
156 struct LinuxDriverInfo *drvInfo)
157 {
158 if ((devInfo == nullptr) || (skuTable == nullptr) || (drvInfo == nullptr))
159 {
160 DEVINFO_ERROR("null ptr is passed\n");
161 return false;
162 }
163
164 skuTable->FtrVERing = 0;
165 if (drvInfo->hasVebox)
166 {
167 skuTable->FtrVERing = 1;
168 }
169
170 skuTable->FtrVcs2 = 0;
171
172 skuTable->FtrULT = 0;
173
174 skuTable->FtrPPGTT = 1;
175 skuTable->FtrIA32eGfxPTEs = 1;
176
177 skuTable->FtrDisplayYTiling = 1;
178 skuTable->FtrEDram = 0;
179 skuTable->FtrLLCBypass = 1;
180 skuTable->FtrTileY = 1;
181
182 return true;
183 }
InitEhlShadowWa(struct GfxDeviceInfo * devInfo,SHADOW_MEDIA_WA_TABLE * waTable,struct LinuxDriverInfo * drvInfo)184 static bool InitEhlShadowWa(struct GfxDeviceInfo *devInfo,
185 SHADOW_MEDIA_WA_TABLE *waTable,
186 struct LinuxDriverInfo *drvInfo)
187 {
188 if ((devInfo == nullptr) || (waTable == nullptr) || (drvInfo == nullptr))
189 {
190 DEVINFO_ERROR("null ptr is passed\n");
191 return false;
192 }
193
194 /* by default PPGTT is enabled */
195 waTable->WaForceGlobalGTT = 0;
196 if (drvInfo->hasPpgtt == 0)
197 {
198 waTable->WaForceGlobalGTT = 1;
199 }
200
201 waTable->WaDisregardPlatformChecks = 1;
202 waTable->Wa4kAlignUVOffsetNV12LinearSurface = 1;
203
204 //source and recon surfaces need to be aligned to the LCU size
205 waTable->WaAlignYUVResourceToLCU = 1;
206
207 return true;
208 }
209
InitEhlMediaSysInfo(struct GfxDeviceInfo * devInfo,MEDIA_GT_SYSTEM_INFO * sysInfo)210 static bool InitEhlMediaSysInfo(struct GfxDeviceInfo *devInfo, MEDIA_GT_SYSTEM_INFO *sysInfo)
211 {
212 if ((devInfo == nullptr) || (sysInfo == nullptr))
213 {
214 DEVINFO_ERROR("null ptr is passed\n");
215 return false;
216 }
217
218 if (!sysInfo->SliceCount)
219 {
220 sysInfo->SliceCount = devInfo->SliceCount;
221 }
222
223 if (!sysInfo->SubSliceCount)
224 {
225 sysInfo->SubSliceCount = devInfo->SubSliceCount;
226 }
227
228 if (!sysInfo->EUCount)
229 {
230 sysInfo->EUCount = devInfo->EUCount;
231 }
232
233 sysInfo->L3CacheSizeInKb = devInfo->L3CacheSizeInKb;
234 sysInfo->L3BankCount = devInfo->L3BankCount;
235 /* EHL has only one VDBox */
236 sysInfo->VDBoxInfo.Instances.Bits.VDBox0Enabled = 1;
237 sysInfo->VDBoxInfo.Instances.Bits.VDBox1Enabled = 0;
238 sysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled = 1;
239 sysInfo->MaxEuPerSubSlice = devInfo->MaxEuPerSubSlice;
240 sysInfo->MaxSlicesSupported = sysInfo->SliceCount;
241 sysInfo->MaxSubSlicesSupported = sysInfo->SubSliceCount;
242
243 sysInfo->VEBoxInfo.NumberOfVEBoxEnabled = 1;
244 sysInfo->VDBoxInfo.NumberOfVDBoxEnabled = 1;
245
246 sysInfo->ThreadCount = sysInfo->EUCount * GEN11_THREADS_PER_EU;
247
248 sysInfo->VEBoxInfo.IsValid = true;
249 sysInfo->VDBoxInfo.IsValid = true;
250
251 /* the GMM doesn't care the real size of ERAM/LLC. Instead it is used to
252 * indicate whether the LLC/ERAM exists
253 */
254 if (devInfo->hasERAM)
255 {
256 // 64M
257 sysInfo->EdramSizeInKb = 64 * 1024;
258 }
259 if (devInfo->hasLLC)
260 {
261 // 2M
262 sysInfo->LLCCacheSizeInKb = 2 * 1024;
263 }
264
265 return true;
266 }
267
268 static struct GfxDeviceInfo icllpGt1Info = {
269 .platformType = PLATFORM_MOBILE,
270 .productFamily = IGFX_ICELAKE_LP,
271 .displayFamily = IGFX_GEN11_CORE,
272 .renderFamily = IGFX_GEN11_CORE,
273 .mediaFamily = IGFX_UNKNOWN_CORE,
274 .eGTType = GTTYPE_GT1,
275 .L3CacheSizeInKb = 2304,
276 .L3BankCount = 6,
277 .EUCount = 48,
278 .SliceCount = 1,
279 .SubSliceCount = 6,
280 .MaxEuPerSubSlice = 8,
281 .isLCIA = 0,
282 .hasLLC = 1,
283 .hasERAM = 0,
284 .InitMediaSysInfo = InitIcllpMediaSysInfo,
285 .InitShadowSku = InitIclShadowSku,
286 .InitShadowWa = InitIclShadowWa,
287 };
288
289 static struct GfxDeviceInfo icllpGt05Info = {
290 .platformType = PLATFORM_MOBILE,
291 .productFamily = IGFX_ICELAKE_LP,
292 .displayFamily = IGFX_GEN11_CORE,
293 .renderFamily = IGFX_GEN11_CORE,
294 .mediaFamily = IGFX_UNKNOWN_CORE,
295 .eGTType = GTTYPE_GT1,
296 .L3CacheSizeInKb = 2304,
297 .L3BankCount = 6,
298 .EUCount = 8,
299 .SliceCount = 1,
300 .SubSliceCount = 1,
301 .MaxEuPerSubSlice = 8,
302 .isLCIA = 0,
303 .hasLLC = 1,
304 .hasERAM = 0,
305 .InitMediaSysInfo = InitIcllpMediaSysInfo,
306 .InitShadowSku = InitIclShadowSku,
307 .InitShadowWa = InitIclShadowWa,
308 };
309 static struct GfxDeviceInfo icllpGt2Info = {
310 .platformType = PLATFORM_MOBILE,
311 .productFamily = IGFX_ICELAKE_LP,
312 .displayFamily = IGFX_GEN11_CORE,
313 .renderFamily = IGFX_GEN11_CORE,
314 .mediaFamily = IGFX_UNKNOWN_CORE,
315 .eGTType = GTTYPE_GT2,
316 .L3CacheSizeInKb = 3072,
317 .L3BankCount = 8,
318 .EUCount = 64,
319 .SliceCount = 1,
320 .SubSliceCount = 8,
321 .MaxEuPerSubSlice = 8,
322 .isLCIA = 0,
323 .hasLLC = 1,
324 .hasERAM = 0,
325 .InitMediaSysInfo = InitIcllpMediaSysInfo,
326 .InitShadowSku = InitIclShadowSku,
327 .InitShadowWa = InitIclShadowWa,
328 };
329 static struct GfxDeviceInfo ehlDevInfo = {
330 .platformType = PLATFORM_MOBILE,
331 .productFamily = IGFX_ELKHARTLAKE,
332 .displayFamily = IGFX_GEN11_CORE,
333 .renderFamily = IGFX_GEN11_CORE,
334 .mediaFamily = IGFX_UNKNOWN_CORE,
335 .eGTType = GTTYPE_GT1,
336 .L3CacheSizeInKb = 1280,
337 .L3BankCount = 4,
338 .EUCount = 32,
339 .SliceCount = 1,
340 .SubSliceCount = 4,
341 .MaxEuPerSubSlice = 8,
342 .isLCIA = 0,
343 .hasLLC = 1,
344 .hasERAM = 0,
345 .InitMediaSysInfo = InitEhlMediaSysInfo,
346 .InitShadowSku = InitEhlShadowSku,
347 .InitShadowWa = InitEhlShadowWa,
348 };
349 static struct GfxDeviceInfo ehlDevInfo16EU = {
350 .platformType = PLATFORM_MOBILE,
351 .productFamily = IGFX_ELKHARTLAKE,
352 .displayFamily = IGFX_GEN11_CORE,
353 .renderFamily = IGFX_GEN11_CORE,
354 .mediaFamily = IGFX_UNKNOWN_CORE,
355 .eGTType = GTTYPE_GT1,
356 .L3CacheSizeInKb = 1280,
357 .L3BankCount = 4,
358 .EUCount = 16,
359 .SliceCount = 1,
360 .SubSliceCount = 2,
361 .MaxEuPerSubSlice = 8,
362 .isLCIA = 0,
363 .hasLLC = 1,
364 .hasERAM = 0,
365 .InitMediaSysInfo = InitEhlMediaSysInfo,
366 .InitShadowSku = InitEhlShadowSku,
367 .InitShadowWa = InitEhlShadowWa,
368 };
369
370 static bool icllpDeviceff05 = DeviceInfoFactory<GfxDeviceInfo>::
371 RegisterDevice(0xff05, &icllpGt1Info);
372
373 static bool icllpDevice8a50 = DeviceInfoFactory<GfxDeviceInfo>::
374 RegisterDevice(0x8a50, &icllpGt2Info);
375
376 static bool icllpDevice8a51 = DeviceInfoFactory<GfxDeviceInfo>::
377 RegisterDevice(0x8a51, &icllpGt2Info);
378
379 static bool icllpDevice8a52 = DeviceInfoFactory<GfxDeviceInfo>::
380 RegisterDevice(0x8a52, &icllpGt2Info);
381
382 static bool icllpDevice8a53 = DeviceInfoFactory<GfxDeviceInfo>::
383 RegisterDevice(0x8a53, &icllpGt2Info);
384
385 static bool icllpDevice8a54 = DeviceInfoFactory<GfxDeviceInfo>::
386 RegisterDevice(0x8a54, &icllpGt1Info);
387
388 static bool icllpDevice8a56 = DeviceInfoFactory<GfxDeviceInfo>::
389 RegisterDevice(0x8a56, &icllpGt1Info);
390
391 static bool icllpDevice8a57 = DeviceInfoFactory<GfxDeviceInfo>::
392 RegisterDevice(0x8a57, &icllpGt1Info);
393
394 static bool icllpDevice8a58 = DeviceInfoFactory<GfxDeviceInfo>::
395 RegisterDevice(0x8a58, &icllpGt1Info);
396
397 static bool icllpDevice8a59 = DeviceInfoFactory<GfxDeviceInfo>::
398 RegisterDevice(0x8a59, &icllpGt1Info);
399
400 static bool icllpDevice8a5d = DeviceInfoFactory<GfxDeviceInfo>::
401 RegisterDevice(0x8a5d, &icllpGt1Info);
402
403 static bool icllpDevice8a5c = DeviceInfoFactory<GfxDeviceInfo>::
404 RegisterDevice(0x8a5c, &icllpGt1Info);
405
406 static bool icllpDevice8a5b = DeviceInfoFactory<GfxDeviceInfo>::
407 RegisterDevice(0x8a5b, &icllpGt1Info);
408
409 static bool icllpDevice8a5a = DeviceInfoFactory<GfxDeviceInfo>::
410 RegisterDevice(0x8a5a, &icllpGt1Info);
411
412 static bool icllpDevice8a71 = DeviceInfoFactory<GfxDeviceInfo>::
413 RegisterDevice(0x8a71, &icllpGt05Info);
414
415 static bool ehlDevice4500 = DeviceInfoFactory<GfxDeviceInfo>::
416 RegisterDevice(0x4500, &ehlDevInfo);
417
418 static bool ehlDevice4571 = DeviceInfoFactory<GfxDeviceInfo>::
419 RegisterDevice(0x4571, &ehlDevInfo);
420
421 static bool ehlDevice4551 = DeviceInfoFactory<GfxDeviceInfo>::
422 RegisterDevice(0x4551, &ehlDevInfo);
423
424 static bool ehlDevice4541 = DeviceInfoFactory<GfxDeviceInfo>::
425 RegisterDevice(0x4541, &ehlDevInfo);
426
427 static bool ehlDevice4E51 = DeviceInfoFactory<GfxDeviceInfo>::
428 RegisterDevice(0x4E51, &ehlDevInfo);
429
430 static bool ehlDevice4E61 = DeviceInfoFactory<GfxDeviceInfo>::
431 RegisterDevice(0x4E61, &ehlDevInfo);
432
433 static bool ehlDevice4E71 = DeviceInfoFactory<GfxDeviceInfo>::
434 RegisterDevice(0x4E71, &ehlDevInfo);
435
436 static bool ehlDevice4E55 = DeviceInfoFactory<GfxDeviceInfo>::
437 RegisterDevice(0x4E55, &ehlDevInfo16EU);
438
439 static bool ehlDevice4555 = DeviceInfoFactory<GfxDeviceInfo>::
440 RegisterDevice(0x4555, &ehlDevInfo16EU);
441