Add beta support for Legacy GPU Acceleration

This commit is contained in:
Mykola Grymalyuk
2021-04-20 18:38:42 -06:00
parent 797b56b9f9
commit f178b22423
5 changed files with 45 additions and 35 deletions

View File

@@ -6,6 +6,8 @@
- Fix iMac11,1 boot issues after PRAM reset
- Fix DRM support on Nvidia-only configurations
- Support optional setting between DRM and QuickSync support on iMacs13,x and iMac14,x
- Add public beta support for Legacy GPU Acceleration
- Note ATI/AMD TeraScale 2 unsupported
## 0.1.0
- Fix crash on iMacs with Metal GPUs

View File

@@ -92,7 +92,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial],
[f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).drm_setting],
[f"Set Generic Bootstrap:\t\t{self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting],
["Set Custom Patch Repo", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_repo],
[f"Set Accleration Patches:\t\t{self.constants.legacy_acceleration_patch}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).accel_setting],
]
for option in options:

View File

@@ -219,31 +219,6 @@ running, however this will enforce iMac Nvidia Build Patches.
else:
print("Invalid option")
def custom_repo(self):
Utilities.cls()
Utilities.header(["Set custom patch repo"])
print(f"""For users participating in OpenCore Patcher betas, this is
where you can add custom repos such as Google Drive links.
Valid options:
1. Set custom location
2. Reset repo location
3. Exit
Current repo:
{self.constants.url_apple_binaries}
""")
change_menu = input("Set custom location?: ")
if change_menu == "1":
self.constants.url_backup = self.constants.url_apple_binaries
self.constants.url_apple_binaries = input("Enter new URL: ")
elif change_menu == "2":
if self.constants.url_backup != "":
self.constants.url_apple_binaries = self.constants.url_backup
else:
print("Invalid option")
def bootstrap_setting(self):
Utilities.cls()
Utilities.header(["Set Bootstrap method"])
@@ -293,3 +268,30 @@ Recommend only disabling if absolutely required.
self.constants.drm_support = False
else:
print("Invalid option")
def accel_setting(self):
Utilities.cls()
Utilities.header(["Enable Beta Acceleration Patches"])
print("""Enables OCLP's experimental GPU Acceleration Patches
Note these are still in beta and we highly recommend users
not run them daily or expect stable performance.
Currently the following are supported:
- Nvidia: Tesla and Fermi (8000-500)
- AMD/ATI: TeraScale 1 (2000-4000)
- Intel: Ironlake and Sandy Bridge
For relaibaility, please consider running macOS Catalina or
older via Dosdude1's patchers
Note: These patches may break Big Sur booting, please have any
important data backed up in case of emergencies
""")
change_menu = input("Enable Beta Acceleration Patches(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.legacy_acceleration_patch = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.legacy_acceleration_patch = False
else:
print("Invalid option")

View File

@@ -35,6 +35,7 @@ class Constants:
self.smcspoof_version = "1.0.0"
self.cputscsync = "1.0.3"
self.hibernationfixup = "1.3.9"
self.payload_version = "0.0.2"
# Get resource path
self.current_path = Path(__file__).parent.parent.resolve()
@@ -69,6 +70,7 @@ class Constants:
self.detected_os = 0
self.boot_efi = False
self.drm_support = False
self.legacy_acceleration_patch = False
# OS Versions
self.tiger = 8
@@ -93,8 +95,7 @@ class Constants:
self.pci_atheros = "168C"
# External Files
self.url_backup = ""
self.url_apple_binaries = "https://github.com/dortania/Apple-Binaries-OCLP/archive/refs/heads/main.zip"
self.url_apple_binaries = "https://github.com/dortania/Apple-Binaries-OCLP/archive/refs/tags/"
# Payload Location
# OpenCore
@@ -232,7 +233,7 @@ class Constants:
# Apple Paylods Paths
@property
def payload_apple_root_path_unzip(self): return self.payload_path / Path("Apple-Binaries-OCLP-main")
def payload_apple_root_path_unzip(self): return self.payload_path / Path(f"Apple-Binaries-OCLP-{self.payload_version}")
@property
def payload_apple_root_path_zip(self): return self.payload_path / Path("Apple.zip")
@property
@@ -284,7 +285,9 @@ class Constants:
# Apple LaunchDaemons
@property
def hiddhack_path(self): return self.payload_apple_lauchd_path_accel / Path("HiddHack.plist")
def hiddhack_path(self): return self.payload_apple_lauchd_path_accel / Path("IOHID-Fixup.plist")
@property
def legacy_hiddhack_path(self): return self.payload_apple_lauchd_path_accel / Path("HiddHack.plist")
# Apple PrivateFrameworks
@property

View File

@@ -176,10 +176,13 @@ class PatchSysVolume:
self.add_brightness_patch()
# LaunchDaemons
print("- Adding HiddHack.plist")
if Path(self.mount_lauchd / Path("HiddHack.plist")).exists():
print("- Removing legacy HiddHack")
subprocess.run(f"sudo rm {self.mount_lauchd}/HiddHack.plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("- Adding IOHID-Fixup.plist")
subprocess.run(f"sudo ditto {self.constants.payload_apple_lauchd_path_accel} {self.mount_lauchd}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"sudo chmod 755 {self.mount_lauchd}/HiddHack.plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"sudo chown root:wheel {self.mount_lauchd}/HiddHack.plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"sudo chmod 755 {self.mount_lauchd}/IOHID-Fixup.plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"sudo chown root:wheel {self.mount_lauchd}/IOHID-Fixup.plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
# PrivateFrameworks
print("- Merging legacy PrivateFrameworks")
@@ -209,7 +212,7 @@ class PatchSysVolume:
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")
else:
if Path(self.constants.hiddhack_path).exists():
if self.constants.legacy_acceleration_patch is True:
print("- Detected legacy GPU, attempting legacy acceleration patches")
self.gpu_accel_patches_11()
else:
@@ -311,7 +314,7 @@ class PatchSysVolume:
def download_files(self):
Utilities.cls()
print("- Downloading Apple binaries")
popen_oclp = subprocess.Popen(f"curl -S -L {self.constants.url_apple_binaries} --output {self.constants.payload_apple_root_path_zip}".split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
popen_oclp = subprocess.Popen(f"curl -S -L {self.constants.url_apple_binaries}{self.constants.payload_version}.zip --output {self.constants.payload_apple_root_path_zip}".split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
for stdout_line in iter(popen_oclp.stdout.readline, ""):
print(stdout_line, end="")
popen_oclp.stdout.close()