mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
Probe hardware for Backlight pathing
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
- Fix reduced output speeds on BCM94360 series Wifi cards
|
||||
- Fix accidentally disabling non-existent iGPU in iMac11,2
|
||||
- Remove ACPI Patching requirement for Minimal SMBIOS setups
|
||||
- Probe hardware for Backlight pathing on iMac10,1, iMac11,x and iMac12,x with Metal GPUs
|
||||
|
||||
## 0.1.1
|
||||
- Fix iMac11,3 GFX0 pathing
|
||||
|
||||
@@ -286,38 +286,46 @@ class BuildOpenCore:
|
||||
else:
|
||||
self.config["DeviceProperties"]["Add"][hdef_path] = {"apple-layout-id": 90, "use-apple-layout-id": 1, "use-layout-id": 1, }
|
||||
|
||||
def backlight_path_detection(self):
|
||||
if not self.constants.custom_model:
|
||||
gfx0_path: str = subprocess.run([self.constants.gfxutil_path] + f"-f GFX0".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
try:
|
||||
self.gfx0_path = [line.strip().split("= ", 1)[1] for line in gfx0_path.split("\n") if "GFX0" in line.strip()][0]
|
||||
print(f"- Found GFX0 device at {self.gfx0_path}")
|
||||
except IndexError:
|
||||
print("- Failed to find GFX0 Device path, falling back on known logic")
|
||||
if self.model == ["iMac11,1", "iMac11,3"]:
|
||||
self.gfx0_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"
|
||||
else:
|
||||
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
||||
else:
|
||||
if self.model == ["iMac11,1", "iMac11,3"]:
|
||||
self.gfx0_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"
|
||||
else:
|
||||
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
||||
print(f"- Using known GFX0 path: {self.gfx0_path}")
|
||||
|
||||
def nvidia_patch(self):
|
||||
|
||||
def nvidia_patch(self, backlight_path):
|
||||
self.constants.custom_mxm_gpu = True
|
||||
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3"]:
|
||||
print("- Adding Nvidia Brightness Control and DRM patches")
|
||||
if self.model == "iMac11,2":
|
||||
backlight_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
||||
else:
|
||||
backlight_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000"), "shikigva": 256, "agdpmod": "vit9696"}
|
||||
shutil.copy(self.constants.backlight_path, self.constants.kexts_path)
|
||||
self.get_kext_by_bundle_path("AppleBacklightFixup.kext")["Enabled"] = True
|
||||
elif self.model in ["iMac12,1", "iMac12,2"]:
|
||||
print("- Adding Nvidia Brightness Control and DRM patches")
|
||||
backlight_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000"), "shikigva": 256}
|
||||
print("- Disabling unsupported iGPU")
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {"name": binascii.unhexlify("23646973706C6179"), "IOName": "#display", "class-code": binascii.unhexlify("FFFFFFFF")}
|
||||
shutil.copy(self.constants.backlight_path, self.constants.kexts_path)
|
||||
self.get_kext_by_bundle_path("AppleBacklightFixup.kext")["Enabled"] = True
|
||||
|
||||
def amd_patch(self):
|
||||
def amd_patch(self, backlight_path):
|
||||
self.constants.custom_mxm_gpu = True
|
||||
print("- Adding AMD DRM patches")
|
||||
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3"]:
|
||||
if self.model == "iMac11,2":
|
||||
backlight_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
||||
else:
|
||||
backlight_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 80, "unfairgva": 1}
|
||||
elif self.model in ["iMac12,1", "iMac12,2"]:
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"shikigva": 80, "unfairgva": 1}
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 80, "unfairgva": 1}
|
||||
if self.model in ["iMac12,1", "iMac12,2"]:
|
||||
print("- Disabling unsupported iGPU")
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {"name": binascii.unhexlify("23646973706C6179"), "IOName": "#display", "class-code": binascii.unhexlify("FFFFFFFF")}
|
||||
elif self.model == "iMac10,1":
|
||||
@@ -325,19 +333,22 @@ class BuildOpenCore:
|
||||
|
||||
# Check GPU Vendor
|
||||
if self.constants.metal_build is True:
|
||||
backlight_path_detection(self)
|
||||
print("- Adding Metal GPU patches on request")
|
||||
if self.constants.imac_vendor == "AMD":
|
||||
amd_patch(self)
|
||||
amd_patch(self, self.gfx0_path)
|
||||
elif self.constants.imac_vendor == "Nvidia":
|
||||
nvidia_patch(self)
|
||||
nvidia_patch(self, self.gfx0_path)
|
||||
else:
|
||||
print("- Failed to find vendor")
|
||||
elif not self.constants.custom_model:
|
||||
self.check_pciid(True)
|
||||
if self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs:
|
||||
amd_patch(self)
|
||||
backlight_path_detection(self)
|
||||
amd_patch(self, self.gfx0_path)
|
||||
elif self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs:
|
||||
nvidia_patch(self)
|
||||
backlight_path_detection(self)
|
||||
nvidia_patch(self, self.gfx0_path)
|
||||
if self.model in ModelArray.MacPro71:
|
||||
print("- Adding Mac Pro, Xserve DRM patches")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
|
||||
|
||||
@@ -263,7 +263,7 @@ class Constants:
|
||||
|
||||
# Apple Extensions
|
||||
@property
|
||||
def applehda_path(self): return self.payload_apple_kexts_path / Path("Audio/AppleHDA.kext")
|
||||
def audio_path(self): return self.payload_apple_kexts_path / Path("Audio")
|
||||
|
||||
# GPU Kexts and Bundles
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ SupportedSMBIOS11 = [
|
||||
# Xserve
|
||||
"Xserve2,1",
|
||||
"Xserve3,1",
|
||||
"Dortania1,1"
|
||||
"Dortania1,1",
|
||||
]
|
||||
|
||||
SupportedSMBIOS12 = [
|
||||
@@ -699,25 +699,26 @@ upgradableMXMGPUs = [
|
||||
|
||||
# Reference: https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
|
||||
NVIDIAMXMGPUs = [
|
||||
"12B9", # Quadro K610M
|
||||
"0FF6", # Quadro K1100M
|
||||
"11FC", # Quadro K2100M
|
||||
"0FFC", # Quadro K1000M
|
||||
"0FFB", # Quadro K2000M
|
||||
"0FFC", # Quadro K1000M
|
||||
"1198", # GTX 880M
|
||||
"1199", # GTX 870M
|
||||
"119A", # GTX 860M
|
||||
"119E", # GTX 780M
|
||||
"119F", # GTX 880M
|
||||
"11A9", # GTX 870M
|
||||
"11B6", # Quadro K3100M
|
||||
"11B7", # Quadro K4100M
|
||||
"11BC", # Quadro K5000M
|
||||
"11B8", # Quadro K5100M
|
||||
"11BC", # Quadro K5000M
|
||||
"11BD", # Quadro K4000M
|
||||
"11BE", # Quadro K3000M
|
||||
"11E1", # GTX 765M
|
||||
"11E2", # GTX 765M
|
||||
"11E0", # GTX 770M
|
||||
"119E", # GTX 780M Mac Edition
|
||||
"119E", # GTX 780M
|
||||
"119F", # GTX 880M
|
||||
"119A", # GTX 860M
|
||||
"1392", # GTX 860M
|
||||
"1199", # GTX 870M
|
||||
"11A9", # GTX 870M
|
||||
"11FC", # Quadro K2100M
|
||||
"12B9", # Quadro K610M
|
||||
]
|
||||
|
||||
AMDMXMGPUs = [
|
||||
@@ -1039,6 +1040,10 @@ AddBrightness = [
|
||||
"AppleBacklightExpert.kext",
|
||||
]
|
||||
|
||||
AddVolumeControl = [
|
||||
"IOAudioFamily.kext",
|
||||
]
|
||||
|
||||
# List supported IDs
|
||||
|
||||
TeraScale1pciid = [
|
||||
|
||||
@@ -232,6 +232,10 @@ class PatchSysVolume:
|
||||
self.gpu_accel_patches_11()
|
||||
rebuild_required = True
|
||||
|
||||
#if self.model == "iMac7,1":
|
||||
# print("- Fixing Volume Control Support")
|
||||
# self.add_new_binaries(ModelArray.AddVolumeControl, self.constants.audio_path)
|
||||
|
||||
if rebuild_required is True:
|
||||
self.rebuild_snapshot()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user