From 559349ddb60b10daffdfee411011937c59b74edf Mon Sep 17 00:00:00 2001 From: PMheart <17109513+PMheart@users.noreply.github.com> Date: Thu, 23 Jun 2022 06:59:06 +0200 Subject: [PATCH] Add Skylake Graphics spoofing support for macOS 13+ (#101) --- Changelog.md | 1 + Manual/FAQ.IntelHD.en.md | 8 ++++++-- README.md | 1 + WhateverGreen/kern_igfx.cpp | 34 +++++++++++++++++++++++++++------- WhateverGreen/kern_igfx.hpp | 5 +++++ 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 67dda73f..518a0005 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/Manual/FAQ.IntelHD.en.md b/Manual/FAQ.IntelHD.en.md index 9c3faa46..0dea46c5 100644 --- a/Manual/FAQ.IntelHD.en.md +++ b/Manual/FAQ.IntelHD.en.md @@ -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 | diff --git a/README.md b/README.md index ace74057..6f49f05b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/WhateverGreen/kern_igfx.cpp b/WhateverGreen/kern_igfx.cpp index 0bf55de9..480eb3e1 100644 --- a/WhateverGreen/kern_igfx.cpp +++ b/WhateverGreen/kern_igfx.cpp @@ -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; @@ -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); @@ -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); diff --git a/WhateverGreen/kern_igfx.hpp b/WhateverGreen/kern_igfx.hpp index 89910a00..19a8fa5c 100644 --- a/WhateverGreen/kern_igfx.hpp +++ b/WhateverGreen/kern_igfx.hpp @@ -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 */