Contribute
Register

[FIX] Coffee Lake Intel UHD Graphics 630 on macOS Mojave: Kernel panic due to divide-by-zero

Joined
Aug 4, 2018
Messages
30
Motherboard
Dell XPS 15 9570
CPU
i9-8950HK/CM246
Graphics
UHD 630/1050Ti, 3840x2160
Mac
MacBook Pro
Mobile Phone
iOS
It seems like the patch I’m using is similar to the alt patch that @Austere.J has. It is in the same line when you open the cflFramebuffer in hexfiend. I would imagine that they do similar functions but when I use the actual alt patch it’s no good, nor the the real patch. Right now I want to figure out what te patch does by translating it to readable code, but haven’t had any luck.
After testing the patch from @shenlinsl, I noticed graphics get choppy after the display turns off (not sleeping), unlike with the ALT patch which works.

Do you know if the max link rate reported by your display is 0? Or could the patch you're using do something else?

I'm actually trying to get HDMI out to work, which will probably depend on *not* applying this patch for HDMI output, but only the internal display, i.e. what the non-ALT patch is trying to accomplish but doesn't for some reason.
 
Joined
Aug 30, 2015
Messages
96
Motherboard
MSI B85m Gaming
CPU
i3-4170
Graphics
GTX 970
Mac
iMac, MacBook Pro
Classic Mac
iMac
Mobile Phone
iOS
After testing the patch from @shenlinsl, I noticed graphics get choppy after the display turns off (not sleeping), unlike with the ALT patch which works.

Do you know if the max link rate reported by your display is 0? Or could the patch you're using do something else?

I'm actually trying to get HDMI out to work, which will probably depend on *not* applying this patch for HDMI output, but only the internal display, i.e. what the non-ALT patch is trying to accomplish but doesn't for some reason.
Where do you check for the link rate? I have 0 clue right now as to what t does exactly, I want to disassemble the binary but no luck, only got assembly.
 
Joined
Aug 4, 2018
Messages
30
Motherboard
Dell XPS 15 9570
CPU
i9-8950HK/CM246
Graphics
UHD 630/1050Ti, 3840x2160
Mac
MacBook Pro
Mobile Phone
iOS
Where do you check for the link rate? I have 0 clue right now as to what t does exactly, I want to disassemble the binary but no luck, only got assembly.
See post #1 link to the "new long story", section on AGDCDiagnose. It's a long read, but explains what the original non-ALT and ALT patches do and how to check if the link rate being reported incorrectly by the display is the issue you're having.
 
Joined
Aug 30, 2015
Messages
96
Motherboard
MSI B85m Gaming
CPU
i3-4170
Graphics
GTX 970
Mac
iMac, MacBook Pro
Classic Mac
iMac
Mobile Phone
iOS
Joined
Aug 4, 2018
Messages
30
Motherboard
Dell XPS 15 9570
CPU
i9-8950HK/CM246
Graphics
UHD 630/1050Ti, 3840x2160
Mac
MacBook Pro
Mobile Phone
iOS
I attached a report here:https://www.tonymacx86.com/threads/black-screen-on-login.264213/post-1903117
I think it might have the link rate on it. Could you check it out?
As far as I understand (and I'm not a graphics expert by any means, so corrections are welcome), you're running into the same div-by-0 issue addressed in the ALT patch.

See report.txt:
...
## Register Dump Port 1 - Start ##
000000: 0x14 0x00 0xc4 0xc1 0x00 0x00 0x01 0xc0 0x02 0x00 0x00 0x00 0x00 0x0b 0x00 0x00
Reg: 000000: 14 : DPCD_REV: 1.4
Reg: 000001: 00 : MAX_LINK_RATE: ???
...

You're using the following patch in your config.plist (for CFL):
Find: <48ff0589 4d07008b 96c02500 008a8e95>
Replace: <b8040000 008986bc 25000031 c05dc395>
Name: AppleIntelCFLGraphicsFramebuffer

Now I don't know what this patch does, but you could disassemble AppleIntelCFLGraphicsFramebuffer located here:
/System/Library/Extensions/AppleIntelCFLGraphicsFramebuffer.kext/Contents/MacOS/AppleIntelCFLGraphicsFramebuffer

I'm using the free version of IDA, which can also show you the instructions you get after patching.

As far as I can tell, the ALT patch does this:
C:
if (max_link_rate == 0)
    max_link_rate = 0x14 // see last byte of replace string in patch
You'll have to change the last byte in the patch for the correct MAX_LINK_RATE - either 0x14 or 0x0a, but for your 3000x2000 screen I'm guessing 0x14.

What happens when you apply the ALT patch with 0x14 (HBR2) for AppleIntelCFLGraphicsFramebuffer (you mention it's no good, but I don't know what that means)?

Do you still get a div-by-0 KP? If you can boot with the patch, what's the new output of AGDCDiagnose? MAX_LINK_RATE should become whatever you patched it to be, instead of 0x00.
 
Joined
Apr 9, 2015
Messages
57
Motherboard
OS X 10.10.3
CPU
i7-4790K
Graphics
GTX970
Mac
Classic Mac
Mobile Phone
All binary patches for this issue are going to be deprecated.

I have implemented a fix in WhateverGreen. Waiting for the PR being merged to the main repo.

If you want to be the early bird and try the new fix, take a look at https://github.com/0xFireWolf/WhateverGreen.

And here is the manual: https://github.com/0xFireWolf/WhateverGreen/blob/master/Manual/FAQ.IntelHD.en.md#fix-the-invalid-maximum-link-rate-issue-on-some-laptops-dell-xps-15-9570-etc

Once the merge is done, I will update the main post.

: )

- FireWolf
 
Joined
Aug 4, 2018
Messages
30
Motherboard
Dell XPS 15 9570
CPU
i9-8950HK/CM246
Graphics
UHD 630/1050Ti, 3840x2160
Mac
MacBook Pro
Mobile Phone
iOS
I have implemented a fix in WhateverGreen. Waiting for the PR being merged to the main repo.
I added a PR to your repo, since the enable-dpcd-max-link-rate-fix option isn't read when set to 01000000. Same applies for dpcd-max-link-rate. The boot arg -igfxmlr works fine.

Thanks for adding this patch to WhateverGreen!
 
Joined
Sep 27, 2016
Messages
72
Motherboard
Dell Inspiron 7559-Clover
CPU
i7-6700HQ
Graphics
HD530, 960M, 3840x2160
Mac
iMac, MacBook Pro, Mac Pro
Mobile Phone
Android
@Austere.J You my friend are amazing! This patch has FINALLY made my Dell 7370 with a UHD620 have accelerated graphics! I have been fighting with this thing for almost a year now "on and off" and had all but gave up. Amazing work. Thank you so much for this :) :headbang:
 
Joined
Dec 3, 2011
Messages
337
Motherboard
HP Elite X2
CPU
i5-7600U
Graphics
HD 620 2736 x 1834
Mac
MacBook Pro, Mac Pro
Classic Mac
128K, 512K
Mobile Phone
iOS
This also fixes the Dell 5285 tablet with the 7600u and HD620 graphics on High Sierra. Thanks!
 
Joined
Feb 9, 2012
Messages
319
Motherboard
Razer Blade Stealth
CPU
i7-8565U
Graphics
UHD 620, 1920 x 1080
Mac
iMac, MacBook Pro
Mobile Phone
iOS
thank you for this boot flag working well for my laptop as well. But I have some issue with Wakeup. It goes black screen from wakeup. I can still control backlight and audio that means my wake function is working but only screen is not showing up. Do you guys have any issue like this?
 
Top