| 1 |
/*===================== begin_copyright_notice ================================== |
| 2 |
|
| 3 |
Copyright (c) 2024, 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_ptl.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 |
|
| 41 |
static bool InitPtlMediaSysInfo(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 |
|
| 84 |
static bool InitPtlShadowSku(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->FtrULT = 0; |
| 101 |
|
| 102 |
skuTable->FtrPPGTT = 1; |
| 103 |
skuTable->FtrIA32eGfxPTEs = 1; |
| 104 |
|
| 105 |
skuTable->FtrDisplayYTiling = 1; |
| 106 |
skuTable->FtrEDram = devInfo->hasERAM; |
| 107 |
|
| 108 |
bool disableMMC = false; |
| 109 |
skuTable->FtrE2ECompression = 1; |
| 110 |
skuTable->FtrXe2Compression = 1; |
| 111 |
// Disable MMC for all components if set reg key |
| 112 |
MOS_USER_FEATURE_VALUE_DATA userFeatureData; |
| 113 |
MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData)); |
| 114 |
MOS_UserFeature_ReadValue_ID( |
| 115 |
nullptr, |
| 116 |
__MEDIA_USER_FEATURE_VALUE_DISABLE_MMC_ID, |
| 117 |
&userFeatureData, |
| 118 |
(MOS_CONTEXT_HANDLE)nullptr); |
| 119 |
if (userFeatureData.bData) |
| 120 |
{ |
| 121 |
disableMMC = true; |
| 122 |
} |
| 123 |
|
| 124 |
if (disableMMC) |
| 125 |
{ |
| 126 |
skuTable->FtrE2ECompression = 0; |
| 127 |
skuTable->FtrXe2Compression = 0; |
| 128 |
} |
| 129 |
|
| 130 |
skuTable->FtrLinearCCS = 1; |
| 131 |
skuTable->FtrTileY = 0; |
| 132 |
skuTable->FtrFlatPhysCCS = 1; |
| 133 |
|
| 134 |
return true; |
| 135 |
} |
| 136 |
|
| 137 |
static bool InitPtlShadowWa(struct GfxDeviceInfo *devInfo, |
| 138 |
SHADOW_MEDIA_WA_TABLE *waTable, |
| 139 |
struct LinuxDriverInfo *drvInfo) |
| 140 |
{ |
| 141 |
if ((devInfo == nullptr) || (waTable == nullptr) || (drvInfo == nullptr)) |
| 142 |
{ |
| 143 |
DEVINFO_ERROR("null ptr is passed\n"); |
| 144 |
return false; |
| 145 |
} |
| 146 |
|
| 147 |
/* by default PPGTT is enabled */ |
| 148 |
waTable->WaForceGlobalGTT = 0; |
| 149 |
if (drvInfo->hasPpgtt == 0) |
| 150 |
{ |
| 151 |
waTable->WaForceGlobalGTT = 1; |
| 152 |
} |
| 153 |
|
| 154 |
waTable->WaDisregardPlatformChecks = 1; |
| 155 |
waTable->Wa4kAlignUVOffsetNV12LinearSurface = 1; |
| 156 |
|
| 157 |
//source and recon surfaces need to be aligned to the LCU size |
| 158 |
waTable->WaAlignYUVResourceToLCU = 1; |
| 159 |
|
| 160 |
return true; |
| 161 |
} |
| 162 |
|
| 163 |
|
| 164 |
static struct GfxDeviceInfo ptlInfo = { |
| 165 |
.platformType = PLATFORM_MOBILE, |
| 166 |
.productFamily = IGFX_PTL, |
| 167 |
.displayFamily = IGFX_UNKNOWN_CORE, |
| 168 |
.renderFamily = IGFX_XE3_CORE, |
| 169 |
.mediaFamily = IGFX_XE3_CORE, |
| 170 |
.eGTType = GTTYPE_GT2, |
| 171 |
.L3CacheSizeInKb = 0, |
| 172 |
.L3BankCount = 0, |
| 173 |
.EUCount = 0, |
| 174 |
.SliceCount = 0, |
| 175 |
.SubSliceCount = 0, |
| 176 |
.MaxEuPerSubSlice = 0, |
| 177 |
.isLCIA = 0, |
| 178 |
.hasLLC = 0, |
| 179 |
.hasERAM = 0, |
| 180 |
.InitMediaSysInfo = InitPtlMediaSysInfo, |
| 181 |
.InitShadowSku = InitPtlShadowSku, |
| 182 |
.InitShadowWa = InitPtlShadowWa, |
| 183 |
}; |
| 184 |
|
| 185 |
static bool ptlDeviceB080 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 186 |
RegisterDevice(0xB080, &ptlInfo); |
| 187 |
|
| 188 |
static bool ptlDeviceB081 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 189 |
RegisterDevice(0xB081, &ptlInfo); |
| 190 |
|
| 191 |
static bool ptlDeviceB082 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 192 |
RegisterDevice(0xB082, &ptlInfo); |
| 193 |
|
| 194 |
static bool ptlDeviceB083 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 195 |
RegisterDevice(0xB083, &ptlInfo); |
| 196 |
|
| 197 |
static bool ptlDeviceB08F = DeviceInfoFactory<GfxDeviceInfo>:: |
| 198 |
RegisterDevice(0xB08F, &ptlInfo); |
| 199 |
|
| 200 |
static bool ptlDeviceB090 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 201 |
RegisterDevice(0xB090, &ptlInfo); |
| 202 |
|
| 203 |
static bool ptlDeviceB091 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 204 |
RegisterDevice(0xB091, &ptlInfo); |
| 205 |
|
| 206 |
static bool ptlDeviceB092 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 207 |
RegisterDevice(0xB092, &ptlInfo); |
| 208 |
|
| 209 |
static bool ptlDeviceB0A0 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 210 |
RegisterDevice(0xB0A0, &ptlInfo); |
| 211 |
|
| 212 |
static bool ptlDeviceB0A1 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 213 |
RegisterDevice(0xB0A1, &ptlInfo); |
| 214 |
|
| 215 |
static bool ptlDeviceB0A2 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 216 |
RegisterDevice(0xB0A2, &ptlInfo); |
| 217 |
|
| 218 |
static bool ptlDeviceB0B0 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 219 |
RegisterDevice(0xB0B0, &ptlInfo); |
| 220 |
|
| 221 |
static bool ptlDeviceB0FF = DeviceInfoFactory<GfxDeviceInfo>:: |
| 222 |
RegisterDevice(0xB0FF, &ptlInfo); |
| 223 |
|
| 224 |
//WCL DeviceID |
| 225 |
static bool wclDeviceFD80= DeviceInfoFactory<GfxDeviceInfo>:: |
| 226 |
RegisterDevice(0xFD80, &ptlInfo); |
| 227 |
|
| 228 |
static bool wclDeviceFD81 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 229 |
RegisterDevice(0xFD81, &ptlInfo); |