mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
sys_patch: Drop Metal downgrade for AMD Legacy GCN
This commit is contained in:
@@ -36,7 +36,8 @@
|
||||
- Relies on N-1 system for when matching KDK is not present
|
||||
- Delete unused KDKs in `/Library/Developer/KDKs` during root patching
|
||||
- Resolve Power Management support for Ivy Bridge and older
|
||||
- Drop AMFI requirement for Nvidia Kepler
|
||||
- Drop AMFI requirement for Nvidia Kepler and AMD GCN 1-3
|
||||
- Resolve numerous AMD GCN 1-3 issues (ex. Photos.app, Screen Saver, etc.)
|
||||
- Add work-around to Catalyst Buttons not responding on non-Metal in macOS Monterey
|
||||
- Increment Binaries:
|
||||
- OpenCorePkg 0.8.5 release
|
||||
|
||||
@@ -377,7 +377,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
|
||||
},
|
||||
},
|
||||
|
||||
# In Ventura, Apple added AVX2.0 code to the OpenCL/GL compilers
|
||||
# In Ventura, Apple added AVX2.0 code to AMD's OpenCL/GL compilers
|
||||
"AMD OpenCL": {
|
||||
"Display Name": "",
|
||||
"OS Support": {
|
||||
|
||||
@@ -13,7 +13,7 @@ class Constants:
|
||||
def __init__(self):
|
||||
# Patcher Versioning
|
||||
self.patcher_version = "0.5.0" # OpenCore-Legacy-Patcher
|
||||
self.patcher_support_pkg_version = "0.6.9" # PatcherSupportPkg
|
||||
self.patcher_support_pkg_version = "0.7.0" # PatcherSupportPkg
|
||||
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
|
||||
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
|
||||
self.discord_link = "https://discord.gg/rqdPgH8xSN"
|
||||
|
||||
@@ -217,14 +217,6 @@ class generate_defaults:
|
||||
self.constants.secure_status = False
|
||||
self.constants.disable_cs_lv = True
|
||||
|
||||
if gpu in [
|
||||
device_probe.AMD.Archs.Legacy_GCN_7000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_8000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_9000,
|
||||
device_probe.AMD.Archs.Polaris,
|
||||
]:
|
||||
self.constants.disable_amfi = True
|
||||
|
||||
# Non-Metal Logic
|
||||
elif gpu in [
|
||||
device_probe.Intel.Archs.Iron_Lake,
|
||||
@@ -239,7 +231,9 @@ class generate_defaults:
|
||||
self.constants.sip_status = False
|
||||
self.constants.secure_status = False
|
||||
self.constants.disable_cs_lv = True
|
||||
self.constants.disable_amfi = True
|
||||
if os_data.os_data.ventura in self.constants.legacy_accel_support:
|
||||
# Only disable AMFI if we officially support Ventura
|
||||
self.constants.disable_amfi = True
|
||||
|
||||
if self.host_is_target:
|
||||
self.constants.host_is_non_metal = True
|
||||
|
||||
@@ -24,7 +24,11 @@ class kernel_debug_kit_handler:
|
||||
|
||||
print("- Fetching available KDKs")
|
||||
|
||||
results = utilities.SESSION.get(KDK_API_LINK, headers={"User-Agent": f"OCLP/{self.constants.patcher_version}"})
|
||||
try:
|
||||
results = utilities.SESSION.get(KDK_API_LINK, headers={"User-Agent": f"OCLP/{self.constants.patcher_version}"})
|
||||
except (requests.exceptions.Timeout, requests.exceptions.TooManyRedirects, requests.exceptions.ConnectionError):
|
||||
print("- Could not contact KDK API")
|
||||
return None
|
||||
|
||||
if results.status_code != 200:
|
||||
print("- Could not fetch KDK list")
|
||||
@@ -45,7 +49,11 @@ class kernel_debug_kit_handler:
|
||||
|
||||
print(f"- Checking closest match for: {host_version} build {host_build}")
|
||||
|
||||
results = utilities.SESSION.get(OS_DATABASE_LINK)
|
||||
try:
|
||||
results = utilities.SESSION.get(OS_DATABASE_LINK)
|
||||
except (requests.exceptions.Timeout, requests.exceptions.TooManyRedirects, requests.exceptions.ConnectionError):
|
||||
print("- Could not contact AppleDB")
|
||||
return None, "", ""
|
||||
|
||||
if results.status_code != 200:
|
||||
print("- Could not fetch database")
|
||||
|
||||
@@ -293,7 +293,7 @@ class PatchSysVolume:
|
||||
print("Reason for snapshot failure:")
|
||||
print(bless.stdout.decode())
|
||||
if "Can't use last-sealed-snapshot or create-snapshot on non system volume" in bless.stdout.decode():
|
||||
print("- This is an APFS bug with Monterey! Perform a clean installation to ensure your APFS volume is built correctly")
|
||||
print("- This is an APFS bug with Monterey and newer! Perform a clean installation to ensure your APFS volume is built correctly")
|
||||
return False
|
||||
self.unmount_drive()
|
||||
return True
|
||||
@@ -488,6 +488,8 @@ 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:
|
||||
sys_patch_helpers.sys_patch_helpers(self.constants).disable_window_server_caching()
|
||||
self.write_patchset(required_patches)
|
||||
|
||||
def preflight_checks(self, required_patches, source_files_path):
|
||||
|
||||
@@ -64,7 +64,8 @@ class detect_root_patch:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.nvidia_tesla = True
|
||||
self.amfi_must_disable = True
|
||||
self.amfi_shim_bins = True
|
||||
if os_data.os_data.ventura in self.constants.legacy_accel_support:
|
||||
self.amfi_shim_bins = True
|
||||
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
|
||||
self.requires_root_kc = True
|
||||
elif gpu.arch == device_probe.NVIDIA.Archs.Kepler and self.constants.force_nv_web is False:
|
||||
@@ -94,20 +95,23 @@ class detect_root_patch:
|
||||
if self.constants.detected_os > os_data.os_data.mojave:
|
||||
self.nvidia_web = True
|
||||
self.amfi_must_disable = True
|
||||
self.amfi_shim_bins = True
|
||||
if os_data.os_data.ventura in self.constants.legacy_accel_support:
|
||||
self.amfi_shim_bins = True
|
||||
self.needs_nv_web_checks = True
|
||||
self.requires_root_kc = True
|
||||
elif gpu.arch == device_probe.AMD.Archs.TeraScale_1:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.amd_ts1 = True
|
||||
self.amfi_must_disable = True
|
||||
self.amfi_shim_bins = True
|
||||
if os_data.os_data.ventura in self.constants.legacy_accel_support:
|
||||
self.amfi_shim_bins = True
|
||||
self.requires_root_kc = True
|
||||
elif gpu.arch == device_probe.AMD.Archs.TeraScale_2:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.amd_ts2 = True
|
||||
self.amfi_must_disable = True
|
||||
self.amfi_shim_bins = True
|
||||
if os_data.os_data.ventura in self.constants.legacy_accel_support:
|
||||
self.amfi_shim_bins = True
|
||||
self.requires_root_kc = True
|
||||
elif gpu.arch in [
|
||||
device_probe.AMD.Archs.Legacy_GCN_7000,
|
||||
@@ -129,19 +133,20 @@ class detect_root_patch:
|
||||
self.supports_metal = True
|
||||
self.requires_root_kc = True
|
||||
self.amfi_must_disable = True
|
||||
self.amfi_shim_bins = True
|
||||
elif gpu.arch == device_probe.Intel.Archs.Iron_Lake:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.iron_gpu = True
|
||||
self.amfi_must_disable = True
|
||||
self.amfi_shim_bins = True
|
||||
if os_data.os_data.ventura in self.constants.legacy_accel_support:
|
||||
self.amfi_shim_bins = True
|
||||
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
|
||||
self.requires_root_kc = True
|
||||
elif gpu.arch == device_probe.Intel.Archs.Sandy_Bridge:
|
||||
if self.constants.detected_os > non_metal_os:
|
||||
self.sandy_gpu = True
|
||||
self.amfi_must_disable = True
|
||||
self.amfi_shim_bins = True
|
||||
if os_data.os_data.ventura in self.constants.legacy_accel_support:
|
||||
self.amfi_shim_bins = True
|
||||
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
|
||||
self.requires_root_kc = True
|
||||
elif gpu.arch == device_probe.Intel.Archs.Ivy_Bridge:
|
||||
@@ -510,7 +515,7 @@ class detect_root_patch:
|
||||
# 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:
|
||||
required_patches.update({"Metal Common": all_hardware_patchset["Graphics"]["Metal Common"]})
|
||||
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"]})
|
||||
|
||||
@@ -130,3 +130,15 @@ class sys_patch_helpers:
|
||||
if (kdk_folder / Path("System/Library/Extensions/System.kext/PlugIns/Libkern.kext/Libkern")).exists():
|
||||
return kdk_folder
|
||||
return None
|
||||
|
||||
|
||||
def disable_window_server_caching(self):
|
||||
# On legacy GCN GPUs, the WindowServer cache generated creates
|
||||
# corrupted Opaque shaders.
|
||||
# To work-around this, we disable WindowServer caching
|
||||
# And force macOS into properly generating the Opaque shaders
|
||||
print("- Disabling WindowServer Caching")
|
||||
# Invoke via 'bash -c' to resolve pathing
|
||||
utilities.elevated(["bash", "-c", "rm -rf /private/var/folders/*/*/*/WindowServer/com.apple.WindowServer"])
|
||||
# Disable writing to WindowServer folder
|
||||
utilities.elevated(["bash", "-c", "chflags uchg /private/var/folders/*/*/*/WindowServer"])
|
||||
|
||||
Reference in New Issue
Block a user