Skip to content

Commit

Permalink
Add Skylake Graphics spoofing support for macOS 13+ (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
PMheart committed Jun 23, 2022
1 parent ade6c98 commit 559349d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ WhateverGreen Changelog
=======================
#### v1.6.0
- Added constants required for macOS 13 update
- Added Skylake graphics spoofing support on macOS 13+ by @dhinakg
- Modified brightness change requests to replace previous requests instead of queuing

#### v1.5.9
Expand Down
8 changes: 6 additions & 2 deletions Manual/FAQ.IntelHD.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,12 @@ Mobile: 0, PipeCount: 2, PortCount: 2, FBMemoryCount: 2

## Intel HD Graphics 510-580 ([Skylake](https://en.wikipedia.org/wiki/Skylake_(microarchitecture)))

> Supported since OS X 10.11.4 to macOS 12.x. On newer operating systems these are not supported.
> Officially supported since OS X 10.11.4 to macOS 12.x. On newer operating systems, spoofing as Kaby Lake is required.
#### Spoof Skylake as Kaby Lake on macOS Ventura (13) and above

Make sure that WhateverGreen v1.6.0 or above is used. Then, it is necessary to fake `device-id` and choose an `ig-platform-id` from Kaby Lake that is closest to the Skylake model (e.g. HD 530 to HD 630). In case of incompatibility, try a different `device-id` and the corresponding `ig-platform-id`. Experiments are the best practice to figure out which ID will best fit.

***SKL framebuffer list:***

| Framebuffer | Type | Connectors | TOTAL STOLEN Memory |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ indices of connectors for which online status is enforced. Format is similar to
- `-igfxmpc` boot argument (`enable-max-pixel-clock-override` and `max-pixel-clock-frequency` properties) to increase max pixel clock (as an alternative to patching CoreDisplay.framework).
- `-igfxbls` boot argument (and `enable-backlight-smoother` property) to make brightness transitions smoother on IVB+ platforms. [Read the manual](https://github.com/acidanthera/WhateverGreen/blob/master/Manual/FAQ.IntelHD.en.md#customize-the-behavior-of-the-backlight-smoother-to-improve-your-experience)
- `-igfxdbeo` boot argument (and `enable-dbuf-early-optimizer` property) to fix the Display Data Buffer (DBUF) issues on ICL+ platforms. [Read the manual](https://github.com/acidanthera/WhateverGreen/blob/master/Manual/FAQ.IntelHD.en.md#fix-the-issue-that-the-builtin-display-remains-garbled-after-the-system-boots-on-icl-platforms)
- `-igfxsklaskbl` to enforce Kaby Lake (KBL) graphics kext being loaded and used on Skylake models (KBL `device-id` and `ig-platform-id` are required)
- `applbkl=3` boot argument (and `applbkl` property) to enable PWM backlight control of AMD Radeon RX 5000 series graphic cards [read here.](https://github.com/acidanthera/WhateverGreen/blob/master/Manual/FAQ.Radeon.en.md)

#### Credits
Expand Down
34 changes: 27 additions & 7 deletions WhateverGreen/kern_igfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,27 @@ void IGFX::init() {
currentFramebuffer = &kextIntelBDWFb;
break;
case CPUInfo::CpuGeneration::Skylake:
supportsGuCFirmware = true;
currentGraphics = &kextIntelSKL;
currentFramebuffer = &kextIntelSKLFb;
modForceCompleteModeset.supported = modForceCompleteModeset.legacy = true; // not enabled, as on legacy operating systems it casues crashes.
modTypeCCheckDisabler.enabled = getKernelVersion() >= KernelVersion::BigSur;
modBlackScreenFix.available = true;
// Fake SKL as KBL on 13.0+ due to the removal of SKL kexts
// Or KBL kext can be used on SKL with older versions as well with KBL `device-id' and `ig-platform-id' injected.
forceSKLAsKBL = getKernelVersion() >= KernelVersion::Ventura || checkKernelArgument("-igfxsklaskbl");
if (forceSKLAsKBL) {
DBGLOG("igfx", "enforcing KBL kexts and patches on Skylake");
supportsGuCFirmware = true;
currentGraphics = &kextIntelKBL;
currentFramebuffer = &kextIntelKBLFb;
modForceCompleteModeset.supported = modForceCompleteModeset.enabled = true;
modRPSControlPatch.available = true;
modForceWakeWorkaround.enabled = true;
modTypeCCheckDisabler.enabled = getKernelVersion() >= KernelVersion::BigSur;
modBlackScreenFix.available = true;
} else {
supportsGuCFirmware = true;
currentGraphics = &kextIntelSKL;
currentFramebuffer = &kextIntelSKLFb;
modForceCompleteModeset.supported = modForceCompleteModeset.legacy = true; // not enabled, as on legacy operating systems it casues crashes.
modTypeCCheckDisabler.enabled = getKernelVersion() >= KernelVersion::BigSur;
modBlackScreenFix.available = true;
}
break;
case CPUInfo::CpuGeneration::KabyLake:
supportsGuCFirmware = true;
Expand Down Expand Up @@ -264,7 +279,7 @@ bool IGFX::processKext(KernelPatcher &patcher, size_t index, mach_vm_address_t a
auto cpuGeneration = BaseDeviceInfo::get().cpuGeneration;

if (currentGraphics && currentGraphics->loadIndex == index) {
if (forceOpenGL || forceMetal || moderniseAccelerator || fwLoadMode != FW_APPLE || disableAccel) {
if (forceOpenGL || forceMetal || forceSKLAsKBL || moderniseAccelerator || fwLoadMode != FW_APPLE || disableAccel) {
KernelPatcher::RouteRequest request("__ZN16IntelAccelerator5startEP9IOService", wrapAcceleratorStart, orgAcceleratorStart);
patcher.routeMultiple(index, &request, 1, address, size);

Expand Down Expand Up @@ -1055,6 +1070,11 @@ bool IGFX::wrapAcceleratorStart(IOService *that, IOService *provider) {

if (callbackIGFX->moderniseAccelerator)
that->setName("IntelAccelerator");

if (callbackIGFX->forceSKLAsKBL) {
DBGLOG("igfx", "disabling VP9 hw decode support on Skylake when using KBL kexts");
that->removeProperty("IOGVAXDecode");
}

bool ret = FunctionCast(wrapAcceleratorStart, callbackIGFX->orgAcceleratorStart)(that, provider);

Expand Down
5 changes: 5 additions & 0 deletions WhateverGreen/kern_igfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ class IGFX {
*/
bool moderniseAccelerator {false};

/**
* Set to true to force Kaby Lake graphics kext to be used on Skylake
*/
bool forceSKLAsKBL {false};

/**
* GuC firmware loading scheme
*/
Expand Down

0 comments on commit 559349d

Please sign in to comment.