Skip to content

Commit 9566681

Browse files
committed
improve metal 31001 patches
1 parent 30ec82d commit 9566681

File tree

9 files changed

+80
-11
lines changed

9 files changed

+80
-11
lines changed

oclp_r/sys_patch/patchsets/hardware/audio/modern_audio.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def _modern_audio_patches(self) -> dict:
8181
"AppleHDADisabler.kext" ,
8282
"VoodooHDA.kext",
8383
],
84+
"/Library/PreferencePanes" : [
85+
"VoodooHDA.prefPane",
86+
],
8487
},
8588
},
8689
}

oclp_r/sys_patch/patchsets/hardware/graphics/amd_legacy_gcn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ...shared_patches.monterey_gva import MontereyGVA
1010
from ...shared_patches.monterey_opencl import MontereyOpenCL
1111
from ...shared_patches.amd_opencl import AMDOpenCL
12-
12+
from ...shared_patches.metal_31001 import LegacyMetal31001
1313
from .....constants import Constants
1414
from .....detections import device_probe
1515

@@ -118,7 +118,9 @@ def patches(self) -> dict:
118118
if self.native_os() is True:
119119
return {}
120120

121-
_base = {}
121+
_base = {
122+
**LegacyMetal31001(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
123+
}
122124

123125
# AMD GCN and newer GPUs can still use the native GVA stack
124126
_base.update({

oclp_r/sys_patch/patchsets/hardware/graphics/amd_navi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ...shared_patches.monterey_gva import MontereyGVA
1010
from ...shared_patches.monterey_opencl import MontereyOpenCL
1111
from ...shared_patches.amd_opencl import AMDOpenCL
12-
12+
from ...shared_patches.metal_31001 import LegacyMetal31001
1313
from .....constants import Constants
1414
from .....detections import device_probe
1515

@@ -81,7 +81,7 @@ def _model_specific_patches(self) -> dict:
8181

8282
"AMDRadeonVADriver2.bundle": "12.5",
8383
"AMDRadeonX6000GLDriver.bundle": "12.5",
84-
"AMDRadeonX6000MTLDriver.bundle": "12.5" if self._xnu_major < os_data.sequoia else "12.5-24",
84+
**({ "AMDRadeonX6000MTLDriver.bundle": f"12.5-{self._xnu_major}" }),
8585
"AMDRadeonX6000Shared.bundle": "12.5",
8686

8787
"AMDShared.bundle": "12.5",
@@ -123,6 +123,7 @@ def patches(self) -> dict:
123123
return {}
124124

125125
return {
126+
**LegacyMetal31001(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
126127
**MontereyGVA(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).revert_patches(),
127128
**MontereyOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
128129
**AMDOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),

oclp_r/sys_patch/patchsets/hardware/graphics/amd_polaris.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from ...shared_patches.monterey_opencl import MontereyOpenCL
1313
from ...shared_patches.amd_opencl import AMDOpenCL
1414

15+
from ...shared_patches.metal_31001 import LegacyMetal31001
16+
1517
from .....constants import Constants
1618
from .....detections import device_probe
1719

@@ -111,7 +113,7 @@ def _model_specific_patches(self) -> dict:
111113
"AMDRadeonX4000HWServices.kext": "12.5",
112114
"AMDRadeonVADriver2.bundle": "12.5",
113115
"AMDRadeonX4000GLDriver.bundle": "12.5",
114-
"AMDMTLBronzeDriver.bundle": "12.5" if self._xnu_major < os_data.sequoia else "12.5-24",
116+
**({ "AMDMTLBronzeDriver.bundle": f"12.5-{self._xnu_major}" }),
115117
"AMDShared.bundle": "12.5",
116118
},
117119
},
@@ -131,6 +133,7 @@ def patches(self) -> dict:
131133
return self._model_specific_patches()
132134

133135
_base = {
136+
**LegacyMetal31001(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
134137
**MontereyOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
135138
**self._model_specific_patches(),
136139
}

oclp_r/sys_patch/patchsets/hardware/graphics/amd_vega.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ...shared_patches.monterey_gva import MontereyGVA
1010
from ...shared_patches.monterey_opencl import MontereyOpenCL
1111
from ...shared_patches.amd_opencl import AMDOpenCL
12+
from ...shared_patches.metal_31001 import LegacyMetal31001
1213

1314
from .....constants import Constants
1415
from .....detections import device_probe
@@ -80,7 +81,7 @@ def _model_specific_patches(self) -> dict:
8081

8182
"AMDRadeonVADriver2.bundle": "12.5",
8283
"AMDRadeonX5000GLDriver.bundle": "12.5",
83-
"AMDRadeonX5000MTLDriver.bundle": "12.5" if self._xnu_major < os_data.sequoia else "12.5-24",
84+
**({ "AMDRadeonX5000MTLDriver.bundle": f"12.5-{self._xnu_major}" }),
8485
"AMDRadeonX5000Shared.bundle": "12.5",
8586

8687
"AMDShared.bundle": "12.5",
@@ -123,6 +124,7 @@ def patches(self) -> dict:
123124

124125
return {
125126
# AMD GCN and newer GPUs can still use the native GVA stack
127+
**LegacyMetal31001(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
126128
**MontereyGVA(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).revert_patches(),
127129

128130
**MontereyOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),

oclp_r/sys_patch/patchsets/hardware/graphics/intel_broadwell.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from ...shared_patches.monterey_gva import MontereyGVA
1010
from ...shared_patches.monterey_opencl import MontereyOpenCL
1111

12+
from ...shared_patches.metal_31001 import LegacyMetal31001
13+
1214
from .....constants import Constants
1315
from .....detections import device_probe
1416

@@ -70,7 +72,7 @@ def _model_specific_patches(self) -> dict:
7072
"AppleIntelBDWGraphics.kext": self._resolve_monterey_framebuffers(),
7173
"AppleIntelBDWGraphicsFramebuffer.kext": self._resolve_monterey_framebuffers(),
7274
"AppleIntelBDWGraphicsGLDriver.bundle": "12.5",
73-
"AppleIntelBDWGraphicsMTLDriver.bundle": "12.5-22" if self._xnu_major < os_data.sequoia else "12.5-24",
75+
**({ "AppleIntelBDWGraphicsMTLDriver.bundle": f"12.5-{self._xnu_major}" }),
7476
"AppleIntelBDWGraphicsVADriver.bundle": "12.5",
7577
"AppleIntelBDWGraphicsVAME.bundle": "12.5",
7678
"AppleIntelGraphicsShared.bundle": "12.5",
@@ -88,6 +90,7 @@ def patches(self) -> dict:
8890
return {}
8991

9092
return {
93+
**LegacyMetal31001(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
9194
**MontereyGVA(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
9295
**MontereyOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
9396
**self._model_specific_patches(),

oclp_r/sys_patch/patchsets/hardware/graphics/intel_skylake.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from .....constants import Constants
1212
from .....detections import device_probe
13-
13+
from ...shared_patches.metal_31001 import LegacyMetal31001
1414
from .....datasets.os_data import os_data
1515

1616

@@ -70,7 +70,7 @@ def _model_specific_patches(self) -> dict:
7070
"AppleIntelSKLGraphics.kext": self._resolve_monterey_framebuffers(),
7171
"AppleIntelSKLGraphicsFramebuffer.kext": self._resolve_monterey_framebuffers(),
7272
"AppleIntelSKLGraphicsGLDriver.bundle": "12.5",
73-
"AppleIntelSKLGraphicsMTLDriver.bundle": "12.5" if self._xnu_major < os_data.sequoia else "12.5-24",
73+
**({ "AppleIntelSKLGraphicsMTLDriver.bundle": f"12.5-{self._xnu_major}" }),
7474
"AppleIntelSKLGraphicsVADriver.bundle": "12.5",
7575
"AppleIntelSKLGraphicsVAME.bundle": "12.5",
7676
"AppleIntelGraphicsShared.bundle": "12.5",
@@ -88,6 +88,7 @@ def patches(self) -> dict:
8888
return {}
8989

9090
return {
91+
**LegacyMetal31001(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
9192
**MontereyOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
9293
**self._model_specific_patches(),
9394
}

oclp_r/sys_patch/patchsets/hardware/networking/modern_wireless.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def native_os(self) -> bool:
4242
Dropped support with macOS 14, Sonoma
4343
"""
4444
return self._xnu_major < os_data.sonoma.value
45+
46+
def extended_os(self) -> bool:
47+
"""
48+
Extended support with macOS 14, Sonoma
49+
"""
50+
return self._xnu_major == os_data.sonoma.value
4551

4652
def hardware_variant(self) -> HardwareVariant:
4753
"""
@@ -53,7 +59,7 @@ def _patches_modern_wireless_sonoma(self) -> dict:
5359
"""
5460
Extended modern wireless patches
5561
"""
56-
if self.native_os() is True:
62+
if self.native_os() is True or self.extended_os() is False:
5763
return {}
5864

5965
return {
@@ -106,7 +112,7 @@ def patches(self) -> dict:
106112
**self._patches_modern_wireless(),
107113
}
108114

109-
if self._xnu_major == os_data.sonoma:
115+
if self._xnu_major == os_data.sonoma.value:
110116
_base.update({
111117
**self._patches_modern_wireless_sonoma(),
112118
})
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"""
2+
metal_31001.py: Metal 31001 patches
3+
"""
4+
5+
import packaging.version
6+
7+
from .base import BaseSharedPatchSet
8+
9+
from ..base import PatchType, DynamicPatchset
10+
11+
from ....datasets.os_data import os_data
12+
13+
14+
class LegacyMetal31001(BaseSharedPatchSet):
15+
16+
def __init__(self, xnu_major: int, xnu_minor: int, marketing_version: str) -> None:
17+
super().__init__(xnu_major, xnu_minor, marketing_version)
18+
19+
def _os_requires_patches(self) -> bool:
20+
"""
21+
Check if the current OS requires
22+
"""
23+
return self._xnu_major >= os_data.ventura.value
24+
25+
def _patches_metal_31001_common(self) -> dict:
26+
"""
27+
Intel Broadwell, Skylake, and AMD GCN are Metal 31001-based GPUs
28+
"""
29+
if self._os_requires_patches() is False:
30+
return {}
31+
32+
return {
33+
"Metal 31001 Common": {
34+
PatchType.OVERWRITE_SYSTEM_VOLUME: {
35+
"/System/Library/PrivateFrameworks/RenderBox.framework/Versions/A/Resources": {
36+
**({ "default.metallib": f"RenderBox-{self._xnu_major}" }),
37+
}
38+
},
39+
}
40+
}
41+
42+
def patches(self) -> dict:
43+
"""
44+
Dictionary of patches
45+
"""
46+
return {
47+
**self._patches_metal_31001_common(),
48+
}

0 commit comments

Comments
 (0)