Contribute
Register

[Solved]: Black Screen with GTX 1070, LG Ultrafine 5k, Sierra 10.12.4

Joined
Nov 18, 2013
Messages
70
Motherboard
Asrock x299 Designer+
CPU
i9-7900x
Graphics
zotac gtx1080 TI
Mac
  1. iMac
  2. MacBook
  3. MacBook Pro
  4. Mac mini
  5. Mac Pro
I meant the clover boot log which is saved by clover to the clover misc folder in the EFI partition.


I meant nv_spanmodepolicy=1


That might explain why Nvidia works with the Dell 5K but not other 5K displays...


Apple has some documentation for debugging kexts using two machine debugging over ethernet or firewire.


Maybe that Dell code is not meant for other 5K displays. Or maybe it is...
EDID inject might not work if the injection is not used everywhere.
kextpatch might not work if you don't get all the 0x40B6 and 0xac10 occurrences.


hmm. EDID injected and patched the ResmonWeb.kext . The monitor still stay black
I believe I found all the 0x40B6 and 0xac10 occurrences, and patched them.



Patch:



00000000002ac2d0 3DB6400000 cmp eax, 0x40b6. -> 3D115b0000 cmp eax, 0x5b11
00000000002ab96c 3B05622F3300 cmp eax, dword [_kmod_info+81180] 31C090909090
00000000002ac2bd 3D10AC0000 cmp eax, 0xac10 -> xor eax,eax, 31C0909090
00000000002ac38b 66C7440B02B640 mov word [rbx+rcx+2], 0x40b6 -> 66C7440B02115b mov word [rbx+rcx+2], 0x5b11
00000000002ac3d2 81FFB6400000 cmp edi, 0x40b6 -> 81FF115b0000 cmp edi, 0x5b11


.. really run out of idea...
So strange! why so hard?
 
Joined
Nov 18, 2013
Messages
70
Motherboard
Asrock x299 Designer+
CPU
i9-7900x
Graphics
zotac gtx1080 TI
Mac
  1. iMac
  2. MacBook
  3. MacBook Pro
  4. Mac mini
  5. Mac Pro
I meant the clover boot log which is saved by clover to the clover misc folder in the EFI partition.


I meant nv_spanmodepolicy=1


That might explain why Nvidia works with the Dell 5K but not other 5K displays...


Apple has some documentation for debugging kexts using two machine debugging over ethernet or firewire.


Maybe that Dell code is not meant for other 5K displays. Or maybe it is...
EDID inject might not work if the injection is not used everywhere.
kextpatch might not work if you don't get all the 0x40B6 and 0xac10 occurrences.


I got the screen shown up occasionally, sometime I can get fully 5k Display with dual DP to the TB3 AIC, I think I am getting closer to the final success.
ALL I did:
1. plug and pull the DP cable instead of TB3 cable.
2. Using the SwitchResX to set a lower resolution when I using only one cable.
3. Patch the ResmanWeb.kext replace all 10ac b640 to LG's Vendor and productid
4. Install CoreDisplayFixup.kext.
5. Using Alpha R. piker patch for NvidiaGraphicsFixup.kext, and disable the audio patch .
6. boot with other Display and unplug the LG Ultrafine , do step 1 when I entered the Desktop , Open the About->Monitors.
try 1-6 get it work sometime, but not stable, I am try to read the resmanweb.kext for a stable solution.
 
Joined
Apr 5, 2016
Messages
908
Motherboard
GIGABYTE Z170X-Gaming 7
CPU
i7-6700K
Graphics
GTX TITAN X
Mac
  1. iMac
  2. MacBook
  3. MacBook Air
  4. MacBook Pro
  5. Mac mini
  6. Mac Pro
Classic Mac
  1. Apple
  2. LC
  3. Power Mac
Mobile Phone
  1. iOS
1. plug and pull the DP cable instead of TB3 cable.

This is a good idea. It
resets the DisplayPort path without affecting the PCIe tunneling. That means the USB stuff should continue to work if it was working?

Reseting the DisplayPorts is required for the Dell 5K in macOS. Unplugging the cables works but it's easier to turn off the display, wait a few seconds, then turn it on to get 5K. So a similar thing would work for the LG if the Nvidia thinks it's a Dell (assuming Nvidia doesn't do what's required for 5K displays that are not the Dell). The LG doesn't have a power button, so disconnecting the DisplayPort cables is the only thing you can do.
 
Joined
Nov 18, 2013
Messages
70
Motherboard
Asrock x299 Designer+
CPU
i9-7900x
Graphics
zotac gtx1080 TI
Mac
  1. iMac
  2. MacBook
  3. MacBook Pro
  4. Mac mini
  5. Mac Pro

This is a good idea. It
resets the DisplayPort path without affecting the PCIe tunneling. That means the USB stuff should continue to work if it was working?

Reseting the DisplayPorts is required for the Dell 5K in macOS. Unplugging the cables works but it's easier to turn off the display, wait a few seconds, then turn it on to get 5K. So a similar thing would work for the LG if the Nvidia thinks it's a Dell (assuming Nvidia doesn't do what's required for 5K displays that are not the Dell). The LG doesn't have a power button, so disconnecting the DisplayPort cables is the only thing you can do.

Yes, the audio and brightness adaptor take no effect, only the screen takes.
I almost understand the DELL's special codes, it is for hot-plug-interrupt. call stack


NVDA::doHotplugInterruptService(OSObject*, IOInterruptEventSource*, int)
IOInterruptEventSource::interruptEventSource(OSObject*, void (*)(OSObject*, IOInterruptEventSource*, int), IOService*, int)
NVDA::doDriverIO(unsigned int, void*, unsigned int, unsigned int)


codes base logic should be:


if( _NvRmControl( 0x730241) !=0 )
{

if(nv_spanmodepolicy==1 && isdellup2715k())
{
while(int i=0i < (_NvRmControl(0x730122,x,y,z)==0x66)
iosleep(x);

bool is_ok = check_if_has_two_display_with_dell_product_id();

if(is_ok)
{
get_info_from_nvVGPUTable();
get_info_from_kmodinfo();

merge_two_display_info_into_one();
while(int i=0i < (_NvRmControl(0x730122,x,y,z)==0x66)
iosleep(x);

}

}
}

I think patching this place should not take othe side-effect.


the only problem is the signal seems not unstable, it just last a few seconds, then it go black.

Still figuring why ..
 
Joined
Apr 5, 2016
Messages
908
Motherboard
GIGABYTE Z170X-Gaming 7
CPU
i7-6700K
Graphics
GTX TITAN X
Mac
  1. iMac
  2. MacBook
  3. MacBook Air
  4. MacBook Pro
  5. Mac mini
  6. Mac Pro
Classic Mac
  1. Apple
  2. LC
  3. Power Mac
Mobile Phone
  1. iOS
Yes, the audio and brightness adaptor take no effect, only the screen takes.
I almost understand the DELL's special codes, it is for hot-plug-interrupt. call stack


Code:
 NVDA::doHotplugInterruptService(OSObject*, IOInterruptEventSource*, int)
   IOInterruptEventSource::interruptEventSource(OSObject*, void (*)(OSObject*, IOInterruptEventSource*, int), IOService*, int)
 NVDA::doDriverIO(unsigned int, void*, unsigned int, unsigned int)

codes base logic should be:

Code:
    if( _NvRmControl( 0x730241) !=0 )
    {

        if(nv_spanmodepolicy==1 && isdellup2715k())
        {
            while(int i=0i < (_NvRmControl(0x730122,x,y,z)==0x66)
                iosleep(x);

            bool is_ok = check_if_has_two_display_with_dell_product_id();

            if(is_ok)
            {
                    get_info_from_nvVGPUTable();
                    get_info_from_kmodinfo();

                    merge_two_display_info_into_one();
                    while(int i=0i < (_NvRmControl(0x730122,x,y,z)==0x66)
                        iosleep(x);

            }

        }
    }

I think patching this place should not take othe side-effect.


the only problem is the signal seems not unstable, it just last a few seconds, then it go black.

Still figuring why ..
Use [ code ] and [ /code ] tags to preserve code formatting in your posts to make it easier to read as I have done in the quote of your post.

If the signal is unstable, could it be because the display doesn't like the timing information? The timing information should come from its EDID but maybe the Nvidia driver doesn't like the EDID or is not using it correctly (the macOS Nvidia driver was probably only tested with Dell EDID and timings?).

The Dell and LG displays have .mtdd files in /System/Library/Displays/Contents/Resources/Overrides
I don't know if the contents of the overlay data has an effect on the Nvidia driver's handling of the displays.
The Dell display uses DisplayPort audio so the mtdd file also has an audio element. The LG displays uses USB audio.
The LG display has it's own icns file. And it has another file for EDID patches. I'm not sure what the LG's tiff file is for.
 
Joined
Nov 18, 2013
Messages
70
Motherboard
Asrock x299 Designer+
CPU
i9-7900x
Graphics
zotac gtx1080 TI
Mac
  1. iMac
  2. MacBook
  3. MacBook Pro
  4. Mac mini
  5. Mac Pro
Use [ code ] and [ /code ] tags to preserve code formatting in your posts to make it easier to read as I have done in the quote of your post.

If the signal is unstable, could it be because the display doesn't like the timing information? The timing information should come from its EDID but maybe the Nvidia driver doesn't like the EDID or is not using it correctly (the macOS Nvidia driver was probably only tested with Dell EDID and timings?).

The Dell and LG displays have .mtdd files in /System/Library/Displays/Contents/Resources/Overrides
I don't know if the contents of the overlay data has an effect on the Nvidia driver's handling of the displays.
The Dell display uses DisplayPort audio so the mtdd file also has an audio element. The LG displays uses USB audio.
The LG display has it's own icns file. And it has another file for EDID patches. I'm not sure what the LG's tiff file is for.

I think it's the timing problem Or driver bug, I found some boot argument from NvidiaResman.kext:

Code:
00000000002c5096         db         "nv_enableNoCpuBar1Mappings", 0             ; DATA XREF=sub_2aabc0+147

00000000002c50b1         db         "nv_AGDCPresenceDetectDelay", 0             ; DATA XREF=sub_2aabc0+193

00000000002c50cc         db         "nv_createDetailedTimingsFromEdid", 0       ; DATA XREF=sub_2aabc0+227

00000000002c50ed         db         "nv_spanmodepolicy", 0                      ; DATA XREF=sub_2aabc0+272

00000000002c50ff         db         "nv_disable_vrr", 0                         ; DATA XREF=sub_2aabc0+303

00000000002c510e         db         "nv_10bpcFormat", 0                         ; DATA XREF=sub_2aabc0+349

00000000002c511d         db         "nv_enablePresentmentOptions", 0            ; DATA XREF=sub_2aabc0+383

00000000002c5139         db         "nv_preserveEFIBootSurface", 0              ; DATA XREF=sub_2aabc0+418

00000000002c5153         db         "nv_disableAsyncGammaUpdate", 0             ; DATA XREF=sub_2aabc0+455

00000000002c516e         db         "nv_free_ndrv_surface", 0                   ; DATA XREF=sub_2aabc0+492

00000000002c5183         db         "nv_clear_ndrv_surface", 0                  ; DATA XREF=sub_2aabc0+529

00000000002c5199         db         "nv_update_gamma_in_base_channel", 0        ; DATA XREF=sub_2aabc0+566


I have tried to using the nv_createDetailedTimingsFromEdid , but still unstable.

There is a problem with current driver to calculate the pixel data, the windowsever, CoreDisplay complaint a Driver bug, then the LG display gone become black, dispear from monitor list panel. I think the driver maybe make some mistake deal with the LG Display's EDID, special for the pixcle format( like 10bit support?). It's very unstable , I have to hot-plug a dozen time to make it finally not blackscreen. Details:

Code:
complaint module: CoreDisplay
complaint function:
CGError description_for_mode_number(MPPriv *const, const int, const bool, const bool, CGSDisplayModeDescription *const):

Log:
2017-12-07 19:25:56.502977+0800 0x15d4 Default 0x0 709 0 LG Screen Manager: -[LMMAppDelegate setActiveDisplayList]======2

......
2017-12-07 19:26:31.345860+0800 0x744 Error 0x0 308 14 WindowServer: (CoreDisplay) [ERROR] - Driver bug - rowBytes too small. Display 0x1b568113, ioModeID 0x80005001, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 10240 stored width = 2560. Forcing minRowBytes (possibly still wrong).
2017-12-07 19:26:31.345885+0800 0x744 Error 0x0 308 14 WindowServer: (CoreDisplay) [ERROR] - Driver bug - rowBytes too small. Display 0x1b568113, ioModeID 0x80005001, ioModeDepth 0x0, bytePerRow = 32, width = 1, bitsPerPixel = 32, minRowBytes = 10240 stored width = 2560. Forcing minRowBytes (possibly still wrong).
...
2017-12-07 19:26:32.043044+0800 0x15d4 Default 0x0 709 0 LG Screen Manager: connectedMonitorCount----1 numberOfLGMonitors----0

Let me take a look at .mtdd files in /System/Library/Displays/Contents/Resources/Overrides
 
Last edited:
Joined
Nov 18, 2013
Messages
70
Motherboard
Asrock x299 Designer+
CPU
i9-7900x
Graphics
zotac gtx1080 TI
Mac
  1. iMac
  2. MacBook
  3. MacBook Pro
  4. Mac mini
  5. Mac Pro
Use [ code ] and [ /code ] tags to preserve code formatting in your posts to make it easier to read as I have done in the quote of your post.

If the signal is unstable, could it be because the display doesn't like the timing information? The timing information should come from its EDID but maybe the Nvidia driver doesn't like the EDID or is not using it correctly (the macOS Nvidia driver was probably only tested with Dell EDID and timings?).

The Dell and LG displays have .mtdd files in /System/Library/Displays/Contents/Resources/Overrides
I don't know if the contents of the overlay data has an effect on the Nvidia driver's handling of the displays.
The Dell display uses DisplayPort audio so the mtdd file also has an audio element. The LG displays uses USB audio.
The LG display has it's own icns file. And it has another file for EDID patches. I'm not sure what the LG's tiff file is for.
Code:
 ls /System/Library/Displays/Contents/Resources/Overrides/DisplayVendorID-1e6d
DisplayProductID-5b10      DisplayProductID-5b11      DisplayProductID-5b11.tiff DisplayProductID-76e6
DisplayProductID-5b10.icns DisplayProductID-5b11.icns DisplayProductID-76d8      DisplayProductID-76e7
DisplayProductID-5b10.tiff DisplayProductID-5b11.mtdd DisplayProductID-76db


5b11 is the LG ultra fine 5k, the tiff is for the About->Display's panel.

hmmm, there is a EDID patch for this Monitor, I think Nvidia has no idea about it :


Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>DisplayHasHardwareBrightnessSmoothing</key>
    <real>1</real>
    <key>DisplayPort</key>
    <dict>
        <key>PowerValue</key>
        <integer>5</integer>
    </dict>
    <key>DisplayProductID</key>
    <integer>23313</integer>
    <key>DisplayVendorID</key>
    <integer>7789</integer>
    <key>edid-patches</key>
    <array>
        <dict>
            <key>data</key>
            <data>
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAA==
            </data>
            <key>offset</key>
            <integer>261</integer>
        </dict>
        <dict>
            <key>data</key>
            <data>
            cg==
            </data>
            <key>offset</key>
            <integer>382</integer>
        </dict>
    </array>
    <key>target-default-ppmm</key>
    <real>8.5329999999999995</real>
</dict>
</plist>

mtdd:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>display</key>
    <dict>
        <key>backendtiming</key>
        <string>2560x2880@60</string>
        <key>frontendtiming</key>
        <string>5120x2880@60</string>
        <key>linkmode</key>
        <string>multi-cable</string>
        <key>overlay</key>
        <data>
        AP///////wAebRFbAAAAAAAAAQS1PCJ4IAAAAAAAAAAAAAAAAAABAQEBAQEB
        AQEBAQEBAQEBAAAAEAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAA
        AAAA/ABMRyBVbHRyYUZpbmUKAAAAEAAAAAAAAAAAAAAAAAAAAdtwEnkAAAMA
        FIBuAYT/E58AL4AfAD8LUQACAAQAKQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACSkA==
        </data>
        <key>streamcount</key>
        <integer>2</integer>
        <key>tileinfo</key>
        <string>(2,1)</string>
    </dict>
    <key>productid</key>
    <string>0x5b11</string>
    <key>serial</key>
    <integer>1</integer>
    <key>vendorid</key>
    <string>0x1e6d</string>
    <key>version</key>
    <string>1.3</string>
</dict>
</plist>
 
Last edited:
Joined
Apr 5, 2016
Messages
908
Motherboard
GIGABYTE Z170X-Gaming 7
CPU
i7-6700K
Graphics
GTX TITAN X
Mac
  1. iMac
  2. MacBook
  3. MacBook Air
  4. MacBook Pro
  5. Mac mini
  6. Mac Pro
Classic Mac
  1. Apple
  2. LC
  3. Power Mac
Mobile Phone
  1. iOS
The overlay data in the mtdd is also an EDID. It's smaller than the overlay EDID of the Dell's mtdd. The overlay EDID is also different than the normal EDID. I think SwitchResX doesn't show the patched EDID? You need a program that can decode EDID 1.4 to determine the differences. I've used parse-edid and edid-decode but they are EDID 1.3. Maybe they've been updated? I haven't checked recently.

Is LG Screen Manager an app that you can uninstall? Maybe it's interfering somehow?
 
Joined
Nov 18, 2013
Messages
70
Motherboard
Asrock x299 Designer+
CPU
i9-7900x
Graphics
zotac gtx1080 TI
Mac
  1. iMac
  2. MacBook
  3. MacBook Pro
  4. Mac mini
  5. Mac Pro
The overlay data in the mtdd is also an EDID. It's smaller than the overlay EDID of the Dell's mtdd. The overlay EDID is also different than the normal EDID. I think SwitchResX doesn't show the patched EDID? You need a program that can decode EDID 1.4 to determine the differences. I've used parse-edid and edid-decode but they are EDID 1.3. Maybe they've been updated? I haven't checked recently.

Is LG Screen Manager an app that you can uninstall? Maybe it's interfering somehow?

I did uninstall it. Nothing changed.
 
Joined
Nov 18, 2013
Messages
70
Motherboard
Asrock x299 Designer+
CPU
i9-7900x
Graphics
zotac gtx1080 TI
Mac
  1. iMac
  2. MacBook
  3. MacBook Pro
  4. Mac mini
  5. Mac Pro
The overlay data in the mtdd is also an EDID. It's smaller than the overlay EDID of the Dell's mtdd. The overlay EDID is also different than the normal EDID. I think SwitchResX doesn't show the patched EDID? You need a program that can decode EDID 1.4 to determine the differences. I've used parse-edid and edid-decode but they are EDID 1.3. Maybe they've been updated? I haven't checked recently.

Is LG Screen Manager an app that you can uninstall? Maybe it's interfering somehow?

Here is my Patch, it can be patched in the clover kextspatch, anyone with LGULTRAFINE 5K + gtx1080/gtx1070 can give it a try? I am looking forward a different result.

Code:
NVDAResmanWeb  find: 3DB6400000     replace: 3D115B00000     // patch NVDAResmanWeb LGULTRAFINE 5K MST cmp        eax, 0x40b6
NVDAResmanWeb find: 3D10AC0000     replace: 3D1E6D0000      // patch NVDAResmanWeb LGULTRAFINE 5K  MST cmp        eax, 0xac10
NVDAResmanWeb find: 66C7440B02B640 replace: 66C7440B02115B  // patch NVDAResmanWeb LGULTRAFINE 5K MST  word [rbx+rcx+2], 0x40b6
NVDAResmanWeb find: 81FFB6400000   replace: 81FF115b0000    // patch NVDAResmanWeb LGULTRAFINE 5K MST  cmp        edi, 0x40b6
NVDAResmanWeb find: 10ACb640       replace: 1E6D115B        // patch NVDAResmanWeb LGULTRAFINE 5K  MST table head of 10ACb640
 
Top