build: Adjust KDKlessWorkaround usage

This commit is contained in:
Mykola Grymalyuk
2023-01-23 19:44:43 -07:00
parent e1b99b9084
commit e84f3425d0

View File

@@ -390,6 +390,11 @@ class build_graphics_audio:
if not self.model in smbios_data.smbios_dictionary: if not self.model in smbios_data.smbios_dictionary:
return return
gpu_dict = smbios_data.smbios_dictionary[self.model]["Stock GPUs"] gpu_dict = smbios_data.smbios_dictionary[self.model]["Stock GPUs"]
# Check if KDKless and KDK GPUs are present
# We only want KDKless.kext if there are no KDK GPUs
has_kdkless_gpu = False
has_kdk_gpu = False
for gpu in gpu_dict: for gpu in gpu_dict:
if not self.constants.custom_model: if not self.constants.custom_model:
gpu = gpu.arch gpu = gpu.arch
@@ -400,6 +405,39 @@ class build_graphics_audio:
device_probe.Intel.Archs.Skylake, device_probe.Intel.Archs.Skylake,
device_probe.NVIDIA.Archs.Kepler, device_probe.NVIDIA.Archs.Kepler,
]: ]:
has_kdkless_gpu = True
# Non-Metal KDK
if gpu in [
device_probe.NVIDIA.Archs.Tesla,
device_probe.NVIDIA.Archs.Maxwell,
device_probe.NVIDIA.Archs.Pascal,
device_probe.AMD.Archs.TeraScale_1,
device_probe.AMD.Archs.TeraScale_2,
device_probe.Intel.Archs.Iron_Lake,
device_probe.Intel.Archs.Sandy_Bridge,
]:
has_kdk_gpu = True
if gpu in [
# Metal KDK (always)
device_probe.AMD.Archs.Legacy_GCN_7000,
device_probe.AMD.Archs.Legacy_GCN_8000,
device_probe.AMD.Archs.Legacy_GCN_9000,
]:
has_kdk_gpu = True
if gpu in [
# Metal KDK (pre-AVX2.0)
device_probe.AMD.Archs.Polaris,
device_probe.AMD.Archs.Vega,
device_probe.AMD.Archs.Navi,
]:
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value:
has_kdk_gpu = True
if has_kdkless_gpu is True and has_kdk_gpu is False:
# KDKlessWorkaround is required for KDKless GPUs
support.build_support(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path) support.build_support(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
return return