Add non-Metal Monterey accel

This commit is contained in:
Mykola Grymalyuk
2021-09-05 13:17:39 -06:00
parent 0b51a7e9c8
commit 10354d717e
7 changed files with 54 additions and 38 deletions

View File

@@ -19,11 +19,18 @@
- AppleALC 1.6.3 release
- WhateverGreen 1.5.2 release
- FeatureUnlock 1.0.3 release
- PatcherSupportPkg 0.0.19 release
- Allow iGPU/dGPU switching in Windows
- Applicable to MacBook Pros with Intel iGPU and Nvidia/AMD dGPU
- Clean up Patcher Settings
- Allow disabling of TeraScale 2 Acceleration during root volume patch
- Use for MacBookPro8,x with heavily degraded dGPUs
- Add non-Metal Monterey Acceleration
- Currently supports:
- Intel Ironlake and Sandy Bridge
- Nvidia Tesla
- AMD TeraScale 1
- TeraScale 2 acceleration to be added in the future
## 0.2.4

View File

@@ -281,9 +281,9 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
Utilities.header(["Patching System Volume"])
big_sur = """Patches Root volume to fix misc issues such as:
- Graphics Acceleration for non-Metal GPUs
- Nvidia: Tesla - Fermi (8000-500 series)
- Non-Metal Graphics Acceleration
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
@@ -300,12 +300,14 @@ B. Exit
"""
monterey = """Patches Root volume to fix misc issues such as:
- Graphics Acceleration
- Metal Graphics Acceleration
- Intel: Ivy Bridge (4000 series iGPUs)
- Basic Framebuffer and brightness Control (No acceleration)
- Nvidia: Tesla - Fermi (8000-500 series)
- Non-Metal Graphics Accelertation
- Intel: Ironlake - Sandy Bridge
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 (2000-4000 series)
- Basic Framebuffer and brightness Control (No acceleration)
- AMD: TeraScale 2 (5000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
@@ -321,10 +323,10 @@ B. Exit
"""
mojave_catalina = """Patches Root volume to fix misc issues such as:
- Graphics Acceleration
- Nvidia: Tesla - Fermi (8000-500 series)
- Intel: Ironlake - Sandy Bridge
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Non-Metal Graphics Acceleration
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please

View File

@@ -573,7 +573,7 @@ class BuildOpenCore:
else:
print("- Adding Mac Pro, Xserve DRM patches")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
if self.constants.disable_thunderbolt is True and self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]:
print("- Disabling 2013-2014 laptop Thunderbolt Controller")
if self.model in ["MacBookPro11,3", "MacBookPro11,5"]:
@@ -582,7 +582,7 @@ class BuildOpenCore:
else:
# 13" and 15" iGPU 2013-2014 models: IOACPIPlane:/_SB/PCI0@0/P0P2@10000/UPSB@0/DSB0@0/NHI0@0
tb_device_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)"
self.config["DeviceProperties"]["Add"][tb_device_path] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000")}
# Add XhciDxe if firmware doesn't have XHCI controller support and XCHI controller detected

View File

@@ -44,7 +44,7 @@ class Constants:
self.latebloom_version = "0.19"
self.disk = ""
self.patch_disk = ""
self.patcher_support_pkg_version = "0.0.18" # PatcherSupportPkg
self.patcher_support_pkg_version = "0.0.19" # PatcherSupportPkg
# Get resource path
self.current_path = Path(__file__).parent.parent.resolve()
@@ -149,6 +149,7 @@ class Constants:
self.mojave,
self.catalina,
self.big_sur,
self.monterey,
]
# Payload Location
@@ -593,7 +594,7 @@ class Constants:
"j215", # MacBookPro16,4
"j185", # iMac20,1
"j185f", # iMac20,2
"x86legacy", # non-T2 Macs/VMs
"x86legacy", # non-T2 Macs/VMs
]
sandy_board_id = [

View File

@@ -40,7 +40,7 @@ class PatchSysVolume:
self.no_patch = True
self.validate = False
#if (Path.home() / "Desktop/OCLP-Test/").exists:
# if (Path.home() / "Desktop/OCLP-Test/").exists:
# self.mount_location = Path.home() / "Desktop/OCLP-Test"
# self.validate = True
if self.constants.detected_os > self.constants.catalina:
@@ -69,7 +69,7 @@ class PatchSysVolume:
if Path(self.mount_extensions).exists():
print("- Root Volume is already mounted")
if patch is True:
if self.constants.detected_os < self.constants.big_sur or Utilities.check_seal() is True:
if self.constants.detected_os < self.constants.big_sur or (self.constants.detected_os == self.constants.big_sur and Utilities.check_seal() is True):
self.backup_volume()
self.patch_root_vol()
return True
@@ -83,7 +83,7 @@ class PatchSysVolume:
if Path(self.mount_extensions).exists():
print("- Successfully mounted the Root Volume")
if patch is True:
if self.constants.detected_os < self.constants.big_sur or Utilities.check_seal() is True:
if self.constants.detected_os < self.constants.big_sur or (self.constants.detected_os == self.constants.big_sur and Utilities.check_seal() is True):
self.backup_volume()
self.patch_root_vol()
return True
@@ -247,7 +247,7 @@ class PatchSysVolume:
Utilities.process_status(self.elevated(["update_dyld_shared_cache", "-root", f"{self.mount_location}/"]))
print("- Patching complete")
print("\nPlease reboot the machine for patches to take effect")
if self.amd_ts2 is True:
if self.amd_ts2 is True and self.constants.allow_ts2_accel is True:
print(
"""\nPlease note that with ATI TeraScale 2 GPUs, you may experience colour strobing
on reboot. Please use SwitchResX or ResXtreme to force 1 million colours on your
@@ -309,8 +309,8 @@ set million colour before rebooting"""
print("- Installing Nvidia Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddNvidiaAccelLegacy, self.constants.legacy_nvidia_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Nvidia Acceleration Kext patches for Big Sur")
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
print("- Installing Nvidia Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
@@ -324,8 +324,8 @@ set million colour before rebooting"""
print("- Installing TeraScale 1 Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing TeraScale 1 Acceleration Kext patches for Big Sur")
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
print("- Installing TeraScale 1 Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path)
@@ -339,6 +339,7 @@ set million colour before rebooting"""
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os == self.constants.big_sur and self.constants.allow_ts2_accel is True:
# TODO: Enable for Monterey when acceleration patches proress
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11TS2)
@@ -354,8 +355,8 @@ set million colour before rebooting"""
print("- Installing Ironlake Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Ironlake Acceleration Kext patches for Big Sur")
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
print("- Installing Ironlake Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
@@ -368,8 +369,8 @@ set million colour before rebooting"""
print("- Installing Sandy Bridge Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Sandy Bridge Acceleration Kext patches for Big Sur")
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
print("- Installing Sandy Bridge Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
@@ -395,7 +396,7 @@ set million colour before rebooting"""
def gpu_accel_legacy_extended(self):
print("- Merging general legacy Frameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print("- Merging general legacy PrivateFrameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
if self.constants.detected_os > self.constants.catalina:
@@ -409,7 +410,7 @@ set million colour before rebooting"""
def gpu_accel_legacy_extended_ts2(self):
print("- Merging TeraScale 2 legacy Frameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_ts2}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print("- Merging TeraScale 2 PrivateFrameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ts2}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
if self.validate is False:
@@ -472,13 +473,18 @@ set million colour before rebooting"""
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_ivybridge_master()
if self.amd_ts2 is True and self.constants.detected_os in self.constants.legacy_accel_support and self.constants.allow_ts2_accel is True:
if (
self.amd_ts2 is True
and self.constants.detected_os in self.constants.legacy_accel_support
and self.constants.allow_ts2_accel is True
and self.constants.detected_os != self.constants.monterey
):
# TeraScale 2 patches must be installed after Intel HD3000
self.add_new_binaries(SysPatchArray.AddAMDAccel11TS2, self.constants.legacy_amd_path_ts2)
if self.added_legacy_kexts is True and self.constants.detected_os in self.constants.legacy_accel_support:
self.gpu_accel_legacy_extended()
if self.amd_ts2 is True and self.constants.allow_ts2_accel is True:
if self.amd_ts2 is True and self.constants.allow_ts2_accel is True and self.constants.detected_os != self.constants.monterey:
self.gpu_accel_legacy_extended_ts2()
# Misc patches

View File

@@ -193,7 +193,7 @@ DeleteVolumeControl = [
]
AddNvidiaAccelLegacy = [
#"GeForceGA.bundle",
# "GeForceGA.bundle",
"GeForceTesla.kext",
"GeForceTeslaGLDriver.bundle",
"GeForceTeslaVADriver.bundle",

View File

@@ -11,13 +11,13 @@ import re
import os
try:
import requests
import requests
except ImportError:
subprocess.run(["pip3", "install", "requests"], stdout=subprocess.PIPE)
try:
import requests
except ImportError:
raise Exception("Missing requests library!\nPlease run the following before starting OCLP:\npip3 install requests")
subprocess.run(["pip3", "install", "requests"], stdout=subprocess.PIPE)
try:
import requests
except ImportError:
raise Exception("Missing requests library!\nPlease run the following before starting OCLP:\npip3 install requests")
from Resources import Constants, ioreg
@@ -157,7 +157,7 @@ def patching_status(os_sip, os):
if os > Constants.Constants().catalina:
fv_status: str = subprocess.run("fdesetup status".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
if fv_status.startswith("FileVault is Off"):
if "FileVault is Off" in fv_status:
fv_enabled = False
else:
fv_enabled = False