Contribute
Register

[SOLVED + GUIDE] Workaround for -cdfon?

Status
Not open for further replies.
@fred99

I got a solution now. As I want to help out as many people facing this issue as possible, I will try to explain how this works in more detail, and I've wrote a script which helps you to patch your EDID.

First things first: Big thanks to @thefiredragon, who posted *here* and thus got the concept of how EDID patching works into my head.

What is EDID? EDID stands for "Extended Display Identification Data", and is basically a 128 byte long pack of information the monitor will send to the GPU, in order to negotiate resolution, refresh-rate, and many more things. You can read up on it here, if you're interested: https://en.wikipedia.org/wiki/Extended_Display_Identification_Data

To make the 4K screen work, we need to change the standard refresh-rate of 60Hz (or more, who knows what people got these days) to 48Hz. Don't ask me why, I don't know how that fixes this issue at the moment, but hey - it works. This value consists of a few bits within the 128 bytes, which need hotpatching.

I would go about it the following way:

Step 1:
* Download Manjaro KDE Plasma: https://manjaro.org/downloads/official/kde/
* Make a bootable USB, I used balena-etcher for this: https://www.balena.io/etcher/
* Boot from it

Step 2:
WARNING: You should disconnect external monitors from your laptop at this point, to make your life easier.

Now, we want to get the output of 'xrandr --props' into a file, preferredly into a file on the built-in drive's EFI partition for easy access later on.

Code:
[manjaro /]# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0  20.8M  1 loop /run/miso/sfs/livefs
loop1         7:1    0 570.1M  1 loop /run/miso/sfs/mhwdfs
loop2         7:2    0   1.6G  1 loop /run/miso/sfs/desktopfs
loop3         7:3    0 630.2M  1 loop /run/miso/sfs/rootfs
sda           8:0    1 119.3G  0 disk /run/miso/bootmnt
├─sda1        8:1    1   2.9G  0 part
└─sda2        8:2    1     4M  0 part
nvme0n1     259:0    0   1.8T  0 disk
├─nvme0n1p1 259:1    0   200M  0 part
├─nvme0n1p2 259:2    0 931.4G  0 part
└─nvme0n1p3 259:3    0 931.4G  0 part
[manjaro /]# mount /dev/nvme0n1p1 /mnt
[manjaro /]# cd /mnt
[manjaro mnt]# xrandr --props > display_info.txt
[manjaro mnt]# cd ..
[manjaro /]# umount /dev/nvme0n1p1

I just mounted the EFI of my NVME drive to /mnt, wrote the output into display_info.txt and unmounted again. BTW, I went for a root-terminal here. Just did a sudo /bin/bash, this makes your life easier.

You can transfer it back to OSX however you like to tho. The only important thing is that you get the full output of 'xrandr --props' into a single file with the name 'display_info.txt'.

Step 3:
* Copy my python-script into a file 'patcher.py', just put it on your desktop for now
Python:
import re
import sys

def patch_edid(value):
    # Set refresh rate to 48Hz
    # EDID structure: https://en.wikipedia.org/wiki/Extended_Display_Identification_Data
    edid = value[:108] + 'a6a6' + value[112:]
 
    # Recalculate checksum after change
    data = [int(edid[i:i + 2], 16) for i in range(0, len(edid), 2)]
    checksum = hex(256 - sum(data[:-1]) % 256)[2:]
 
    # Return value with new checksum
    return edid[:-2] + checksum

# Open input file
with open('display_info.txt', 'r') as inp_file:
 
    # Constants needed for processing
    begin_marker = 'EDID:' # xrandr starts of EDIDs like this
    edid_bytelen = 128 # There are 128 bytes within an EDID
    edid_hexlen = edid_bytelen * 2
 
    # Read all file lines
    # Strip \t, \n and spaces, since they're not needed for parsing
    lines = list(map(lambda x: re.sub(r'[\t\n ]', '', x), inp_file.readlines()))
 
    # Now concat the whole content into one single string
    info = ''.join(lines)
 
    # Create a list of EDID occurrences
    occurrences = []
 
    # Search all occurrence-indices of EDID beginnings
    occ_index = info.find(begin_marker)
    while occ_index != -1:
        # Substring without the begin-marker
        substr_index = occ_index + len(begin_marker)
        occurrences.append(info[substr_index:substr_index + edid_hexlen].upper())
     
        # Try to find another occurrence
        occ_index = info.find(begin_marker, occ_index + 1)
 
    # No EDIDs available
    if len(occurrences) == 0:
        print('Could not find any EDIDs, please check your input!')
        sys.exit()
 
    # Multiple EDIDs found, prompt for desired one
    desired_index = 0
    if len(occurrences) > 1:
        print('There are multiple EDIDs available, please choose one:')
     
        c = 0
        for edid in occurrences:
            print(f'[{c}]: {edid[0:30]}...{edid[edid_hexlen - 30:edid_hexlen]}')
            c += 1
     
        desired_index = int(input('Your selection: '))
        print()
 
    # This will now be the target EDID
    target_edid = occurrences[desired_index]
 
    # Patch the value
    patched_edid = patch_edid(target_edid)
 
    # Print patch-instructions
    print('Patched your EDID!')
    print('Please add it to DeviceProperties/Add/PciRoot(0x0)/Pci(0x2,0x0) like this:')
    print('Create a new entry: AAPL00,override-no-connect (with type data)')
    print('And set the value to:\n')
    print(patched_edid.upper())

* Now, make sure your previously created 'display_info.txt' is at the same location as this script - so on your desktop too.

Step 4:
* Run patcher.py with python from the terminal, for example: 'python3.8 patcher.py', depending on your version tho. Just tab the command like this: 'python<tab>'.

* You will get something like this:
Code:
Patched your EDID!
Please add it to DeviceProperties/Add/PciRoot(0x0)/Pci(0x2,0x0) like this:
Create a new entry: AAPL00,override-no-connect (with type data)
And set the value to:

00FFFFFFFFFFFF0006AFEB3100000000101B0104A522137802CEB5A65434B6250E505400000001010101010101010101010101010101A6A600A0F0703E803020350058C110000018000000000000000000000000000000000018000000FE0041554F0A202020202020202020000000FE00423135365A414E30332E31200A00BD

If you get a prompt where you need to choose between different EDIDs, you have multiple monitors connected. Disconnect them or just have a look at the options and find the one corresponding to your monitor (have a look into the display_info.txt and search for familiar names/values). This should almost never happen tho, I built the picker into the script just to make sure.

* Follow the instructions printed. Go to your config.plist and make this entry. Reboot - and you should be good to see the screen of your BigSur installer or already installed disk! Hoping to see a new release of WhateverGreen soon, so we can discard this hack again.

Happy to answer any questions, hope this helps!

I also created a repo for it:
finally I tried your guide, anyway my edid shown in hackintool was right, so I used that, I deleted a part of your code and I pasted directly my edid. on macOS running the script gave me the right result.
 
i can boot catalina with patched edid and i can see refresh rate is lower. but i can't boot big sur. i still have to fake device-id to stop hardware acceleration. how could i change refresh rate to lower values? (44 hz)
 
@fred99

You shouldn't need to go below the already hardcoded stepped down refresh rate. Please attach your EFI so I can have a look and see if you're missing anything. Also, did you dump your untouched EDID? Grabbing it from macOS maybe results in troubles...
 
@fred99

You shouldn't need to go below the already hardcoded stepped down refresh rate. Please attach your EFI so I can have a look and see if you're missing anything. Also, did you dump your untouched EDID? Grabbing it from macOS maybe results in troubles...
Code:
LINUX

00FFFFFFFFFFFF004C83434100000000 191D0104B52213780238D1AE513BB823 0B505400000001010101010101010101 01010101010148D70040F17030803020 440058C21000001B48D70040F1703080 3020440058C21000001B0000000F00FF 093CFF093C2C80000000000000000010 00000100000000000000000000000150 02030F00E3058000E6060501736D0700 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 000000000000000000000000000000AB

HACKINTOOL

00FFFFFFFFFFFF004C83434100000000 191D0104B52213780238D1AE513BB823 0B505400000001010101010101010101 01010101010148D70040F17030803020 440058C21000001B48D70040F1703080 3020440058C21000001B0000000F00FF 093CFF093C2C80000000000000000010 00000100000000000000000000000150 02030F00E3058000E6060501736D0700 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 000000000000000000000000000000AB

PYTHON SCRIPT

00FFFFFFFFFFFF004C83434100000000 191D0104B52213780238D1AE513BB823 0B505400000001010101010101010101 010101010101A6A60040F17030803020 440058C21000001B48D70040F1703080 3020440058C21000001B0000000F00FF 093CFF093C2C80000000000000000010 00000100000000000000000000000150 02030F00E3058000E6060501736D0700 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 0000000000000000000000000000007E
 

Attachments

  • OC.zip
    29.2 MB · Views: 77
@fred99

Try enabling #enable-hdmi20, thus remove the #. Also, 9B3E is your valid device-id, not the faked one, right? Keep that, I am also using my platform-id as my device-id, just mirrored, like you do. Otherwise, I have no idea what's wrong there... My blade has the UDHD630 too, I could send you that EFI if you'd like to, think we even have the same platform-ids, IIRC.
 
I tried all the possible combination between enabling/disabling enable-hdmi20 and using right/wrong device-id but nothing helped.
I'd appreciate if you could share your efi, thanks for your help.
ps: I've just discovered that edid on windows is different, so I'll try to patch this one (this is shorter?pfff)

Code:
WINDOWS

00FFFFFFFFFFFF004C83434100000000 191D0104B52213780238D1AE513BB823 0B505400000001010101010101010101 01010101010148D70040F17030803020 440058C21000001B48D70040F1703080 3020440058C21000001B0000000F00FF 093CFF093C2C80000000000000000010 00000100000000000000000000000150
 
Last edited:
@fred99

You could try that one, but I don't think it's an EDID issue, tbh... :/. Attached my razer blade EFI, you can look around and check if you're missing anything IGPU related. Otherwise, I don't have any other ideas on how to go about this, sorry.
 

Attachments

  • RazerBlade_EFI.zip
    16.6 MB · Views: 76
@fred99

Try enabling #enable-hdmi20, thus remove the #. Also, 9B3E is your valid device-id, not the faked one, right? Keep that, I am also using my platform-id as my device-id, just mirrored, like you do. Otherwise, I have no idea what's wrong there... My blade has the UDHD630 too, I could send you that EFI if you'd like to, think we even have the same platform-ids, IIRC.
found this on the web https://github.com/xxxzc/xps15-9570-macos I don't know where to start to get the version of WhateverGreen they are using to enable 4k 60hz on internal screen in BigSur. @Feartech can you point me in the right direction?
 
found this on the web https://github.com/xxxzc/xps15-9570-macos I don't know where to start to get the version of WhateverGreen they are using to enable 4k 60hz on internal screen in BigSur. @Feartech can you point me in the right direction?
assumed it is from the release here:

according to the readme:

Big Sur​

OpenCore in latest release can OTA to/install Big Sur, but installing Big Sur on some Samsung SSDs like SM961/PM961 is very likely to fail (I have tried many kinds of configuration but nothing works, my SN550 is fine), do it at your own risk, don't open issue just for installation problem, unless you have a solution.

For 4k display user: WhateverGreen with commit 978cb8 can make panel running at 60Hz, you no longer need the 48Hz patch. Release 201218 in this repo includes the WhateverGreen with that commit and related device properties (you can see what has been changed in commits).
 
assumed it is from the release here:

according to the readme:

Big Sur​

OpenCore in latest release can OTA to/install Big Sur, but installing Big Sur on some Samsung SSDs like SM961/PM961 is very likely to fail (I have tried many kinds of configuration but nothing works, my SN550 is fine), do it at your own risk, don't open issue just for installation problem, unless you have a solution.

For 4k display user: WhateverGreen with commit 978cb8 can make panel running at 60Hz, you no longer need the 48Hz patch. Release 201218 in this repo includes the WhateverGreen with that commit and related device properties (you can see what has been changed in commits).
thanks bro. ill be installing Big Sur tomorrow after work
 
Status
Not open for further replies.
Back
Top