Contribute
Register

[Guide] Intel Framebuffer patching using WhateverGreen

I can't guarantee it will work for you but these patches match what you were using previously.


It WORKS perfectly for both HDMI ports !
Thank you.

The thing I missed is the FB<->port mapping because the popup help of the FBPatcher app confused me.
In fact it seems that:
1) the rows of the table inside the connectors tab are mapped to the AppleIntelFramebuffer@X items from IOREG:
row1 (or row with array index 0) <-> AppleIntelFramebuffer@0
row2 (or row with array index 1) <->AppleIntelFramebuffer@1
row3 (or row with array index 2) <->AppleIntelFramebuffer@2

2) the index value (the first column in table) is the corresponding portY that you can read from connect/disconnect log
> log show --predicate "process =='kernel'" | grep -I plug
2018-11-21 10:16:18.446750+0100 0x5d2 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB1: Display unplugged from port3
2018-11-21 10:16:31.163186+0100 0x5d2 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Hot plug on port1
3) note that the portY above is different from the value of the port-number inside ioreg AppleIntelFramebuffer@ and the relation seems to be:
port1 <-> port-number=0x5
port2 <-> port-number=0x6
port3 <-> port-number=0x7

That said, my working patched config actually is:
FB0<->port2<-> port-number=0x6 (port2* is not present in my mobo however)
FB1<->port3<-> port-number=0x7 (HDMI UP)

FB2<->port1<-> port-number=0x5 (HDMI DOWN)

(*) Since port2 si not physically present in my mobo (but it was present in mobo of the original patch) I suspect that I can make a cleaner patch for my Gigabyte B360N WIFI probably by using only 2 FB (FB port limit option?) or by setting the type of the actual FB0 to something like ZERO, DUMMY, LVDS.... but for now it works.

Many thanks headkaze!

(EDIT)
PS: the log still shows some errors related to CFLFramebuffer:
> log show --predicate "process =='kernel'" | grep -I AppleIntelCFLGraphicsFramebuffer


2018-11-21 10:16:18.446750+0100 0x5d2 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB1: Display unplugged from port3

2018-11-21 10:16:18.702351+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][WARNING] fb0 : DP-EDID set offset failed: 0xe00002d6

2018-11-21 10:16:19.376265+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB1: Disabling display

2018-11-21 10:16:19.376270+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB1 Conection status change: Connected --> Disconnected

2018-11-21 10:16:31.163186+0100 0x5d2 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Hot plug on port1

2018-11-21 10:16:32.043160+0100 0x78b Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][WARNING] fb2 : DP-EDID set offset failed: 0xe00002d6

2018-11-21 10:16:32.120239+0100 0x78b Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][WARNING] fb2 : DP-EDID set offset failed: 0xe00002d6

2018-11-21 10:16:32.566152+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][WARNING] fb0 : DP-EDID set offset failed: 0xe00002d6

2018-11-21 10:16:33.261051+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2 Conection status change: Disconnected --> Connected

2018-11-21 10:16:33.263253+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Blanking out the screen without black gamma

2018-11-21 10:16:33.384102+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Setting display mode 1920 x 1200 -> 0 x 0 encoded with 0x1 2 bpc with color 1 and range 1

2018-11-21 10:16:33.384109+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Complete modeset

2018-11-21 10:16:33.451686+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Blanking out the screen without black gamma

2018-11-21 10:16:33.453156+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Setting display mode 1920 x 1200 -> 0 x 0 encoded with 0x1 2 bpc with color 1 and range 1

2018-11-21 10:16:33.468604+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Partial modeset

2018-11-21 10:16:33.535752+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Blanking out the screen without black gamma

2018-11-21 10:16:34.001159+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Setting display mode 1920 x 1200 -> 0 x 0 encoded with 0x1 2 bpc with color 1 and range 1

2018-11-21 10:16:34.006538+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Panel Fitter modeset

2018-11-21 10:16:34.073731+0100 0x520 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Blanking out the screen without black gamma

2018-11-21 10:16:35.111940+0100 0x6bc Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Flipping display with wsaa 1 flipped from 1920 x 1200 -> 1920 x 1200 on 46fbe000 with 5 options at stride 7680

2018-11-21 10:16:35.133099+0100 0x6bc Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Flipping display with wsaa 1 flipped from 1920 x 1200 -> 1920 x 1200 on 47888000 with 1 options at stride 7680

2018-11-21 10:16:35.166495+0100 0x6bc Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Blanking out the screen without black gamma

2018-11-21 10:16:35.418949+0100 0x6bc Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Flipping display with wsaa 1 flipped from 1920 x 1200 -> 1920 x 1200 on 48a1c000 with 801 options at stride 7680

2018-11-21 10:16:35.435515+0100 0x6bc Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][INFO ] FB2: Flipping display with wsaa 1 flipped from 1920 x 1200 -> 1920 x 1200 on 492e6000 with 1 options at stride 7680

2018-11-21 10:16:37.801576+0100 0x1992 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][ERROR ] kHDCP1_I2C_BKSV read failed

2018-11-21 10:16:37.801578+0100 0x1992 Default 0x0 0 0 kernel: (AppleIntelCFLGraphicsFramebuffer) [IGFB][ERROR ] ReadBksv failed
 
Last edited:
hi
It really depends on what specific native device you have, and which problem in particular you're trying to fix.
hi, would you like to add me (git user: aerror2) as
Collaborators for
https://github.com/acidanthera/WhateverGreen.git

I want to commit the edid override pathing codes for intelframebuffer. I have change them configable . use
edid-override
edid-override-index

in devices/properties/pcixxx


I think it will help some people with the same problem
 
I have proved that I am right . I have written a patch for reading EDID when frambuffer starting up. And it works perfectly!

Pathed Whatevergreen Kext is attached.
Code:
...


if(true)

{

KernelPatcher::RouteRequest request("__ZN21AppleIntelFramebuffer20checkForEDIDOverrideEjPh", WrappCheckForEDIDOverride, OrgCheckForEDIDOverride);

patcher.routeMultiple(index, &request, 1, address, size);

}


....


int IGFX::WrappCheckForEDIDOverride(IOService *that, unsigned int x, unsigned char* buff)

{




int fbindex = *(int *)((char*)that +0x1dc);




DBGLOG("igfx", "WrappCheckForEDIDOverride called for fb%d %p  !", fbindex, that);



int ret=0;



if(callbackIGFX->OrgCheckForEDIDOverride)

{

ret =  FunctionCast(WrappCheckForEDIDOverride, callbackIGFX->OrgCheckForEDIDOverride) (that,x, buff);

}



if(fbindex==2)

{

static unsigned char edid []= { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0xAC, 0x72, 0x40, 0x4C, 0x51, 0x34, 0x42, 0x32, 0x16, 0x01, 0x03, 0x80, 0x33, 0x1D, 0x78, 0xEA, 0xDD, 0x45, 0xA3, 0x55, 0x4F, 0xA0, 0x27, 0x12, 0x50, 0x54, 0xA5, 0x4B, 0x00, 0x71, 0x4F, 0x81, 0x80, 0xD1, 0xC0, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, 0x45, 0x00, 0xFE, 0x1F, 0x11, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x58, 0x46, 0x59, 0x4E, 0x36, 0x32, 0x43, 0x46, 0x42, 0x34, 0x51, 0x4C, 0x0A, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x44, 0x45, 0x4C, 0x4C, 0x20, 0x55, 0x32, 0x33, 0x31, 0x32, 0x48, 0x4D, 0x0A, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x38, 0x4C, 0x1E, 0x53, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0xBE };

for(int i=0;i<sizeof(edid);i++)

buff[i] = edid[i];

return 0;

}



return ret;

}

You should try injecting AAPLxx,override-no-connect with your custom EDID.
xx corresponds to the connector index.
eg. 00 for @0, 01 for @1, 02 for @2, etc.

A display override file at /System/Library/Displays/Contents/Resources/Overrides/ may be an even more appropriate way to provide a custom EDID for your monitor.
 
Last edited:
You should try injecting AAPLxx,override-no-connect with your custom EDID.
xx corresponds to the connector index.
eg. 00 for @0, 01, for @1, 02, for @2, etc.

A display override file at /System/Library/Displays/Contents/Resources/Overrides/ may be an even more appropriate way to provide a custom EDID for your monitor.


OH. Thank you.


I have lookup at the codes. I think you're very right! It initiate the _EDIDOverrides at the controller startup.

Hmm, where can I inject this properties into the device?

did you mean something like this in dsdt? like https://github.com/RehabMan/Laptop-DSDT-Patch/blob/master/graphics/graphics_EDID.txt ?


Code:
                    __ZN31AppleIntelFramebufferController26readEDIDOverridePropertiesEP9IOService:        // AppleIntelFramebufferController::readEDIDOverrideProperties(IOService*)

000000000002bc42         push       rbp                                         ; XREF=__ZN31AppleIntelFramebufferController5startEP9IOService+3703

000000000002bc43         mov        rbp, rsp

000000000002bc46         push       r15

000000000002bc48         push       r14

000000000002bc4a         push       r13

000000000002bc4c         push       r12

000000000002bc4e         push       rbx

000000000002bc4f         sub        rsp, 0x58

000000000002bc53         mov        r14, rsi

000000000002bc56         mov        rax, qword [ds:0xa20a0]                     ; 0xa20a0

000000000002bc5d         mov        rax, qword [ds:rax]

000000000002bc60         mov        qword [ss:rbp+var_30], rax

000000000002bc64         inc        qword [ds:0xb2538]                          ; 0xb2538

000000000002bc6b         mov        edi, 0x188

000000000002bc70         call       _IOMalloc

000000000002bc75         lea        rcx, qword [ds:_EDIDOverrides]              ; _EDIDOverrides

000000000002bc7c         mov        qword [ds:rcx], rax

000000000002bc7f         test       rax, rax

000000000002bc82         je         0x2c081



000000000002bc88         mov        esi, 0x188                                  ; argument "n" for method _bzero

000000000002bc8d         mov        rdi, rax                                    ; argument "s" for method _bzero

000000000002bc90         call       _bzero

000000000002bc95         mov        rax, qword [ds:0xa2040]                     ; 0xa2040

000000000002bc9c         mov        rax, qword [ds:rax]

000000000002bc9f         mov        qword [ss:rbp+var_78], rax

000000000002bca3         xor        r13d, r13d

000000000002bca6         xor        r12d, r12d



000000000002bca9         inc        qword [ds:0xb2548]                          ; 0xb2548, XREF=__ZN31AppleIntelFramebufferController26readEDIDOverridePropertiesEP9IOService+1021

000000000002bcb0         mov        esi, 0x40                                   ; argument "size" for method _snprintf

000000000002bcb5         xor        eax, eax

000000000002bcb7         lea        rbx, qword [ss:rbp+var_70]

000000000002bcbb         mov        rdi, rbx                                    ; argument "str" for method _snprintf

000000000002bcbe         lea        rdx, qword [ds:0x8ac23]                     ; "AAPL0%d,override-no-connect", argument "format" for method _snprintf

000000000002bcc5         mov        ecx, r13d

000000000002bcc8         call       _snprintf

000000000002bccd         mov        rax, qword [ds:r14]

000000000002bcd0         mov        rdi, r14

000000000002bcd3         mov        rsi, rbx
 
OH. Thank you.


I have lookup at the codes. I think you're very right! It initiate the _EDIDOverrides at the controller startup.

Hmm, where can I inject this properties into the device?

did you mean something like this in dsdt? like https://github.com/RehabMan/Laptop-DSDT-Patch/blob/master/graphics/graphics_EDID.txt ?


Code:
                    __ZN31AppleIntelFramebufferController26readEDIDOverridePropertiesEP9IOService:        // AppleIntelFramebufferController::readEDIDOverrideProperties(IOService*)

000000000002bc42         push       rbp                                         ; XREF=__ZN31AppleIntelFramebufferController5startEP9IOService+3703

000000000002bc43         mov        rbp, rsp

000000000002bc46         push       r15

000000000002bc48         push       r14

000000000002bc4a         push       r13

000000000002bc4c         push       r12

000000000002bc4e         push       rbx

000000000002bc4f         sub        rsp, 0x58

000000000002bc53         mov        r14, rsi

000000000002bc56         mov        rax, qword [ds:0xa20a0]                     ; 0xa20a0

000000000002bc5d         mov        rax, qword [ds:rax]

000000000002bc60         mov        qword [ss:rbp+var_30], rax

000000000002bc64         inc        qword [ds:0xb2538]                          ; 0xb2538

000000000002bc6b         mov        edi, 0x188

000000000002bc70         call       _IOMalloc

000000000002bc75         lea        rcx, qword [ds:_EDIDOverrides]              ; _EDIDOverrides

000000000002bc7c         mov        qword [ds:rcx], rax

000000000002bc7f         test       rax, rax

000000000002bc82         je         0x2c081



000000000002bc88         mov        esi, 0x188                                  ; argument "n" for method _bzero

000000000002bc8d         mov        rdi, rax                                    ; argument "s" for method _bzero

000000000002bc90         call       _bzero

000000000002bc95         mov        rax, qword [ds:0xa2040]                     ; 0xa2040

000000000002bc9c         mov        rax, qword [ds:rax]

000000000002bc9f         mov        qword [ss:rbp+var_78], rax

000000000002bca3         xor        r13d, r13d

000000000002bca6         xor        r12d, r12d



000000000002bca9         inc        qword [ds:0xb2548]                          ; 0xb2548, XREF=__ZN31AppleIntelFramebufferController26readEDIDOverridePropertiesEP9IOService+1021

000000000002bcb0         mov        esi, 0x40                                   ; argument "size" for method _snprintf

000000000002bcb5         xor        eax, eax

000000000002bcb7         lea        rbx, qword [ss:rbp+var_70]

000000000002bcbb         mov        rdi, rbx                                    ; argument "str" for method _snprintf

000000000002bcbe         lea        rdx, qword [ds:0x8ac23]                     ; "AAPL0%d,override-no-connect", argument "format" for method _snprintf

000000000002bcc5         mov        ecx, r13d

000000000002bcc8         call       _snprintf

000000000002bccd         mov        rax, qword [ds:r14]

000000000002bcd0         mov        rdi, r14

000000000002bcd3         mov        rsi, rbx

Property injection on IGPU with config.plist/Devices/Properties/PciRoot(0)/Pci(2,0)
 

That conversation was about a Asus Prime Z370-A.
I don't have a solution for the framebuffer issue on the Gigabyte B360N WiFi.
I suspect as of now it can be used properly only with discrete GPU. Acceleration works. it's the image that gets lost in Mojave and HS 17G3025
I wouldn't know how to fix it now.

And beside this, once I switched to 4k, I'm having issues on iGPU for my Gigabyte Z370N WiFi too.
Not acceleration issues but more subtle issues like if the monitor (that I switch between different computers) is not connected to the board when I wake the PC I get a black screen. I order to have the image back I need to wait another sleep cycle and then if the monitor is ready to receive the signal by waking the PC from sleep I get the image.
This happens in Display Port and HDMi.
Also the HDMi 2.0 port on this board flickers at 60Hz. This could be an issue related to monitor-board. While on 30Hz it doesn't show problems. Display Port works fine at 4k 60Hz.
Acceleration works great on this board. Wake from sleep is the issue.
 
Last edited:
@aerror could you please push your changes to GitHub?
Hmm I don't have the permission to push it .
I push source to myself git at : https://github.com/aerror2/WhateverGreen


edid-override //edid that you want to inject
edid-override-index //fb index you want to patch

in devices/properties/pcixxx

example:
edid-override <00FFFFFF FFFFFF00 10AC7240 4C513442 32160103 80331D78 EADD45A3 554FA027 125054A5 4B00714F 8180D1C0 01010101 01010101 0101023A 80187138 2D40582C 4500FE1F 1100001E 000000FF 00584659 4E363243 46423451 4C0A0000 00FC0044 454C4C20 55323331 32484D0A 000000FD 00384C1E 5311000A 20202020 202000BE>
edid-override-index <02000000>
 
Property injection on IGPU with config.plist/Devices/Properties/PciRoot(0)/Pci(2,0)
Thank you very much, RehabMan. It works! It do the same thing like my patching, so sorry to know that so late , so that i have to make my own patching method. :)
 
Last edited:
Thank you very much, RehabMan. It works! It do the same thing like my patching, so sorry to know that so late , so that i have to make my own patching method. :)

Yeah, that's what I figured... so the additions for WhateverGreen.kext you propose are not necessary.
 
Back
Top