Framebuffer patching in Mojave
Binary patching framebuffers in Clover is no longer a viable method in Mojave. The good news is vit9696 and I have created a new framebuffer patching system for Lilu + WhateverGreen.
Not just for Mojave
This method of framebuffer patching is not only required for Mojave we recommend it for all previous and future releases of macOS.
Coffee Lake Users
Please note that the new WhateverGreen will not work with fake Kaby Lake platform-id's. You will need to have either macOS 10.14 Beta 4 (18A336e) or macOS High Sierra 10.13.6 (17G2112). The latter is a special build only available to MacBookPro15,1 or MacBookPro15,2 board id's. You can create a macOS High Sierra 10.13.6 (17G2112) installer by running installinstallmacos.py or download a pre-created installer from here or here.
Lilu + WhateverGreen
WhateverGreen is going to replace all the other video patching plugins for Lilu (it currently has merged WhateverGreen, IntelGraphicsFixup, NvidiaGraphicsFixup, Shiki and CoreDisplayFixup). Others will likely follow (such as AppleALC, HibernationFixup and IntelGraphicsDVMTFixup). This is aiming to be the all-in-one solution for video.
Please note that it is currently in a "beta" state so use it at your own risk. I am just documenting this here for those of you who want to get framebuffer patching now.
Compile Lilu + WhateverGreen
Download WhateverGreen. Make sure you place the debug version of Lilu into the root of WhateverGreen before you compile. Install Lilu and WhateverGreen kext's into the usual place. Compile WhateverGreen as debug if you want to view debug output.
If you can't compile your own please wait for the official binaries to be released soon.
Get the device path of your IGPU:
Download and use the gfxutil tool like so:
$ gfxutil -f IGPU DevicePath = PciRoot(0x0)/Pci(0x2,0x0) We have two different types of patches:
framebuffer-patch-enable (required to enable below) framebuffer-framebufferid (optional; defaults to current platform-id) (all below are optional) framebuffer-mobile framebuffer-pipecount framebuffer-portcount framebuffer-memorycount framebuffer-stolenmem framebuffer-fbmem framebuffer-unifiedmem framebuffer-conX-enable (required to enable below) framebuffer-conX-index framebuffer-conX-busid framebuffer-conX-pipe framebuffer-conX-type framebuffer-conX-flags Find / Replace
framebuffer-patchX-enable (required to enable below) framebuffer-patchX-framebufferid (optional; defaults to current platform-id) framebuffer-patchX-find framebuffer-patchX-replace framebuffer-patchX-count (optional; defaults to 1) You should place your patches in config.plist/Devices/Properties in Clover config.plist.
Here are some example patches:
- 32MB BIOS, 19MB stolen (framebuffer) 9MB fbmem (cursor) 2048MB unifiedmem (vram)
- NOTE: The values are in bytes so you should convert MB to bytes (you can use this online converter)
<key>Devices</key> <dict> <key>Properties</key> <dict> <key>PciRoot(0x0)/Pci(0x2,0x0)</key> <dict> <key>AAPL,ig-platform-id</key> <data>CQClPg==</data> <key>framebuffer-patch-enable</key> <integer>1</integer> <key>framebuffer-stolenmem</key> <integer>19922944</integer> <key>framebuffer-fbmem</key> <integer>9437184</integer> <key>framebuffer-unifiedmem</key> <integer>2147483648</integer> </dict> </dict> </dict> - Pipe / Port Count 3 to 2
- Connector 1 (BusId 0x4) DP to HDMI
- Connector 2 (BusId 0x6) Disable
- NOTE: WhateverGreen will automatically set all connectors from DP->HDMI (you can use -igfxnohdmi boot flag to disable this)
<key>Devices</key> <dict> <key>Properties</key> <dict> <key>PciRoot(0x0)/Pci(0x2,0x0)</key> <dict> <key>AAPL,ig-platform-id</key> <data>CQClPg==</data> <key>framebuffer-patch-enable</key> <integer>1</integer> <key>framebuffer-pipecount</key> <integer>2</integer> <key>framebuffer-portcount</key> <integer>2</integer> <key>framebuffer-con1-enable</key> <integer>1</integer> <key>framebuffer-con1-type</key> <integer>0x00000800</integer> <key>framebuffer-con2-enable</key> <integer>1</integer> <key>framebuffer-con2-type</key> <integer>-1</integer> </dict> </dict> </dict> Here is an example of the Find / Replace method:
<key>Devices</key> <dict> <key>Properties</key> <dict> <key>PciRoot(0x0)/Pci(0x2,0x0)</key> <dict> <key>AAPL,ig-platform-id</key> <data>CQClPg==</data> <key>framebuffer-patch0-enable</key> <integer>1</integer> <key>framebuffer-patch0-find</key> <data>AAAIAAIAAACYAAAA</data> <key>framebuffer-patch0-replace</key> <data>AAAIAAIAAACHAQAA</data> </dict> </dict> </dict> Debugging
If you need a dump of your framebuffers in hex use the boot flag -igfxdump. The output will be in /AppleIntelFramebuffer_GEN_KERNX_Y on your boot drive (Eg. AppleIntelFramebuffer_10_17.7). 010 Editor supports the IntelFramebuffer.bt template for parsing the framebuffer binaries.
To get debug output from WhateverGreen please and use the -wegdbg boot flag. You will need to compile WhateverGreen as debug for both of these flags to work.
To view debug output use:
log show --predicate 'process == "kernel" AND (eventMessage CONTAINS "WhateverGreen" OR eventMessage CONTAINS "Lilu")' --style syslog --source --last boot Thanks
Big thanks to vit9696 for all his help implementing this and also writing the amazing Lilu and WhateverGreen plugin. Also thanks to all the other contributors.
So, this little tutorial is meant to help people fix a new issue with Mojave: opening jpg files (looks like it happens with larger files, not so much with smaller ones) using Quick Look (on spacebar key pressed) or Preview app using the dedicated GPUs.
The issue is that, when trying to open jpg files (for some reason, it doesn't occur with pngs), the pop-up window would remain in an endless loop. And from that point forward, any other app trying to open the same file, will either become unresponsive (in the case of the Preview app) or just stay in endless loop (in case of Quick Look)
As a workaround, in case the tutorial below doesn't work for you, you can use Grab (built-in app in MacOS) to open said files.
This issues DOES NOT occur using the iGPU. So...if you're comfortable using the iGPU, just switch to that and you should be good to go. You don't need this tutorial.
This tutorial is based on @Cyberdevs' research and testing on this topic (especially useful if you're using an RX series AMD video card), and my own very limited time testing this on my rig. I just thought it would be useful to create a new thread for it so that people can discuss this particular issue here.
The main thing we need to do is actually very simple: we need to enable the iGPU (integrated GPU) by default, in BIOS, while actually being connected to the dedicated GPU.
With that being said, I'll just move on to the actual tutorial.
For ATI GPUs (curtesy of @Cyberdevs' post here).
The discreet GPU should be set as primary in BIOS and your displays should be connected to your discreet GPU
The iGD/iGPU/iGFX must be enabled in BIOS/UEFI as the secondary GPU.
I removed the DSDT Reconfigured the config.plist to and removed some flags which weren't needed because of the DSDT added the InjectATI + Ornioco Framebuffer (I removed the Orinoco framebuffer because of some weird glitches but it might be useful for other AMD GPUs if you inject the correct framebuffer according to your GPU. No need to inject anything for nVidia GPUs unless your GPU needs it) Added the InjectIntel + ig-platform-id for my intel HD530 (for intel HD 530 I use the 0x19120001 ig-platform-id) Removed com.apple.finder.plist Removed com.apple.QuickLookDaemon.plist rebuild the kextcache and reset the nvram
Steps 5 to 7 might not be necessary I just did them anyway, if anyone succeeded to get quicklook working without those steps let me know so I can exclude those steps.
Also confirmed to work with AMD R9 270X on a SandyBridge rig (without an iGPU) using WhateverGreen + Lilu kexts, which also helped to solve the transparency issue along with the Quick Look problem, it also resolved the buggy Screen Capture (Command+Shift+5) issue as well.
nvram cleanup kextcache & prelinked kernel rebuild reboot More info on that here.
For NVIDIA GPUs
This is what I needed for my NVIDIA rig and the MSI motherboard in the signature. Your milage may vary, depending on your hardware. But, the idea should be the same regardless.
For MSi motherboads (check out my motherboard details in the signature)
Set your BIOS to use PEG (dedicated GPU) so you can boot.
Since you're reading this, chances are that you're already connected to the dedicated GPU and the BIOS is set to PEG. So just go into BIOS and see if you're using the iGPU or the dedicated (PEG) graphics device by default.
If you're already using this, skip to Step 3 (the part AFTER Reboot). Reboot (I think you don't necessarily need to boot into the OS...but you do need to reboot at least until Clover UI) Reboot back into BIOS and set it from PEG to IGD (integrated graphics) WITHOUT removing the cable. Save Reboot again.
The result should be that the OS is tricked into thinking you're booting with the IGPU when in fact you're using the dedicated GPU.
For Gigabyte motherboards
Peripherals -> Initial Display Output -> iGFX Chipset -> Internal Graphics -> Enabled
DVMT Pre-Allocation -> default 64M.
DVMT Total Gfx Mem -> default 256M Save Reboot
You should do this with the cable connected to the dedicated GPU.
You will also need to patch the iGPU from Clover config.
1. Graphics -> Inject Intel (UNCHECK Inject Nvidia or ATI if it's checked).
2. ig-platform-id (in my case for Intel HD 4600 Desktop) it was: 0x0d220003
And use IntelGraphicsFixup.kext in Clover/kexts/Other. In my particular case, without the kext, I would get freezes in Safari.
This might be a bug with Mojave and it could be fixed by Apple in the future. but in the meantime, feel free to use this if it helps you fix the issue.
For HP motherboards (including laptops), so far no solution, unless the BIOS somehow allows to switch from eGPU to iGPU and vice-versa.
[SUCCESS] Asrock H370M-ITX/ac and getting RX560 to work with Intel graphics for full hardware acceleration on Mojave (and maybe High Sierra 10.13.6)By macinsane
Mojave (and maybe High Sierra 10.13.6) on Asrock H370M-ITX/ac and getting RX560 to work with Intel graphics for full hardware acceleration
Core i7 8700, UHD 630
Gigabyte Radeon RX560
Wifi/BT BCM943602BAED (DW1830) M.2
Samsung PM961 NVMe SSD
*This guide requires you to know the basics, meaning how to create a macOS install drive, installing and using Clover. There are great beginners guides out there! As always you need at least FakeSMC to boot, every other kext I’ve used is mentioned in the guide. For Mojave beta you need to be enlisted with your Apple-ID in Apple’s beta programme. What is described here may work for High Sierra 10.13.6, but I doubt it to be reliable. Even in early beta status (PB3) Mojave runs much more stable and smoother than High Sierra ever did for me.*
The board comes with BIOS version 1.20, there is an update 1.50 on the Asrock website. Usually it is good to stay updated but in this case I’ll recommend to stay on 1.20, because the 1.50 version seems to be unstable and I had restarts upon wake and things like that I couldn’t get fixed even with dsdt patches. So I just downgraded to 1.20 which runs fine.
Settings needed: Just the usual. Disable fast boot and security boot (everything Windows-related), disable vt-d and enable XHCI hand-off. Activate multi monitor support and set VRAM to 64MB to activate the Intel IGPU. From what I’ve read most people recommend 128MB but I find the 64MB setting to be more reliable, getting artifacts with settings below or above 64MB. 128MB may be needed for 4k support, though. As for nVidia users: You may have to disable the Intel graphics. I’m using an AMD card and that is the brand to go these days since Apple decided to work with AMD
Clover and power management:
I recommend upgrading to 4586. It seems that Aptiomemoryfix is now working with H370 chipsets. I stayed on OsxAptiomemoryfix2 together with Emuvariable and it works. Feel free to experiment.
For power management with your CoffeeLake cpu you can just tick plugin type within Clover or compile a ssdt with Pikeralphas script. Mojave reports my cpu correctly as Core i7 since PB3, before that it is just “Unknown” but that is just cosmetic.
This is the worst part. Getting the Radeon to run correctly alongside the Intel graphics took me weeks to figure out.
While RX570 and 580 run out of the box in most cases, the RX560 models often do not or at least not correctly. Apple even banned them from eGPU use. For my approach you cannot use “Whatevergreen.kext”, it simply didn’t work for me the way I needed it. Instead I added some fixes to my DSDT to set the correct number of ports used (DP, HDMI, DVI) and tell macOS to use the correct frambuffer. For those who are not into dsdt editing I added my DSDT, look at the “PEGP” section how it is done. This works for the RX560 using the “Acre” framebuffer, you can replace it with “Radeon”, that works too. Other cards need a different framebuffer and a different number of ports. You can do it! BTW: Do not buy this Gigabytecard!!! It has some weird VBIOS on it, which caused me nightmares before I got the card to work! Buy a Sapphire card instead, they are used by Apple too.
To get full hardware acceleration for encoding videos you have to have the Intel graphics enabled alongside your AMD card. Problem is, you cannot have it running simply as a second graphics card but you’ll need to “hide” it, means telling macOS that it doesn’t have any display connectors. Otherwise you’ll have screen artifacts or in the worst case just constant crashes. This can be done by adding a certain ig-platform-id in Clover. If you use 59120003 the Intel graphics will not show up in system profiler but it is there. You can check it with iStats or HWMonitor or look if the Kaby Lake graphics kexts are loaded. This ID makes the CoffeeLake UHD 630 to be recognized as a Kaby Lake gpu that has no display ports, is just used as a helper card.
You’ll need it as a helper card for video encoding. That is what Intel graphics are used for in Macs, to support video encoding on the hardware side. You can check if hardware encoding is supposedly enabled by using MacX Video Converter Pro and VDADecoderChecker. If both say “yes” and “fully supported” this is a good start. But despite the widespread belief this doesn’t mean everything is set correctly! You now have to find out, how to get both cards working together. This is the moment where you have to choose between work and fun: Are you using FinalCut Pro for video editing or are you planning to use iTunes for entertainment? Up until this day (Mojave PB3, High Sierra 10.13.6) you cannot have both working correctly! I’ll show you how it is done both ways.
The best settings for Final Cut:
Use the DSDT I’ve added with the respective AMD settings for the RX560 or modify them for your graphics card.
Use SMBIOS for iMac17,1 (14,2 does work but picture over DP port is ugly, iMac 18,1/2/3 do not work) in Clover.
Have AppleIntelKBLGraphicsFramebufferInjector_3e9x.kextin your Clover/kexts/Other folder.
Until Mojave PB2 (may work on High Sierra 10.13.6):
Fake-ID 3E928086 plus ig-platform-id 59120003
These are the correct setting when installing Mojave (usually you will start with PB1 as the full installer).
For Mojave PB3 and higher:
Fake-ID 59128086 plus ig-platform-id 59120003
After upgrading to PB3 you will get a black screen with 3E92 fake id because PB3 introduces Coffee Lake kexts and macOS will use these kexts instead but that doesn’t work with our ig-platform-id. So you can download the update to PB3 but before installing it you’ll need to change the fake-id to a usual Kaby Lake id. While this didn’t work in High Sierra and the first two Mojave betas (meaning you didn’t get full hardware encoding) it is now magically working with PB3. It is safe to remove AppleIntelKBLGraphicsFramebufferInjector_3e9x.kext after upgrading to PB3.
The best setting for iTunes and why it is the worstfor Final Cut:
Just do the same thing as for FinalCut, put Shiki.kext into your Clover/kexts/other folder and add -shikigva boot argument. You can use -shikigva=1 or 2 or 12 it will work either way. Now you can watch movies with iTunes, yay! But it has some sideeffects. You cannot use this setting when seriously editing with Final Cut.
While this works by tricking macOS to use the IntelGraphics to play protected video content, it doesn’t seem to be the way real Macs are doing this. As soon as you open FinalCut you will notice (check this with iStats or HWMonitor) that the Intel graphics is not or only barely utilized, instead cpu usage skyrockets, indicating that slow software rendering is used instead of hardware encoding through Intel graphics. To make it worse the Radeon still “thinks” there is an Intel graphics helping so it does not run at highest potential. You may never notice it when using HD material with 24 or 25p because it still fast enough for that. But 50p or 4k material will most likely cause stuttering. I was astonished when I had stutters while previewing my 50p material, impossible to watch it. Thinking: What is wrong? I have a freaking i7 8700 plus RX560! Even my old hackbook with HD4000 is doing better!
Wifi and Bluetooth
I swapped the Intel Wifi card that was coming with the mainboard plugged into the onboard M.2 port with a compatible Dell card. The DW1830 or BCM943602BAED. The wifi part runs out of the box, but if you want the card to appear as Apple AirportExtreme and set the country code according to your country you need to put FakePCIID_Broadcom_WiFi.kext into Clover/kexts/other and add some Clover kext-to-patches by PMHeart.
Find: 75166644 3BA3581A 0000750C 4183FE04 7406
Replace: 66906644 3BA3581A 00006690 4183FE04 6690
Comment: AirPortBrcmNIC - PCIe in 10.13.x
Find: 4183FCFF 7435488D 55D0
Replace: 66C70644 45EB348D 55D0 (*this is for DE country code, change for your need)
Comment: BCM4352-Country Code
Bluetooth will work thanks to Rehabman’s kexts. You’ll need BrcmPatchRAM2.kext and BrcmFirmwareData.kext OR BrcmFirmwareRepo.kext. The Data.kext can be injected through Clover, just throw it into the kexts/other folder, the Repo.kext has to be installed in /Library/Extensions on your mac drive, it won’t work with Clover. I had issues with the Data.kext, Bluetooth was gone on every second or third reboot. The Repo.kext is more reliable, haven’t had any issues yet. I really don’t like the kexts to be installed in my system but I guess I have to live with it for the time being.
Oh, handoff and continuity don’t work, doesn’t matter that system profiler shows them as enabled. At least it works in one way: the mac can handoff Safari pages to my iPhone, but not the other way around. Documents opened on my phone show up in the dock, but they are not loaded.
This issue is around since at least High Sierra and from what I’ve read Rehabman is not going to fix this, because he founds this features not worth it. I have to disagree, these are very convenient and valuable features if you work with desktop, laptop and tablet in different situations, I miss this capability very much!
Audio works with Lilu.kext plus AppleALC.kext and you need to inject Layout ID=1 in Clover. For Mojave use the boot setting -lilubetaall to force the kexts to load. If you like to have DP or HDMI audio add a HDAU device to your dsdt (see mine for reference).
Credits go to this great community! I hope I mentioned everyone in this guide whose insights made this hack possible. If I have forgotten someone please let me know!