| 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_bmg.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 InitBmgMediaSysInfo(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 InitBmgShadowSku(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 |
skuTable->FtrXe2Compression = 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 |
disableMMC = true; |
| 124 |
} |
| 125 |
|
| 126 |
if (disableMMC) |
| 127 |
{ |
| 128 |
skuTable->FtrE2ECompression = 0; |
| 129 |
skuTable->FtrXe2Compression = 0; |
| 130 |
} |
| 131 |
|
| 132 |
skuTable->FtrLinearCCS = 1; |
| 133 |
skuTable->FtrTileY = 0; |
| 134 |
|
| 135 |
skuTable->FtrLocalMemory = 1; |
| 136 |
skuTable->FtrFlatPhysCCS = 1; |
| 137 |
|
| 138 |
return true; |
| 139 |
} |
| 140 |
|
| 141 |
static bool InitBmgShadowWa(struct GfxDeviceInfo *devInfo, |
| 142 |
SHADOW_MEDIA_WA_TABLE *waTable, |
| 143 |
struct LinuxDriverInfo *drvInfo) |
| 144 |
{ |
| 145 |
if ((devInfo == nullptr) || (waTable == nullptr) || (drvInfo == nullptr)) |
| 146 |
{ |
| 147 |
DEVINFO_ERROR("null ptr is passed\n"); |
| 148 |
return false; |
| 149 |
} |
| 150 |
|
| 151 |
/* by default PPGTT is enabled */ |
| 152 |
waTable->WaForceGlobalGTT = 0; |
| 153 |
if (drvInfo->hasPpgtt == 0) |
| 154 |
{ |
| 155 |
waTable->WaForceGlobalGTT = 1; |
| 156 |
} |
| 157 |
|
| 158 |
waTable->WaDisregardPlatformChecks = 1; |
| 159 |
waTable->Wa4kAlignUVOffsetNV12LinearSurface = 1; |
| 160 |
|
| 161 |
//source and recon surfaces need to be aligned to the LCU size |
| 162 |
waTable->WaAlignYUVResourceToLCU = 1; |
| 163 |
|
| 164 |
return true; |
| 165 |
} |
| 166 |
|
| 167 |
|
| 168 |
static struct GfxDeviceInfo bmgInfo = { |
| 169 |
.platformType = PLATFORM_MOBILE, |
| 170 |
.productFamily = IGFX_BMG, |
| 171 |
.displayFamily = IGFX_UNKNOWN_CORE, |
| 172 |
.renderFamily = IGFX_XE2_HPG_CORE, |
| 173 |
.mediaFamily = IGFX_UNKNOWN_CORE, |
| 174 |
.eGTType = GTTYPE_GT2, |
| 175 |
.L3CacheSizeInKb = 0, |
| 176 |
.L3BankCount = 0, |
| 177 |
.EUCount = 0, |
| 178 |
.SliceCount = 0, |
| 179 |
.SubSliceCount = 0, |
| 180 |
.MaxEuPerSubSlice = 0, |
| 181 |
.isLCIA = 0, |
| 182 |
.hasLLC = 0, |
| 183 |
.hasERAM = 0, |
| 184 |
.InitMediaSysInfo = InitBmgMediaSysInfo, |
| 185 |
.InitShadowSku = InitBmgShadowSku, |
| 186 |
.InitShadowWa = InitBmgShadowWa, |
| 187 |
}; |
| 188 |
|
| 189 |
static bool bmgDevicee202 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 190 |
RegisterDevice(0xe202, &bmgInfo); |
| 191 |
|
| 192 |
static bool bmgDevicee20B = DeviceInfoFactory<GfxDeviceInfo>:: |
| 193 |
RegisterDevice(0xe20B, &bmgInfo); |
| 194 |
|
| 195 |
static bool bmgDevicee20C = DeviceInfoFactory<GfxDeviceInfo>:: |
| 196 |
RegisterDevice(0xe20C, &bmgInfo); |
| 197 |
|
| 198 |
static bool bmgDevicee20D = DeviceInfoFactory<GfxDeviceInfo>:: |
| 199 |
RegisterDevice(0xe20D, &bmgInfo); |
| 200 |
|
| 201 |
static bool bmgDevicee210 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 202 |
RegisterDevice(0xe210, &bmgInfo); |
| 203 |
|
| 204 |
static bool bmgDevicee212 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 205 |
RegisterDevice(0xe212, &bmgInfo); |
| 206 |
|
| 207 |
static bool bmgDevicee216 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 208 |
RegisterDevice(0xe216, &bmgInfo); |
| 209 |
|
| 210 |
static bool bmgDevicee211 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 211 |
RegisterDevice(0xe211, &bmgInfo); |
| 212 |
|
| 213 |
static bool bmgDevicee220 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 214 |
RegisterDevice(0xe220, &bmgInfo); |
| 215 |
|
| 216 |
static bool bmgDevicee221 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 217 |
RegisterDevice(0xe221, &bmgInfo); |
| 218 |
|
| 219 |
static bool bmgDevicee222 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 220 |
RegisterDevice(0xe222, &bmgInfo); |
| 221 |
|
| 222 |
static bool bmgDevicee223 = DeviceInfoFactory<GfxDeviceInfo>:: |
| 223 |
RegisterDevice(0xe223, &bmgInfo); |