intel_gart: add support for Gen8+ GPUs
Change-Id: I8b84e278f33542c359fc0d783f571e06ebc89b2a Reviewed-on: https://review.haiku-os.org/c/haiku/+/4737 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Rudolf Cornelissen <rudhaiku@gmail.com>
This commit is contained in:
parent
c199501e81
commit
fe9ab0f353
@ -51,6 +51,8 @@
|
||||
#define INTEL_GROUP_BDW (INTEL_FAMILY_SOC0 | 0x0040) // Broadwell
|
||||
#define INTEL_GROUP_SKY (INTEL_FAMILY_LAKE | 0x0010) // SkyLake
|
||||
#define INTEL_GROUP_KBY (INTEL_FAMILY_LAKE | 0x0020) // KabyLake
|
||||
#define INTEL_GROUP_CFL (INTEL_FAMILY_LAKE | 0x0040) // CoffeeLake
|
||||
#define INTEL_GROUP_CML (INTEL_FAMILY_LAKE | 0x0080) // CometLake
|
||||
// models
|
||||
#define INTEL_TYPE_SERVER 0x0004
|
||||
#define INTEL_TYPE_MOBILE 0x0008
|
||||
@ -82,6 +84,8 @@
|
||||
#define INTEL_MODEL_SKY (INTEL_GROUP_SKY)
|
||||
#define INTEL_MODEL_SKYM (INTEL_GROUP_SKY | INTEL_TYPE_MOBILE)
|
||||
#define INTEL_MODEL_SKYS (INTEL_GROUP_SKY | INTEL_TYPE_SERVER)
|
||||
#define INTEL_MODEL_CFL (INTEL_GROUP_CFL)
|
||||
#define INTEL_MODEL_CML (INTEL_GROUP_CML)
|
||||
|
||||
#define INTEL_PCH_DEVICE_ID_MASK 0xff80
|
||||
#define INTEL_PCH_IBX_DEVICE_ID 0x3b00
|
||||
@ -420,6 +424,54 @@ struct intel_free_graphics_memory {
|
||||
#define SNB_GTT_SIZE_1MB (1 << 8)
|
||||
#define SNB_GTT_SIZE_2MB (2 << 8)
|
||||
|
||||
// BDW+ (GGC_0_0_0_PCI)
|
||||
|
||||
#define BDW_GRAPHICS_MEMORY_CONTROL 0x50
|
||||
|
||||
#define BDW_STOLEN_MEMORY_MASK 0xff00
|
||||
#define BDW_STOLEN_MEMORY_32MB (1 << 8)
|
||||
#define BDW_STOLEN_MEMORY_64MB (2 << 8)
|
||||
#define BDW_STOLEN_MEMORY_96MB (3 << 8)
|
||||
#define BDW_STOLEN_MEMORY_128MB (4 << 8)
|
||||
#define BDW_STOLEN_MEMORY_160MB (5 << 8)
|
||||
#define BDW_STOLEN_MEMORY_192MB (6 << 8)
|
||||
#define BDW_STOLEN_MEMORY_224MB (7 << 8)
|
||||
#define BDW_STOLEN_MEMORY_256MB (8 << 8)
|
||||
#define BDW_STOLEN_MEMORY_288MB (9 << 8)
|
||||
#define BDW_STOLEN_MEMORY_320MB (10 << 8)
|
||||
#define BDW_STOLEN_MEMORY_352MB (11 << 8)
|
||||
#define BDW_STOLEN_MEMORY_384MB (12 << 8)
|
||||
#define BDW_STOLEN_MEMORY_416MB (13 << 8)
|
||||
#define BDW_STOLEN_MEMORY_448MB (14 << 8)
|
||||
#define BDW_STOLEN_MEMORY_480MB (15 << 8)
|
||||
#define BDW_STOLEN_MEMORY_512MB (16 << 8)
|
||||
#define BDW_STOLEN_MEMORY_1024MB (32 << 8)
|
||||
#define BDW_STOLEN_MEMORY_1536MB (48 << 8)
|
||||
#define BDW_STOLEN_MEMORY_2016MB (63 << 8)
|
||||
#define SKL_STOLEN_MEMORY_2048MB (64 << 8)
|
||||
#define SKL_STOLEN_MEMORY_4MB (240 << 8)
|
||||
#define SKL_STOLEN_MEMORY_8MB (241 << 8)
|
||||
#define SKL_STOLEN_MEMORY_12MB (242 << 8)
|
||||
#define SKL_STOLEN_MEMORY_16MB (243 << 8)
|
||||
#define SKL_STOLEN_MEMORY_20MB (244 << 8)
|
||||
#define SKL_STOLEN_MEMORY_24MB (245 << 8)
|
||||
#define SKL_STOLEN_MEMORY_28MB (246 << 8)
|
||||
#define SKL_STOLEN_MEMORY_32MB (247 << 8)
|
||||
#define SKL_STOLEN_MEMORY_36MB (248 << 8)
|
||||
#define SKL_STOLEN_MEMORY_40MB (249 << 8)
|
||||
#define SKL_STOLEN_MEMORY_44MB (250 << 8)
|
||||
#define SKL_STOLEN_MEMORY_48MB (251 << 8)
|
||||
#define SKL_STOLEN_MEMORY_52MB (252 << 8)
|
||||
#define SKL_STOLEN_MEMORY_56MB (253 << 8)
|
||||
#define SKL_STOLEN_MEMORY_60MB (254 << 8)
|
||||
|
||||
|
||||
#define BDW_GTT_SIZE_MASK (3 << 6)
|
||||
#define BDW_GTT_SIZE_NONE (0 << 6)
|
||||
#define BDW_GTT_SIZE_2MB (1 << 6)
|
||||
#define BDW_GTT_SIZE_4MB (2 << 6)
|
||||
#define BDW_GTT_SIZE_8MB (3 << 6)
|
||||
|
||||
// graphics page translation table
|
||||
#define INTEL_PAGE_TABLE_CONTROL 0x02020
|
||||
#define PAGE_TABLE_ENABLED 0x00000001
|
||||
|
@ -193,7 +193,7 @@ static uint16
|
||||
gtt_memory_config(intel_info &info)
|
||||
{
|
||||
uint8 controlRegister = INTEL_GRAPHICS_MEMORY_CONTROL;
|
||||
if (info.type->InGroup(INTEL_GROUP_SNB))
|
||||
if (info.type->Generation() >= 6)
|
||||
controlRegister = SNB_GRAPHICS_MEMORY_CONTROL;
|
||||
|
||||
return get_pci_config(info.bridge, controlRegister, 2);
|
||||
@ -223,7 +223,9 @@ determine_gtt_stolen(intel_info &info)
|
||||
memorySize *= 8;
|
||||
break;
|
||||
}
|
||||
} else if (info.type->InGroup(INTEL_GROUP_SNB)) {
|
||||
} else if (info.type->InGroup(INTEL_GROUP_SNB)
|
||||
|| info.type->InGroup(INTEL_GROUP_IVB)
|
||||
|| info.type->InGroup(INTEL_GROUP_HAS)) {
|
||||
switch (memoryConfig & SNB_STOLEN_MEMORY_MASK) {
|
||||
case SNB_STOLEN_MEMORY_32MB:
|
||||
memorySize *= 32;
|
||||
@ -274,10 +276,120 @@ determine_gtt_stolen(intel_info &info)
|
||||
memorySize *= 512;
|
||||
break;
|
||||
}
|
||||
} else if (info.type->InGroup(INTEL_GROUP_BDW)
|
||||
|| info.type->InFamily(INTEL_FAMILY_LAKE)) {
|
||||
switch (memoryConfig & BDW_STOLEN_MEMORY_MASK) {
|
||||
case BDW_STOLEN_MEMORY_32MB:
|
||||
memorySize *= 32;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_64MB:
|
||||
memorySize *= 64;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_96MB:
|
||||
memorySize *= 96;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_128MB:
|
||||
memorySize *= 128;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_160MB:
|
||||
memorySize *= 160;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_192MB:
|
||||
memorySize *= 192;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_224MB:
|
||||
memorySize *= 224;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_256MB:
|
||||
memorySize *= 256;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_288MB:
|
||||
memorySize *= 288;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_320MB:
|
||||
memorySize *= 320;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_352MB:
|
||||
memorySize *= 352;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_384MB:
|
||||
memorySize *= 384;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_416MB:
|
||||
memorySize *= 416;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_448MB:
|
||||
memorySize *= 448;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_480MB:
|
||||
memorySize *= 480;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_512MB:
|
||||
memorySize *= 512;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_1024MB:
|
||||
memorySize *= 1024;
|
||||
break;
|
||||
case BDW_STOLEN_MEMORY_1536MB:
|
||||
memorySize *= 1536;
|
||||
break;
|
||||
}
|
||||
if(info.type->InGroup(INTEL_GROUP_BDW)) {
|
||||
if((memoryConfig & BDW_STOLEN_MEMORY_MASK) == BDW_STOLEN_MEMORY_2016MB) {
|
||||
memorySize *= 2016;
|
||||
}
|
||||
} else if(info.type->InFamily(INTEL_FAMILY_LAKE)) {
|
||||
switch(memoryConfig & BDW_STOLEN_MEMORY_MASK) {
|
||||
case SKL_STOLEN_MEMORY_4MB:
|
||||
memorySize *= 4;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_8MB:
|
||||
memorySize *= 8;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_12MB:
|
||||
memorySize *= 12;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_16MB:
|
||||
memorySize *= 16;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_20MB:
|
||||
memorySize *= 20;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_24MB:
|
||||
memorySize *= 24;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_28MB:
|
||||
memorySize *= 28;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_32MB:
|
||||
memorySize *= 32;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_36MB:
|
||||
memorySize *= 36;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_40MB:
|
||||
memorySize *= 40;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_44MB:
|
||||
memorySize *= 44;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_48MB:
|
||||
memorySize *= 48;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_52MB:
|
||||
memorySize *= 52;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_56MB:
|
||||
memorySize *= 56;
|
||||
break;
|
||||
case SKL_STOLEN_MEMORY_60MB:
|
||||
memorySize *= 60;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (info.type->InGroup(INTEL_GROUP_85x)
|
||||
|| info.type->InFamily(INTEL_FAMILY_9xx)
|
||||
|| info.type->InFamily(INTEL_FAMILY_SER5)
|
||||
|| info.type->InFamily(INTEL_FAMILY_SOC0)) {
|
||||
|| info.type->InGroup(INTEL_GROUP_ILK)) {
|
||||
switch (memoryConfig & STOLEN_MEMORY_MASK) {
|
||||
case i855_STOLEN_MEMORY_4M:
|
||||
memorySize *= 4;
|
||||
@ -372,7 +484,9 @@ determine_gtt_size(intel_info &info)
|
||||
gttSize = 4 << 20;
|
||||
break;
|
||||
}
|
||||
} else if (info.type->InGroup(INTEL_GROUP_SNB)) {
|
||||
} else if (info.type->InGroup(INTEL_GROUP_SNB)
|
||||
|| info.type->InGroup(INTEL_GROUP_IVB)
|
||||
|| info.type->InGroup(INTEL_GROUP_HAS)) {
|
||||
switch (memoryConfig & SNB_GTT_SIZE_MASK) {
|
||||
case SNB_GTT_SIZE_NONE:
|
||||
gttSize = 0;
|
||||
@ -384,6 +498,22 @@ determine_gtt_size(intel_info &info)
|
||||
gttSize = 2 << 20;
|
||||
break;
|
||||
}
|
||||
} else if (info.type->InGroup(INTEL_GROUP_BDW)
|
||||
|| info.type->InFamily(INTEL_FAMILY_LAKE)) {
|
||||
switch (memoryConfig & BDW_GTT_SIZE_MASK) {
|
||||
case BDW_GTT_SIZE_NONE:
|
||||
gttSize = 0;
|
||||
break;
|
||||
case BDW_GTT_SIZE_2MB:
|
||||
gttSize = 2 << 20;
|
||||
break;
|
||||
case BDW_GTT_SIZE_4MB:
|
||||
gttSize = 4 << 20;
|
||||
break;
|
||||
case BDW_GTT_SIZE_8MB:
|
||||
gttSize = 8 << 20;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// older models have the GTT as large as their frame buffer mapping
|
||||
// TODO: check if the i9xx version works with the i8xx chips as well
|
||||
|
Loading…
Reference in New Issue
Block a user