Contribute
Register

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

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.
 
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.
 
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.
 
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.
 
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!
 
@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:
 
This also fixes the Dell 5285 tablet with the 7600u and HD620 graphics on High Sierra. Thanks!
 
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?
 
Back
Top