From 9c2da4e4fb9281906fd150292757c6f8d59b67d1 Mon Sep 17 00:00:00 2001 From: Dhinak G <17605561+dhinakg@users.noreply.github.com> Date: Fri, 15 Mar 2024 19:18:33 -0400 Subject: [PATCH] Update "Stock GPUs" handling closes #1128 --- resources/build/graphics_audio.py | 26 ++++++++++++-------------- resources/defaults.py | 26 ++++++++++---------------- resources/wx_gui/gui_support.py | 20 ++++++++++++-------- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/resources/build/graphics_audio.py b/resources/build/graphics_audio.py index c16cdcb6b..92ebb6f2a 100644 --- a/resources/build/graphics_audio.py +++ b/resources/build/graphics_audio.py @@ -493,22 +493,20 @@ class BuildGraphicsAudio: This primarily occurs when installing an RSR update, where root is cleaned but AuxKC is not """ - gpu_dict = [] + gpu_archs = [] if not self.constants.custom_model: - gpu_dict = self.constants.computer.gpus + gpu_archs = [gpu.arch for gpu in self.constants.computer.gpus] else: - if not self.model in smbios_data.smbios_dictionary: + if self.model not in smbios_data.smbios_dictionary: return - gpu_dict = smbios_data.smbios_dictionary[self.model]["Stock GPUs"] + gpu_archs = 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: - if not self.constants.custom_model: - gpu = gpu.arch - if gpu in [ + for arch in gpu_archs: + if arch in [ device_probe.Intel.Archs.Ivy_Bridge, device_probe.Intel.Archs.Haswell, device_probe.Intel.Archs.Broadwell, @@ -518,7 +516,7 @@ class BuildGraphicsAudio: has_kdkless_gpu = True # Non-Metal KDK - if gpu in [ + if arch in [ device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Maxwell, device_probe.NVIDIA.Archs.Pascal, @@ -529,7 +527,7 @@ class BuildGraphicsAudio: ]: has_kdk_gpu = True - if gpu in [ + if arch in [ # Metal KDK (always) device_probe.AMD.Archs.Legacy_GCN_7000, device_probe.AMD.Archs.Legacy_GCN_8000, @@ -537,7 +535,7 @@ class BuildGraphicsAudio: ]: has_kdk_gpu = True - if gpu in [ + if arch in [ # Metal KDK (pre-AVX2.0) device_probe.AMD.Archs.Polaris, device_probe.AMD.Archs.Polaris_Spoof, @@ -560,10 +558,10 @@ class BuildGraphicsAudio: # Applicable for Polaris, Vega, Navi GPUs if smbios_data.smbios_dictionary[self.model]["CPU Generation"] > cpu_data.CPUGen.ivy_bridge.value: return - for gpu in gpu_dict: + for arch in gpu_archs: if not self.constants.custom_model: - gpu = gpu.arch - if gpu in [ + arch = arch.arch + if arch in [ device_probe.AMD.Archs.Polaris, device_probe.AMD.Archs.Polaris_Spoof, device_probe.AMD.Archs.Vega, diff --git a/resources/defaults.py b/resources/defaults.py index b1a05a532..abbcbaf55 100644 --- a/resources/defaults.py +++ b/resources/defaults.py @@ -234,22 +234,16 @@ class GenerateDefaults: Graphics specific probe """ - gpu_dict = [] + gpu_archs = [] if self.host_is_target: - gpu_dict = self.constants.computer.gpus + gpu_archs = [gpu.arch for gpu in self.constants.computer.gpus if gpu.class_code != 0xFFFFFFFF] else: if self.model in smbios_data.smbios_dictionary: - gpu_dict = smbios_data.smbios_dictionary[self.model]["Stock GPUs"] - - for gpu in gpu_dict: - if self.host_is_target: - if gpu.class_code: - if gpu.class_code == 0xFFFFFFFF: - continue - gpu = gpu.arch + gpu_archs = smbios_data.smbios_dictionary[self.model]["Stock GPUs"] + for arch in gpu_archs: # Legacy Metal Logic - if gpu in [ + if arch in [ device_probe.Intel.Archs.Ivy_Bridge, device_probe.Intel.Archs.Haswell, device_probe.Intel.Archs.Broadwell, @@ -263,14 +257,14 @@ class GenerateDefaults: device_probe.AMD.Archs.Vega, device_probe.AMD.Archs.Navi, ]: - if gpu in [ + if arch in [ device_probe.Intel.Archs.Ivy_Bridge, device_probe.Intel.Archs.Haswell, device_probe.NVIDIA.Archs.Kepler, ]: self.constants.disable_amfi = True - if gpu in [ + if arch in [ device_probe.AMD.Archs.Legacy_GCN_7000, device_probe.AMD.Archs.Legacy_GCN_8000, device_probe.AMD.Archs.Legacy_GCN_9000, @@ -279,7 +273,7 @@ class GenerateDefaults: device_probe.AMD.Archs.Vega, device_probe.AMD.Archs.Navi, ]: - if gpu == device_probe.AMD.Archs.Legacy_GCN_7000: + if arch == device_probe.AMD.Archs.Legacy_GCN_7000: # Check if we're running in Rosetta if self.host_is_target: if self.constants.computer.rosetta_active is True: @@ -291,7 +285,7 @@ class GenerateDefaults: self.constants.serial_settings = "Minimal" # See if system can use the native AMD stack in Ventura - if gpu in [ + if arch in [ device_probe.AMD.Archs.Polaris, device_probe.AMD.Archs.Polaris_Spoof, device_probe.AMD.Archs.Vega, @@ -310,7 +304,7 @@ class GenerateDefaults: self.constants.disable_cs_lv = True # Non-Metal Logic - elif gpu in [ + elif arch in [ device_probe.Intel.Archs.Iron_Lake, device_probe.Intel.Archs.Sandy_Bridge, device_probe.NVIDIA.Archs.Tesla, diff --git a/resources/wx_gui/gui_support.py b/resources/wx_gui/gui_support.py index c72e641ee..70942e915 100644 --- a/resources/wx_gui/gui_support.py +++ b/resources/wx_gui/gui_support.py @@ -199,15 +199,19 @@ class CheckProperties: """ Check if either host, or override model, has a 3802 GPU """ - gpu_dict = [] if self.constants.custom_model else self.constants.computer.gpus - model = self.constants.custom_model if self.constants.custom_model else self.constants.computer.real_model - if gpu_dict == []: - gpu_dict = smbios_data.smbios_dictionary[model]["Stock GPUs"] if model in smbios_data.smbios_dictionary else [] - for gpu in gpu_dict: - if not self.constants.custom_model: - gpu = gpu.arch - if gpu in [ + gpu_archs = [] + if self.constants.custom_model: + model = self.constants.custom_model + else: + model = self.constants.computer.real_model + gpu_archs = [gpu.arch for gpu in self.constants.computer.gpus] + + if not gpu_archs: + gpu_archs = smbios_data.smbios_dictionary.get(model, {}).get("Stock GPUs", []) + + for arch in gpu_archs: + if arch in [ device_probe.Intel.Archs.Ivy_Bridge, device_probe.Intel.Archs.Haswell, device_probe.NVIDIA.Archs.Kepler,