sys_patch.py: Add support for AMD Polaris

This commit is contained in:
Mykola Grymalyuk
2022-10-30 18:26:56 -06:00
parent 55478fd81c
commit 66a9be5be4
5 changed files with 64 additions and 19 deletions

View File

@@ -1,6 +1,10 @@
# OpenCore Legacy Patcher changelog
## 0.5.2
- Resolve AMD Polaris external display output support
- AMD Polaris and legacy GCN cannot be mixed in the same system
- Legacy GCN support will be prioritized when both are present
- AMD Polaris GPU can still be used headless for rendering with legacy GCN (ex. [macOS: Prefer External GPU option](https://support.apple.com/en-ca/HT208544))
- Increment Binaries:
- AirPortBrcmFixup 2.1.6 - release
- DebugEnhancer 1.0.7 - release

View File

@@ -649,6 +649,30 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
],
},
},
# Used only for AMD Polaris with host lacking AVX2.0
# Note missing framebuffers are not restored (ex. 'ATY,Berbice')
"AMD Legacy Polaris": {
"Display Name": "Graphics: AMD Legacy Polaris",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.ventura,
"OS Minor": 0
},
"Maximum OS Support": {
"OS Major": os_data.os_data.max_os,
"OS Minor": 99
},
},
"Install": {
"/System/Library/Extensions": {
"AMDRadeonX4000.kext": "12.5",
"AMDRadeonX4000GLDriver.bundle": "12.5",
"AMDMTLBronzeDriver.bundle": "12.5",
"AMDShared.bundle": "12.5",
},
},
},
"Intel Ironlake": {
"Display Name": "Graphics: Intel Ironlake",
"OS Support": {

View File

@@ -506,7 +506,7 @@ class PatchSysVolume:
else:
print(f"- Running Process:\n{process}")
utilities.process_status(subprocess.run(process, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True))
if "AMD Legacy GCN" in required_patches:
if "AMD Legacy GCN" in required_patches or "AMD Legacy Polaris" in required_patches:
sys_patch_helpers.sys_patch_helpers(self.constants).disable_window_server_caching()
self.write_patchset(required_patches)

View File

@@ -14,18 +14,19 @@ class detect_root_patch:
self.computer = self.constants.computer
# GPU Patch Detection
self.nvidia_tesla = False
self.kepler_gpu = False
self.nvidia_web = False
self.amd_ts1 = False
self.amd_ts2 = False
self.iron_gpu = False
self.sandy_gpu = False
self.ivy_gpu = False
self.haswell_gpu = False
self.broadwell_gpu = False
self.skylake_gpu = False
self.legacy_gcn = False
self.nvidia_tesla = False
self.kepler_gpu = False
self.nvidia_web = False
self.amd_ts1 = False
self.amd_ts2 = False
self.iron_gpu = False
self.sandy_gpu = False
self.ivy_gpu = False
self.haswell_gpu = False
self.broadwell_gpu = False
self.skylake_gpu = False
self.legacy_gcn = False
self.legacy_polaris = False
# Misc Patch Detection
self.brightness_legacy = False
@@ -130,10 +131,14 @@ class detect_root_patch:
# full compatibility (namely power states, etc)
# Reference: https://github.com/dortania/bugtracker/issues/292
# TODO: Probe framebuffer families further
if "AVX2" in self.constants.computer.cpu.leafs and self.model != "MacBookPro13,3":
continue
self.legacy_gcn = True
if self.model != "MacBookPro13,3":
if "AVX2" in self.constants.computer.cpu.leafs:
continue
self.legacy_polaris = True
else:
self.legacy_gcn = True
else:
self.legacy_gcn = True
self.supports_metal = True
self.requires_root_kc = True
self.amfi_must_disable = True
@@ -185,6 +190,13 @@ class detect_root_patch:
self.sandy_gpu = False
self.legacy_keyboard_backlight = False
if self.legacy_polaris is True and self.legacy_gcn is True:
# We can only support one or the other due to the nature of relying
# on portions of the native AMD stack for Polaris
# Thus we'll prioritize legacy GCN due to being the internal card
# ex. MacPro6,1 and MacBookPro11,5 with eGPUs
self.legacy_polaris = False
if self.constants.detected_os <= os_data.os_data.monterey:
# Always assume Root KC requirement on Monterey and older
self.requires_root_kc = True
@@ -328,6 +340,7 @@ class detect_root_patch:
"Graphics: AMD TeraScale 1": self.amd_ts1,
"Graphics: AMD TeraScale 2": self.amd_ts2,
"Graphics: AMD Legacy GCN": self.legacy_gcn,
"Graphics: AMD Legacy Polaris": self.legacy_polaris,
"Graphics: Intel Ironlake": self.iron_gpu,
"Graphics: Intel Sandy Bridge": self.sandy_gpu,
"Graphics: Intel Ivy Bridge": self.ivy_gpu,
@@ -518,11 +531,14 @@ class detect_root_patch:
# TeraScale 2 MacBooks with faulty GPUs are highly prone to crashing with AMDRadeonX3000 attached
# Additionally, AMDRadeonX3000 requires IOAccelerator downgrade which is not installed without 'Non-Metal IOAccelerator Common'
del(required_patches["AMD TeraScale 2"]["Install"]["/System/Library/Extensions"]["AMDRadeonX3000.kext"])
if hardware_details["Graphics: AMD Legacy GCN"] is True:
if hardware_details["Graphics: AMD Legacy GCN"] is True or hardware_details["Graphics: AMD Legacy Polaris"] is True:
required_patches.update({"Revert Metal Downgrade": all_hardware_patchset["Graphics"]["Revert Metal Downgrade"]})
required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
required_patches.update({"AMD Legacy GCN": all_hardware_patchset["Graphics"]["AMD Legacy GCN"]})
if hardware_details["Graphics: AMD Legacy GCN"] is True:
required_patches.update({"AMD Legacy GCN": all_hardware_patchset["Graphics"]["AMD Legacy GCN"]})
else:
required_patches.update({"AMD Legacy Polaris": all_hardware_patchset["Graphics"]["AMD Legacy Polaris"]})
if "AVX2" not in self.constants.computer.cpu.leafs:
required_patches.update({"AMD OpenCL": all_hardware_patchset["Graphics"]["AMD OpenCL"]})
if hardware_details["Brightness: Legacy Backlight Control"] is True:

View File

@@ -65,6 +65,7 @@ class sys_patch_helpers:
"Time Patched": f"{datetime.now().strftime('%B %d, %Y @ %H:%M:%S')}",
"Commit URL": f"{self.constants.commit_info[2]}",
"Kernel Debug Kit Used": f"{kdk_string}",
"OS Version": f"{self.constants.detected_os}.{self.constants.detected_os_minor} ({self.constants.detected_os_build})",
}
data.update(patchset)
if Path(source_path_file).exists():