mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 14:10:51 +10:00
Enable GPU Accel on legacy GPUs by default
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
- Fix USB kernel panics on iMac7,1
|
- Fix USB kernel panics on iMac7,1
|
||||||
- Fix AppleALC support in Mojave
|
- Fix AppleALC support in Mojave
|
||||||
- Fix TeraScale 1 GPU detection
|
- Fix TeraScale 1 GPU detection
|
||||||
|
- Enable Graphics Acceleration on legacy GPUs by default
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
- Fix crash on iMacs with Metal GPUs
|
- Fix crash on iMacs with Metal GPUs
|
||||||
|
|||||||
+10
-1
@@ -70,7 +70,7 @@ class Constants:
|
|||||||
self.detected_os = 0
|
self.detected_os = 0
|
||||||
self.boot_efi = False
|
self.boot_efi = False
|
||||||
self.drm_support = False
|
self.drm_support = False
|
||||||
self.legacy_acceleration_patch = False
|
self.legacy_acceleration_patch = True
|
||||||
self.assume_legacy = False
|
self.assume_legacy = False
|
||||||
|
|
||||||
# OS Versions
|
# OS Versions
|
||||||
@@ -95,6 +95,11 @@ class Constants:
|
|||||||
self.pci_broadcom = "14E4"
|
self.pci_broadcom = "14E4"
|
||||||
self.pci_atheros = "168C"
|
self.pci_atheros = "168C"
|
||||||
|
|
||||||
|
# Nvidia GPU Architecture
|
||||||
|
self.arch_tesla = "NV50"
|
||||||
|
self.arch_fermi = "GF100"
|
||||||
|
self.arch_kepler = "GK100"
|
||||||
|
|
||||||
# External Files
|
# External Files
|
||||||
self.url_apple_binaries = "https://github.com/dortania/Apple-Binaries-OCLP/archive/refs/tags/"
|
self.url_apple_binaries = "https://github.com/dortania/Apple-Binaries-OCLP/archive/refs/tags/"
|
||||||
|
|
||||||
@@ -267,11 +272,15 @@ class Constants:
|
|||||||
@property
|
@property
|
||||||
def legacy_nvidia_path(self): return self.legacy_graphics / Path("Nvidia-Tesla-Fermi")
|
def legacy_nvidia_path(self): return self.legacy_graphics / Path("Nvidia-Tesla-Fermi")
|
||||||
@property
|
@property
|
||||||
|
def legacy_nvidia_kepler_path(self): return self.legacy_graphics / Path("Nvidia-Kepler")
|
||||||
|
@property
|
||||||
def legacy_amd_path(self): return self.legacy_graphics / Path("AMD-ATI")
|
def legacy_amd_path(self): return self.legacy_graphics / Path("AMD-ATI")
|
||||||
@property
|
@property
|
||||||
def legacy_intel_gen1_path(self): return self.legacy_graphics / Path("Intel-Gen5-Ironlake")
|
def legacy_intel_gen1_path(self): return self.legacy_graphics / Path("Intel-Gen5-Ironlake")
|
||||||
@property
|
@property
|
||||||
def legacy_intel_gen2_path(self): return self.legacy_graphics / Path("Intel-Gen6-SandyBridge")
|
def legacy_intel_gen2_path(self): return self.legacy_graphics / Path("Intel-Gen6-SandyBridge")
|
||||||
|
@property
|
||||||
|
def legacy_intel_gen3_path(self): return self.legacy_graphics / Path("Intel-Gen7-IvyBridge")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def legacy_brightness(self): return self.payload_apple_kexts_path / Path("Brightness-Control")
|
def legacy_brightness(self): return self.payload_apple_kexts_path / Path("Brightness-Control")
|
||||||
|
|||||||
+25
-38
@@ -951,13 +951,17 @@ AddNvidiaAccel11 = [
|
|||||||
"IOSurface.kext",
|
"IOSurface.kext",
|
||||||
]
|
]
|
||||||
|
|
||||||
AddNvidiaBrightness11 = [
|
AddNvidiaKeplerAccel11 = [
|
||||||
"GeForceGA.bundle",
|
"GeForce.kext",
|
||||||
"GeForceTesla.kext",
|
"GeForceAIRPlugin.bundle",
|
||||||
"GeForceTeslaGLDriver.bundle",
|
"GeForceGLDriver.bundle",
|
||||||
"GeForceTeslaVADriver.bundle",
|
"GeForceMTLDriver.bundle",
|
||||||
"NVDANV50HalTesla.kext",
|
"GeForceVADriver.bundle",
|
||||||
"NVDAResmanTesla.kext",
|
"NVDAGF100Hal.kext",
|
||||||
|
"NVDAGK100Hal.kext",
|
||||||
|
"NVDAResman.kext",
|
||||||
|
"NVDAStartup.kext",
|
||||||
|
"NVSMU.kext",
|
||||||
]
|
]
|
||||||
|
|
||||||
AddAMDAccel11 = [
|
AddAMDAccel11 = [
|
||||||
@@ -984,20 +988,6 @@ AddAMDAccel11 = [
|
|||||||
"IOSurface.kext",
|
"IOSurface.kext",
|
||||||
]
|
]
|
||||||
|
|
||||||
AddAMDTeraScale1Brightness11 = [
|
|
||||||
"AMD2400Controller.kext",
|
|
||||||
"AMD2600Controller.kext",
|
|
||||||
"AMD3800Controller.kext",
|
|
||||||
"AMD4600Controller.kext",
|
|
||||||
"AMD4800Controller.kext",
|
|
||||||
"AMDLegacyFramebuffer.kext",
|
|
||||||
"AMDLegacySupport.kext",
|
|
||||||
"ATIRadeonX2000.kext",
|
|
||||||
"ATIRadeonX2000GA.plugin",
|
|
||||||
"ATIRadeonX2000GLDriver.bundle",
|
|
||||||
"ATIRadeonX2000VADriver.bundle",
|
|
||||||
]
|
|
||||||
|
|
||||||
AddAMDTeraScale2Brightness11 = [
|
AddAMDTeraScale2Brightness11 = [
|
||||||
"AMD5000Controller.kext",
|
"AMD5000Controller.kext",
|
||||||
"AMD6000Controller.kext",
|
"AMD6000Controller.kext",
|
||||||
@@ -1019,16 +1009,6 @@ AddIntelGen1Accel = [
|
|||||||
"IOSurface.kext",
|
"IOSurface.kext",
|
||||||
]
|
]
|
||||||
|
|
||||||
AddIntelGen1Brightness = [
|
|
||||||
"AppleIntelFramebufferAzul.kext",
|
|
||||||
"AppleIntelFramebufferCapri.kext",
|
|
||||||
"AppleIntelHDGraphics.kext",
|
|
||||||
"AppleIntelHDGraphicsFB.kext",
|
|
||||||
"AppleIntelHDGraphicsGA.plugin",
|
|
||||||
"AppleIntelHDGraphicsGLDriver.bundle",
|
|
||||||
"AppleIntelHDGraphicsVADriver.bundle",
|
|
||||||
]
|
|
||||||
|
|
||||||
AddIntelGen2Accel = [
|
AddIntelGen2Accel = [
|
||||||
"AppleIntelHD3000Graphics.kext",
|
"AppleIntelHD3000Graphics.kext",
|
||||||
"AppleIntelHD3000GraphicsGA.plugin",
|
"AppleIntelHD3000GraphicsGA.plugin",
|
||||||
@@ -1039,13 +1019,12 @@ AddIntelGen2Accel = [
|
|||||||
"IOSurface.kext",
|
"IOSurface.kext",
|
||||||
]
|
]
|
||||||
|
|
||||||
AddIntelGen2Brightness = [
|
AddIntelGen3Accel = [
|
||||||
"AppleIntelHD3000Graphics.kext",
|
"AppleIntelFramebufferCapri.kext",
|
||||||
"AppleIntelHD3000GraphicsGA.plugin",
|
"AppleIntelHD4000Graphics.kext",
|
||||||
"AppleIntelHD3000GraphicsGLDriver.bundle",
|
"AppleIntelHD4000GraphicsGLDriver.bundle",
|
||||||
"AppleIntelHD3000GraphicsVADriver.bundle",
|
"AppleIntelHD4000GraphicsMTLDriver.bundle",
|
||||||
"AppleIntelSNBGraphicsFB.kext",
|
"AppleIntelHD4000GraphicsVADriver.bundle",
|
||||||
"AppleIntelSNBVA.bundle",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
DeleteBrightness = [
|
DeleteBrightness = [
|
||||||
@@ -1140,3 +1119,11 @@ SandyBridgepiciid = [
|
|||||||
"0102",
|
"0102",
|
||||||
"0126",
|
"0126",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
IvyBridgepciid = [
|
||||||
|
"0152",
|
||||||
|
"0156",
|
||||||
|
"0162",
|
||||||
|
"0166",
|
||||||
|
]
|
||||||
|
|
||||||
|
|||||||
+26
-42
@@ -45,8 +45,14 @@ class PatchSysVolume:
|
|||||||
if print_status is True:
|
if print_status is True:
|
||||||
print(f"- {current_sip_bit}\t {temp}")
|
print(f"- {current_sip_bit}\t {temp}")
|
||||||
i = i + 1
|
i = i + 1
|
||||||
# TODO: Fix this garbage when I have more sanity
|
if ((self.constants.csr_values["CSR_ALLOW_UNTRUSTED_KEXTS "] is True) \
|
||||||
if ((self.constants.csr_values["CSR_ALLOW_UNTRUSTED_KEXTS "] is True) and (self.constants.csr_values["CSR_ALLOW_UNRESTRICTED_FS "] is True) and (self.constants.csr_values["CSR_ALLOW_UNRESTRICTED_DTRACE "] is True) and (self.constants.csr_values["CSR_ALLOW_UNRESTRICTED_NVRAM "] is True) and (self.constants.csr_values["CSR_ALLOW_DEVICE_CONFIGURATION "] is True) and (self.constants.csr_values["CSR_ALLOW_UNAPPROVED_KEXTS "] is True) and (self.constants.csr_values["CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE"] is True) and (self.constants.csr_values["CSR_ALLOW_UNAUTHENTICATED_ROOT "] is True)):
|
and (self.constants.csr_values["CSR_ALLOW_UNRESTRICTED_FS "] is True) \
|
||||||
|
and (self.constants.csr_values["CSR_ALLOW_UNRESTRICTED_DTRACE "] is True) \
|
||||||
|
and (self.constants.csr_values["CSR_ALLOW_UNRESTRICTED_NVRAM "] is True) \
|
||||||
|
and (self.constants.csr_values["CSR_ALLOW_DEVICE_CONFIGURATION "] is True) \
|
||||||
|
and (self.constants.csr_values["CSR_ALLOW_UNAPPROVED_KEXTS "] is True) \
|
||||||
|
and (self.constants.csr_values["CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE"] is True) \
|
||||||
|
and (self.constants.csr_values["CSR_ALLOW_UNAUTHENTICATED_ROOT "] is True)):
|
||||||
self.sip_patch_status = False
|
self.sip_patch_status = False
|
||||||
else:
|
else:
|
||||||
self.sip_patch_status = True
|
self.sip_patch_status = True
|
||||||
@@ -132,6 +138,10 @@ class PatchSysVolume:
|
|||||||
self.dgpu_devices = [i for i in self.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
|
self.dgpu_devices = [i for i in self.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
|
||||||
self.dgpu_vendor = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["vendor-id"]).decode()[:4])
|
self.dgpu_vendor = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["vendor-id"]).decode()[:4])
|
||||||
self.dgpu_device = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["device-id"]).decode()[:4])
|
self.dgpu_device = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["device-id"]).decode()[:4])
|
||||||
|
try:
|
||||||
|
self.nvidia_arch = self.dgpu_devices[0]["NVArch"]
|
||||||
|
except ValueError:
|
||||||
|
self.nvidia_arch = ""
|
||||||
print(f"- Detected dGPU: {self.dgpu_vendor}:{self.dgpu_device}")
|
print(f"- Detected dGPU: {self.dgpu_vendor}:{self.dgpu_device}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("- No dGPU detected")
|
print("- No dGPU detected")
|
||||||
@@ -140,9 +150,13 @@ class PatchSysVolume:
|
|||||||
def gpu_accel_patches_11(self):
|
def gpu_accel_patches_11(self):
|
||||||
if self.dgpu_devices:
|
if self.dgpu_devices:
|
||||||
if self.dgpu_vendor == self.constants.pci_nvidia:
|
if self.dgpu_vendor == self.constants.pci_nvidia:
|
||||||
print("- Merging legacy Nvidia Kexts and Bundles")
|
if self.nvidia_arch == self.constants.arch_kepler and self.constants.assume_legacy is True and self.constants.detected_os > self.constants.big_sur:
|
||||||
self.delete_old_binaries(ModelArray.DeleteNvidiaAccel11)
|
print("- Merging legacy Nvidia Kepler Kexts and Bundles")
|
||||||
self.add_new_binaries(ModelArray.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
|
self.add_new_binaries(ModelArray.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
|
||||||
|
else:
|
||||||
|
print("- Merging legacy Nvidia Telsa and Fermi Kexts and Bundles")
|
||||||
|
self.delete_old_binaries(ModelArray.DeleteNvidiaAccel11)
|
||||||
|
self.add_new_binaries(ModelArray.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
|
||||||
elif self.dgpu_vendor == self.constants.pci_amd_ati:
|
elif self.dgpu_vendor == self.constants.pci_amd_ati:
|
||||||
print("- Merging legacy AMD Kexts and Bundles")
|
print("- Merging legacy AMD Kexts and Bundles")
|
||||||
self.delete_old_binaries(ModelArray.DeleteAMDAccel11)
|
self.delete_old_binaries(ModelArray.DeleteAMDAccel11)
|
||||||
@@ -161,6 +175,11 @@ class PatchSysVolume:
|
|||||||
# Swap custom AppleIntelSNBGraphicsFB-AMD.kext, required to fix linking
|
# Swap custom AppleIntelSNBGraphicsFB-AMD.kext, required to fix linking
|
||||||
# subprocess.run(f"sudo rm -R {self.mount_extensions}/AppleIntelSNBGraphicsFB.kext".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
# subprocess.run(f"sudo rm -R {self.mount_extensions}/AppleIntelSNBGraphicsFB.kext".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||||
# subprocess.run(f"sudo cp -R {self.constants.legacy_amd_path}/AMD-Link/AppleIntelSNBGraphicsFB.kext {self.mount_extensions}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
# subprocess.run(f"sudo cp -R {self.constants.legacy_amd_path}/AMD-Link/AppleIntelSNBGraphicsFB.kext {self.mount_extensions}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||||
|
|
||||||
|
# Code for when Ivy Bridge binares are presumably removed from macOS 12, code currently
|
||||||
|
#elif self.igpu_device in ModelArray.IvyBridgepciid:
|
||||||
|
# print("- Merging legacy Intel 3rd Gen Kexts and Bundles")
|
||||||
|
# self.add_new_binaries(ModelArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
|
||||||
elif self.igpu_vendor == self.constants.pci_nvidia:
|
elif self.igpu_vendor == self.constants.pci_nvidia:
|
||||||
if not self.dgpu_devices:
|
if not self.dgpu_devices:
|
||||||
# Avoid patching twice, as Nvidia iGPUs will only have Nvidia dGPUs
|
# Avoid patching twice, as Nvidia iGPUs will only have Nvidia dGPUs
|
||||||
@@ -199,8 +218,6 @@ class PatchSysVolume:
|
|||||||
# TODO: Create Backup of S*/L*/Extensions, Frameworks and PrivateFramework to easily revert changes
|
# TODO: Create Backup of S*/L*/Extensions, Frameworks and PrivateFramework to easily revert changes
|
||||||
# APFS snapshotting seems to ignore System Volume changes inconcistently, would like a backup to avoid total brick
|
# APFS snapshotting seems to ignore System Volume changes inconcistently, would like a backup to avoid total brick
|
||||||
# Perhaps a basic py2 script to run in recovery to restore
|
# Perhaps a basic py2 script to run in recovery to restore
|
||||||
print("- Creating backup snapshot of user data (This may take some time)")
|
|
||||||
subprocess.run("tmutil snapshot".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
|
||||||
# Ensures no .DS_Stores got in
|
# Ensures no .DS_Stores got in
|
||||||
print("- Preparing Files")
|
print("- Preparing Files")
|
||||||
subprocess.run(f"sudo find {self.constants.payload_apple_root_path} -name '.DS_Store' -delete".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
subprocess.run(f"sudo find {self.constants.payload_apple_root_path} -name '.DS_Store' -delete".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||||
@@ -212,41 +229,8 @@ class PatchSysVolume:
|
|||||||
elif self.dgpu_devices and self.dgpu_vendor == self.constants.pci_nvidia and self.dgpu_device in ModelArray.NVIDIAMXMGPUs:
|
elif self.dgpu_devices and self.dgpu_vendor == self.constants.pci_nvidia and self.dgpu_device in ModelArray.NVIDIAMXMGPUs:
|
||||||
print("- Detected Metal-based Nvidia GPU, skipping legacy patches")
|
print("- Detected Metal-based Nvidia GPU, skipping legacy patches")
|
||||||
else:
|
else:
|
||||||
if self.constants.legacy_acceleration_patch is True:
|
print("- Detected legacy GPU, attempting legacy acceleration patches")
|
||||||
print("- Detected legacy GPU, attempting legacy acceleration patches")
|
self.gpu_accel_patches_11()
|
||||||
self.gpu_accel_patches_11()
|
|
||||||
else:
|
|
||||||
if self.dgpu_devices:
|
|
||||||
if self.dgpu_vendor == self.constants.pci_nvidia:
|
|
||||||
print("- Adding Nvidia Brightness Control patches")
|
|
||||||
self.add_new_binaries(ModelArray.AddNvidiaBrightness11, self.constants.legacy_nvidia_path)
|
|
||||||
elif self.dgpu_vendor == self.constants.pci_amd_ati:
|
|
||||||
if self.dgpu_device in ModelArray.TeraScale1pciid:
|
|
||||||
print("- Adding AMD/ATI TeraScale 1 Brightness Control patches")
|
|
||||||
self.add_new_binaries(ModelArray.AddAMDTeraScale1Brightness11, self.constants.legacy_amd_path)
|
|
||||||
#elif self.dgpu_device in ModelArray.TeraScale2pciid:
|
|
||||||
#print("- Adding AMD/ATI TeraScale 2 Brightness Control patches")
|
|
||||||
#self.add_new_binaries(ModelArray.AddAMDTeraScale2Brightness11, self.constants.legacy_amd_path)
|
|
||||||
else:
|
|
||||||
print("- Could not find supported Legacy AMD/ATI GPU")
|
|
||||||
if self.igpu_devices:
|
|
||||||
if self.igpu_vendor == self.constants.pci_intel:
|
|
||||||
if self.igpu_device in ModelArray.IronLakepciid:
|
|
||||||
print("- Adding Intel Ironlake Brightness Control patches")
|
|
||||||
self.add_new_binaries(ModelArray.AddIntelGen1Brightness, self.constants.legacy_intel_gen1_path)
|
|
||||||
elif self.igpu_device in ModelArray.SandyBridgepiciid:
|
|
||||||
print("- Adding Intel Sandy Bridge Brightness Control patches")
|
|
||||||
self.add_new_binaries(ModelArray.AddIntelGen2Brightness, self.constants.legacy_intel_gen2_path)
|
|
||||||
#if self.dgpu_devices and self.dgpu_vendor == self.constants.pci_amd_ati and self.dgpu_device in ModelArray.TeraScale2pciid:
|
|
||||||
# Swap custom AppleIntelSNBGraphicsFB-AMD.kext, required to fix linking
|
|
||||||
# subprocess.run(f"sudo rm -R {self.mount_extensions}/AppleIntelSNBGraphicsFB.kext".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
|
||||||
# subprocess.run(f"sudo cp -R {self.constants.legacy_intel_gen2_path}/AMD-Link/AppleIntelSNBGraphicsFB.kext {self.mount_extensions}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
|
||||||
elif self.igpu_vendor == self.constants.pci_nvidia and not self.dgpu_devices:
|
|
||||||
# Avoid patching twice, as Nvidia iGPUs will only have Nvidia dGPUs
|
|
||||||
print("- Adding Nvidia Brightness Control patches")
|
|
||||||
self.add_new_binaries(ModelArray.AddNvidiaBrightness11, self.constants.legacy_nvidia_path)
|
|
||||||
if self.model in ModelArray.LegacyBrightness:
|
|
||||||
self.add_brightness_patch()
|
|
||||||
rebuild_required = True
|
rebuild_required = True
|
||||||
|
|
||||||
if rebuild_required is True:
|
if rebuild_required is True:
|
||||||
|
|||||||
Reference in New Issue
Block a user