Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

DeviceProperties update to enable 4k, remove userspace dependencies for possible Big Sur #33

Conversation

mgrimace
Copy link
Contributor

Config.plist for testing Big Sur 4k/60 compatibility. Tested on Catalina and 4k/60 working with the DeviceProperties in this branch. Please don't merge, requires stability testing and Big Sur testing but I figured this would be the easiest way for folks to test/review.

Additions to DeviceProperties:

  • Dpcd-max-link-rate - Choose a DPCD maximum link rate for your display, where 4K=0x14 (default) or 1080p=0x0a. Related to driving 4k displays over display port (something to do with the link speed to the monitor?) seems relevant
  • enable-lspcon-support - to enable DisplayPort to HDMI 2.0 output on some platforms with Intel IGPU
  • enable-max-pixel-clock-override - discussed previously as an alternative to problematic enable-hdmi20 userspace patch
  • framebuffer-con0-alldata - values added in suggestion/discussion on reddit (I have no current understanding of what these values do).
  • framebuffer-con0-enable - enables these con0 properties

Removed:

  • enable-hdmi20 - userspace patch previously required for 4k

No changes to previous FrameBuffer settings (e.g., IDs, fbmem, etc.)

Config.plist for testing Big Sur 4k/60 compatibility. Tested on Catalina.

Additions to DeviceProperties:
Dpcd-max-link-rate - Choose a DPCD maximum link rate for your display, where 4K=0x14 (default) or 1080p=0x0a.
Related to driving 4k displays over display port (something to do with the link speed to the monitor?) so seems relevant

enable-lspcon-support - to enable DisplayPort to HDMI 2.0 output on some platforms with Intel IGPU

enable-max-pixel-clock-override - discussed above

framebuffer-con0-alldata - values added in suggestion/discussion (I have no current understanding of what these values do).
@mgrimace
Copy link
Contributor Author

@fabiannagel - if you're on Big Sur and willing to test, I was able to get 4k/60 tentatively working without the problematic enable-hdmi20 reliance (i.e., broken userspace patch that's not working in Big Sur). I'm not on Big Sur yet myself but this setup is currently working for me on Catalina and might help, or not. Please use caution if you test, it's very early but it might help.

@fabiannagel
Copy link

In the meantime, I went back to my old High Sierra Backup to use my Nvidia GPU, so I currently don't have a working Big Sur setup to test this. I gave up after I couldn't even get 4K running on Catalina. So I'm generally skeptical as to how well 4K ability in Catalina w/o userspace patches will translate to Big Sur.

Is your display connected via HDMI or DisplayPort? Are scaling options working properly for you, or do they require additional work? Thanks for your heads up!

@mgrimace
Copy link
Contributor Author

mgrimace commented Jan 31, 2021

In the meantime, I went back to my old High Sierra Backup to use my Nvidia GPU, so I currently don't have a working Big Sur setup to test this. I gave up after I couldn't even get 4K running on Catalina. So I'm generally skeptical as to how well 4K ability in Catalina w/o userspace patches will translate to Big Sur.

I'm skeptical myself! Both the stable and my experimental version do technically provide 4k in Catalina, but one issue I've discovered in this experimental version that there is no output to my second monitor (likely related to the con settings (I've only addressed con0). I don't have enough knowledge/understanding yet to fix/troubleshoot the con settings and provided them 'as-is' in case other folks have suggestions/expertise to add.

Is your display connected via HDMI or DisplayPort? Are scaling options working properly for you, or do they require additional work? Thanks for your heads up!

DisplayPort. I'm on the SFF version of the OptiPlex 7020 and I have two DP out ports. I have my primary monitor (27" 4k/60) plugged into the port corresponding to con0 in my config.plist, and a secondary (1080p) monitor in the other port. re. Scaling on 4k, I run the default which I believe scales visually to 1920x1080. I haven't explored this on the experimental branch but I personally never needed other scaling options (I like the larger effective text for my eyes/vision).

I've gone back to the stable version (Zearp's version) for the time being while I read up on con settings, but work/life is kicking my butt at the moment so I haven't had too much time to follow this thread further. If anyone has any suggestions/ideas I'd be happy to try. Of note, 4k is possible on Big Sur with manual patching and works fine as-is on Catalina. My intention here is to find the optimal DeviceProperties settings to provide a long-term working solution for 4k regardless of OS version (i.e., in this case by removing the user-space dependencies, which could get fixed in time anyways).

Removed con0-alldata, and tidied up connections. 4k working on primary monitor in Catalina. Bugs: no output to second monitor. Specifically, the monitor that usually registers as "internal" or "iMac" in display properties is black/blank.
@mgrimace
Copy link
Contributor Author

mgrimace commented Feb 7, 2021

I have removed the con0-alldata patch entirely and tidied up the deviceproperties as best I could. As it is, 4k/60 is working on my default monitor in Catalina. My second monitor, (the one that usually shows up as 'iMac'/internal) has no output (blank). I tried to resolve this by setting con0 and con1 to 'enabled' but no luck. I'm still reading about connection settings, and I think the missing piece is declaring the con settings. I'll tinker with that (I think they used to be included in an old build), and if it works I'll submit an update. Otherwise, this has been updated to remove any sketchy patching and so far just has certain key properties enabled.

@mgrimace
Copy link
Contributor Author

I'm able to resolve 4k on one monitor (on Catalina). However, I haven't had success enabling a second monitor. I can get second monitor support/working with con-enable settings, but as soon as I do, I lose 4k on the primary monitor. I've poured through the Dortania and WEG guides but I can't quite figure out the right specific connector settings (e.g., bus, port, etc) for the two DP ports - assuming that's even the missing piece here. I've also tried the force-online boot arg, this enables the second monitor but again loses 4k.

I'll close this pull, if folks want to try 4k on single monitor feel free to test. It should be relatively stable (no janky patching required) but I can't get second monitor working on this config. If anyone with a better sense of con settings/DeviceProperties has any other ideas let me know.

Tl;DR 4k works with these device properties but we lose second monitor. Enabling second monitor loses 4k. No stable config where I can do both at this time.

@mgrimace mgrimace closed this Feb 16, 2021
@zearp
Copy link
Owner

zearp commented Mar 29, 2021

@mgrimace The latest build of WhateverGreen has phased out the enable-hdmi20 property and replaced it with max-pixel-clock. I'm not sure if this means 4k is now working in Big Sur and I also don't know if this means that if we replace them in the current config 4k remains working on Catalina. Could you try swapping them and check if 4k still works? I don't want update to the latest builds and break 4k for those on Catalina.

@mgrimace
Copy link
Contributor Author

Could you try swapping them and check if 4k still works? I don't want update to the latest builds and break 4k for those on Catalina.

Would you be able to put together a test branch with the newest builds of WEG, etc.? I can then trial it on my setup (Catalina, 4k, dual monitor via DP, no dGPU), swap in the max-pixel-clock property, and report back my findings. That way the only thing I'm changing are values the config in case I screw up any of other parts?

@zearp
Copy link
Owner

zearp commented Mar 29, 2021

I confused myself a bit here, deleted my previous posts to avoid any further confusion lol.

The PR was merged a while ago, so we probably already use a version containing it but just in case I made a fresh build using all the current sources and edited the config too. It should be a matter of copying over your serials so your iCloud won't complain and replace your current EFI with the one attached.

EFI-enable-max-pixel-clock-override.zip

@mgrimace mgrimace deleted the 4k-DeviceProperties-(remove-userland-dependencies) branch March 29, 2021 18:10
@mgrimace mgrimace restored the 4k-DeviceProperties-(remove-userland-dependencies) branch March 29, 2021 18:23
@mgrimace
Copy link
Contributor Author

It should be a matter of copying over your serials so your iCloud won't complain and replace your current EFI with the one attached.

Tested, this does break 4k on Catalina. The only changes that I made to the posted EFI were adding my serials, and replacing my USB port map kext. It defaulted back to the unscaled 2560x1600 resolution which was the original pre-patch/pre-fix problem.

There should still be a way to do it. I had some partial success on previous attempts, but it is beyond my ability to problem-solve (e.g., it looked like we needed to define the connector settings and incorporate some other properties). As it is, the previous stable build works so caution to anyone with 4k moving forward to avoid WEG updates if the enable-hdmi20 property is indeed removed!

@zearp
Copy link
Owner

zearp commented Mar 29, 2021

Maybe I didn't enable it properly, don't think I did but just in case can you give it another with -igfxmpcz added to the boot flags?

I'm not sure if the property will be removed or just depreciated. Removing it could break 4k for many people who rely on it in Catalina and earlier.

I did map the connectors out in the beginning, at the time without them I got kernel panics but that was due to bugs. It's relatively easy to map them in Hackintool but I don't really know if it would do anything regarding 4k.

My main monitor has been glitching out lately so I might jump on the 4k train. Could use the extra real estate and chip in with getting 4k working properly on old and new macOS with the same patches.

@mgrimace
Copy link
Contributor Author

Maybe I didn't enable it properly, don't think I did but just in case can you give it another with -igfxmpcz added to the boot flags?

Tried, still broken/capped at 2560x1600.
I saw on a reddit post that another 9020 user had their Device properties set with:

  • framebuffer-stolenmem = 00003001
  • framebuffer-fbmem = 00009000

I tried those values just as a 'why not' and the resolution dropped to 1080p, but it made me wonder then if the current stolenmem/fbmem values are capping the resolution rather than a particular property? If we could safely increase those values (to a proper value/ratio) we might be able to bump up the resolution to 4k manually that route (rather than piling on other properties)? I don't know what those values could/should be, but I do know that there's some rules here that I don't quite understand for how to set these: https://github.com/acidanthera/WhateverGreen/blob/master/Manual/FAQ.IntelHD.en.md

My rational for connectors was that I was able to get 4k working by piling on a few other properties (above) but that somehow disabled my second monitor output. This led me to attempt to define the connectors properly (and I had read other's had success by doing this with HD4600 on other hardware) but I never made any progress there.

So possible targets - revisit fbmem/stolenmem values?

@zearp
Copy link
Owner

zearp commented Mar 30, 2021

The connectors when I mapped them out are still in some old commits not 100% sure if I did that correctly but at the time it did fix the panics after waking ups that were caused by a bug somewhere else.

Those fbmem/stolenmem entries are only needed when you're unable to change the DVMT pre-allocation, but we can change that. I do think the hdmi20 option isn't going away until something can fully replace what it did. Specially for those opting to stay on Catalina for now. Can't image how many people rely on that feature to work.

It wouldn't be the end of the world if newer build did actually remove it though. It's not like WEG isn't stable on Catalina and earlier so we can just use whatever last version still had the feature. There's really no need to upgrade anything EFI related once everything works. The current EFI could be used and just left there until Catalina gets no more security updates. The chance a Cataline upgrade at this point breaks things is so small.

I do like to keep track of the latest stuff though, but it's not always worth it to run the bleeding edge or spend too much time keeping track of everything. Specially if you just want to run a stable macOS and not tinker all the time its more than enough to check once every 1-2 months for any big changes or things you want to add to your config. It's where this repo will head towards too, not many major changes in any components for a while. A few new config entries that we didn't need, I added them but left them all disabled haha.

@mgrimace
Copy link
Contributor Author

The connectors when I mapped them out are still in some old commits not 100% sure if I did that correctly but at the time it did fix the panics after waking ups that were caused by a bug somewhere else.

I tried those (found the old commit) in some of my testing but ran into some road blocks and eventually abandoned that line of investigation (I'm not certain connectors were the barrier, but I figured it wouldn't hurt to try and map those out).

Those fbmem/stolenmem entries are only needed when you're unable to change the DVMT pre-allocation, but we can change that. I do think the hdmi20 option isn't going away until something can fully replace what it did. Specially for those opting to stay on Catalina for now. Can't image how many people rely on that feature to work.

Re. fbmem/stolenmem, the weird part was the original solution to get 4k working was to define those values even though it shouldn't be necessary since we set DVMT manually in the bios. We basically just used the values found in the janky 4k "patch" - I'm wondering now if perhaps these could be "upped" in some regard. I don't know to what values, or how to code those values properly, but I'm happy to test if you have suggestions!.

It wouldn't be the end of the world if newer build did actually remove it though. It's not like WEG isn't stable on Catalina and earlier so we can just use whatever last version still had the feature. There's really no need to upgrade anything EFI related once everything works

So true, we have achieved some very nice stability here! My drive here is that I do believe 4k without enable-hdmi20 is solvable (without manual patching) with the right values/properties. I'll keep tinkering away at it, and if you do pick up a 4k monitor and/or have any suggestions I'm happy to test!

@zearp
Copy link
Owner

zearp commented Mar 30, 2021

From what I understand WEG only uses those things for the DVMT stuff. They mention it in their fav and link to a Russian forum post, Google can sort of translate it toi give you an idea whats its about.

Here is the forum link: https://www.applelife.ru/threads/intel-hd-graphics-3000-4000-4400-4600-5000-5500-5600-520-530-630.1289648/page-169#post-750369

The post suggests that it is really only used to slim down the framebuffer on machines that can't have the size expanded. Maybe it has side effects but I wouldn't mess with it as (like the post mentions) it can lead to the graphics driver wanting to write to a space that doesn't really exist which can lead to glitches or crashes.

I've asked if the hdmi20 option will remain, I might have misunderstood it completely and the pixel clock settings are not meant to replace hdmi20 but simply be something used on newer macOS and hdmi20 will remain in there for anything before Big Sur.

I wonder if you make a new map how it compares to the one I did. It's been so long ago and I'm not 100% sure I mapped all the ports properly and disabled any unused frame buffers ports. Disabling those is not required but good to do when you can. I'll have to revisit the OSXLatitude forum thread on Haswell patching to brush up on its done manually. The forum seems down at the moment.

I do think we can disable one, when I check on this 7020 it shows 3 but it should really show just 2. One for each DP port.

zearp@localhost ~ % ioreg -l | grep "class AppleIntelFramebuffer"
    | |   | +-o AppleIntelFramebuffer@0  <class AppleIntelFramebuffer, id 0x1000003c4, registered, matched, active, busy 0 (605 ms), retain 20>
    | |   | +-o AppleIntelFramebuffer@1  <class AppleIntelFramebuffer, id 0x1000003c5, registered, matched, active, busy 0 (593 ms), retain 22>
    | |   | +-o AppleIntelFramebuffer@2  <class AppleIntelFramebuffer, id 0x1000003c6, registered, matched, active, busy 0 (548 ms), retain 19>

I don't think any of that will have influence on 4k stuff, as it works fine without disabling unused frame buffer ports but it can't harm to dot the i's here and do it all by the book and set up the connectors and ports properly.

@zearp
Copy link
Owner

zearp commented Mar 30, 2021

Oh, I just got a notification that vit9696 replied to my question and he said we might need to up the frequency by adding max-pixel-clock-frequency to the frame buffer config, it defaults to 675000000 (675mhz).

You can try adding that field to the config and increase the default frequency bit by bit until it hopefully works. I'd try small increments cuz I dunno if setting this very high can cause issues. I'm not sure how much more speed is needed. Might need 700mhz or 680mhz or something else, there's only one way to find out.

I assume the type needs to be a string and not data or something else.

He also linked to the HDMI in UHD resolution with 60FPS part of the WEG FAQ which has a little more info on how it works.

If you can try out some frequency values that would be awesome. I wonder how many reboots it takes to find the magic number that makes 4k work again with the new parameter lol. Good luck and thanks for helping out!

@mgrimace
Copy link
Contributor Author

mgrimace commented Mar 30, 2021

If you can try out some frequency values that would be awesome. I wonder how many reboots it takes to find the magic number that makes 4k work again with the new parameter lol. Good luck and thanks for helping out!

Thanks for looking into this! Ok, I tried 675 (specified manually, just in case) - I copied your code above and used string as the type. Specifically, max-pixel-clock-frequency and the string value 675000000 (note: 6 zeroes). I incremented up to 775 (i.e., 775000000, skipping a few here and there) with no visible change.

I then jumped to 875000000 to try and see if there was an upper bound that would work, but on the verbose login it said "max-pixel-clock-frequency ... (something here I forget)... unexpected format". I didn't notice this with the previous values. Double checked there was no typo, same error

I'm not sure if there's an upper limit to this, or my syntax was wrong, or what. I did a quick search and couldn't find any clear documentation on how to manually specify the value (e.g., if it should be data, string, number).

@zearp
Copy link
Owner

zearp commented Mar 30, 2021

The documentation is still sparse, from reading the PR the Dortania guide writers got pinged but maybe they need to do their own testing before publishing new parts of guide covering and explaining this for mere mortals like us haha.

The PR code itself for getting the custom frequency looks like this;

IOKit::getOSDataValue<uint32_t>(info->videoBuiltin, "max-pixel-clock-frequency", maxPixelClockFrequency);

It may need be a number not a string but I'm just thinking out loud.

@mgrimace
Copy link
Contributor Author

mgrimace commented Apr 2, 2021

The documentation is still sparse, from reading the PR the Dortania guide writers got pinged but maybe they need to do their own testing before publishing new parts of guide covering and explaining this for mere mortals like us haha.

Ha agreed! Are there any guidelines for syntax with straight numbers? I somewhat arbitrarily tried 675, 800 and no change (i.e., no 4k). I'm not sure what to do next to move this testing forward, if you have any ideas/direction I'm happy to keep trying though!

@zearp
Copy link
Owner

zearp commented Apr 3, 2021

It's supposed to be put in hertz, so the full long number. I think there's a max which would probably trigger the error message you saw earlier. I have no idea how you can verify the current clock freq. Without that we don't know for sure if the new clock freq was applied.

My guess it would show in the logs, might need a debug version and some boot flags or gfx-tool that comes with WEG can read some stuff too but I've only used that a very long time ago so not sure if it can read those clocks. It should log it )plus a lot more) when using debug versions and required boot flags hopefully.

@mgrimace
Copy link
Contributor Author

mgrimace commented Apr 5, 2021

It's supposed to be put in hertz, so the full long number. I think there's a max which would probably trigger the error message you saw earlier. I have no idea how you can verify the current clock freq. Without that we don't know for sure if the new clock freq was applied.

I tried number 675000000 and 775000000, no 4k.

I also tried the properties/boot args found on this project: https://github.com/varszegimarcell/Optiplex-3020-Hackintosh-OpenCore/tree/main/EFI/OC. It's from an Optiplex 3020 but they appeared to have swapped in a processor with HD4600 rather than the HD4400. The DeviceProperties were the same as ours previously, with enable-hdmi20 and framebuffer-unifiedmem removed, and the following boot-args were added (and tested): -igfxmpc -igfxcdc -igfxdvmt. No 4k.

I also tested/re-tested some other properties:

  • enable-dpcd-max-link-rate-fix (enabled)
  • dpcd-max-link-rate (data, 14000000) - why? "Choose a DPCD maximum link rate for your display, where 4K=0x14 (default) or 1080p=0x0a." Related to driving 4k displays over display port.
  • enable-lspcon-support (enabled) - why? "to enable DisplayPort to HDMI 2.0 output on some platforms with Intel IGPU". I thought this might also replicate some of the enable-hdmi20 functionality, but mostly just guessing at this point.

No 4k with these properties added either unfortunately.

@zearp
Copy link
Owner

zearp commented Apr 6, 2021

Thanks for testing!

Unifiedmem just forces 2gb vram, the OpenCore docs say best to not use it but I seem to recall 4k worked better with it. By default it will allocate 1.5gb vram. I'm not sure if macOS scales it up but Window does. Not sure if any hard limit exist. The option can be safely removed on my 1080p installs.

I'm about to buy this portable 4k (3840x2160) screen, not sure if I will run it unscaled all the time but I sure wanna be able to run in native 4k even if things look smaller they should be very sharp with such a high ppi. It was pretty hard to find one that can run in single cable mode but according to reviews this one can.

I've also seen "4k" screens advertised that do 3200x1800 max, I have no idea if those will work if we get proper 4k working. The prices are the same so I'm getting proper 4k. Hopefully it arrives soon and without any pixel defects... my biggest fear lol. Luckily Amazon has a good return policy.

@mgrimace
Copy link
Contributor Author

mgrimace commented Apr 9, 2021

I'm about to buy this portable 4k (3840x2160) screen, not sure if I will run it unscaled all the time but I sure wanna be able to run in native 4k even if things look smaller they should be very sharp with such a high ppi. It was pretty hard to find one that can run in single cable mode but according to reviews this one can.

That's exciting! Enjoy it and well-deserved. I personally need the 4k for on-screen text (reading/writing), it makes a huge difference for me in terms of clarity.

I've also seen "4k" screens advertised that do 3200x1800 max, I have no idea if those will work if we get proper 4k working. The prices are the same so I'm getting proper 4k. Hopefully it arrives soon and without any pixel defects... my biggest fear lol. Luckily Amazon has a good return policy.

It makes sense to get "true" 4k, I imagine non-standard resolutions would be a headache. I think part of the problem here is my limited understanding of what I'm doing (e.g., mostly copy-paste) and I'm hopeful that if/when you get a 4k we'll be able to resolve 4k in a way that is stable for both Catalina and Big Sur.

@zearp
Copy link
Owner

zearp commented Apr 10, 2021

I'm hoping to see some improvements in that area too. Even scaled down to 1440p or 1080p a 4k display should produce a better more crisp image due the high ppi.

I saw your other post where you tagged me, I don't recall reading about the need to change the other dvmt setting, but its been a while and sure can't hurt to try it out.

0x4F3F1 		One Of: DVMT Total Gfx Mem, VarStoreInfo (VarOffset/VarName): 0x264, VarStore: 0x2, QuestionId: 0x219, Size: 1, Min: 0x0, Max 0x0, Step: 0x0 {05 A6 4F 04 50 04 19 02 02 00 64 02 10 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00}
0x4F417 			One Of Option: 128M, Value (8 bit): 0x1 {09 0E 51 04 00 00 01 00 00 00 00 00 00 00}
0x4F425 			One Of Option: 256M, Value (8 bit): 0x2 {09 0E 52 04 00 00 02 00 00 00 00 00 00 00}
0x4F433 			One Of Option: MAX, Value (8 bit): 0x3 (default) {09 0E 53 04 30 00 03 00 00 00 00 00 00 00}
0x4F441 		End One Of {29 02}

Also noticed low power mode being enabled by default, disabling that on a desktop should be fine but I have no clue if it would contribute anything.

0x4F443 		One Of: Gfx Low Power Mode, VarStoreInfo (VarOffset/VarName): 0x209, VarStore: 0x2, QuestionId: 0x21A, Size: 1, Min: 0x0, Max 0x0, Step: 0x0 {05 A6 AB 04 AC 04 1A 02 02 00 09 02 10 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00}
0x4F469 			One Of Option: Enabled, Value (8 bit): 0x1 (default) {09 0E C2 03 30 00 01 00 00 00 00 00 00 00}
0x4F477 			One Of Option: Disabled, Value (8 bit): 0x0 {09 0E C3 03 00 00 00 00 00 00 00 00 00 00}
0x4F485 		End One Of {29 02}

I'll run some basic benchmarks and change them both and then run them again.

@zearp
Copy link
Owner

zearp commented Apr 10, 2021

Ah, that was silly. Ours is already set to MAX by default, it was right there in the IFR but I didn't notice and still booted into the modified grub shell and when I verified the current setting noticed it was on. I did disable low power mode though. Same results in the benchmarks with or without low power enabled. It might not do anything at all.

@zearp
Copy link
Owner

zearp commented Apr 10, 2021

Quick update, receive screen but haven't gotten far yet. I stumbled on a different issue where hot plugging my cable from the top in to the bottom (nearest to ps/2 ports) dp port results in a freeze. Not even a panic a full freeze. I tried some connector configs and also without them and also tried applying enable-hdmi-dividers-fix to no avail. I'd like to be able to swap the dp cable from one to another without a freeze. Re-plugging the cable in the top port only works fine.

All that was without even connecting the 4k screen, when I connect the 4k screen stand-alone I make it till it loads the guy then I get a black screen, there is still signal no power saving is triggered. This also happens with different configurations. Very odd, the screen works fine on my NUCs either via usb-c or hdmi.

I'm trying to sort out the hot plugging first so I know there won't be a freeze when I connect the 4k screen as 2nd screen. I'm not sure if its even possible. DisplayPort can be fussy with hotplug but I think I had this working before with the connectors setup properly. But somehow it doesn't work anymore. I tried the old map too.

I'm still on Catalina btw, but I also added the frequency options, also didn't make any difference. I can't get macOS to work with my 4k screen at all. I'll try Windows later just as sanity check lol. If these things work in Widows then we should be able to make it work in macOS. Maybe this screen is not working properly on this Dell. I'll update more later.

@zearp
Copy link
Owner

zearp commented Jul 25, 2021

The detection thing might be a WEG bug. The ports are identical. If you only use the 4k screen does 4k work on both ports?

Rotation should work but if you can exclude your previous fixes we can answer it for sure. Maybe it is possible to swap around (with UEFI edits or bios hacking) which display is the main when two are connected. But that is a work around that should be used last if detection can't be fixed. It should detect the screen properly the first time and not require a power cycle or different port as both ports are identical.

If 4k and detection works fine in both ports when only the 4k screen is connected but only works in dual screen when a certain port is used for the 4k screen that would imply an issue either in the config or detection. Since it fixes itself on a power cycle, forcing it to the detection again my bet is on a bug. The ports are setup identically and correctly as far as I can tell.

Gonna need logs and clear description of this and maybe open a bug report for WEG. Cuz it should detect that screen properly the first time. If WEG is responsible for it that is. I think it does do something in there going by the previous logs.

A display showing as internal/external I file under cosmetic as it doesn't impede or influence the functionality as far as I'm aware. This should be controlled but flags and other "black hole" stuff.

While I'm interested I'm not going to dedicated too much time figuring out why the flags don't work properly to set internal/external screens. It is too convoluted and too many things regarding flags (especially anything beyond the first bit) are completely unknown even to the people who know this stuff inside out. There are also way too many possibilities when you include the other bits in the flags that have no documentation at all and still do things too.

Maybe there's a way to apply some cosmetic patches to always make any connected display show as external.

@mgrimace
Copy link
Contributor Author

mgrimace commented Jul 27, 2021

Back with some quick tests and a working fix:

Tl;DR Fix - Swapped the con all-data so that con0 starts 03060800 and con1 starts 02050A00. Result: macOS detects 4k automatically on boot with one or both monitors used in any port (i.e., fully working as expected). This config also allows the 4k monitor to be the 'boot' monitor, when plugged into the topmost port (i.e., Dell, startup, and OC picker appear on monitor plugged into top-port when using dual monitors; useful if second monitor is rotated).
Screen Shot 2021-07-27 at 9 41 11 AM

Clearer description of the problem:

  • With the previous con0 settings, when the 4k monitor was in the top-most physical DP port it would boot into a small, blurry "half-resolution" state (2560x1600). 4k capability was not recognized, and scaling was not shown in Displays.
    Screen Shot 2021-07-25 at 8 43 04 PM

Workarounds:

  • Power cycling the monitor fixed detection, but unfortunately the power-cycle fix would not persist upon reboot

Screen Shot 2021-07-25 at 8 43 50 PM

- Swapping the physical port for the 4k monitor from top-most to second port fixes the problem of 4k not being detected on boot. Both monitors detected fine. The downside is that when two monitors are plugged in, the top monitor becomes the primary 'boot' monitor, so if the second monitor is rotated all the boot information/dialogues, etc., appear sideways on the rotated monitor.

Fix:

  • So I figured a quick test would be to flip the cons so the 'top' physical plug would be the 'working' plug, so at the very least I could have my 4k be my boot monitor and fix that annoyance.
  • framebuffer-con0-alldata was 02050A00 00040000 10000000, now 03060800 00040000 10000000
  • framebuffer-con1-alldata was 03060800 00040000 10000000, now 02050A00 00040000 10000000
  • As it turns out, it worked. Moreover on a few quick reboots, 4k monitor now works alone in either port and is detected properly in dual on either port. As it is, unless swapping these cons is contraindicated for any other reason, this switch in the config should make the EFI fully working for anyone regardless of monitor setup (4k, non-4k, single, or dual) regardless of port used.

Still todo:

  • This was relatively quick testing. I still need to go back and re-break the setup (prev cons where it wasn't detecting properly) set it up to do WEG debug logs and then do the IOReg. But I wanted to post this as a viable fix in the short term to complete 4k/dual on Monterey (again unless it's not good to swap those ports).
  • Also, my apologies. I was not implying a need to fix the internal labelling of the monitor, that's definitely cosmetic and seems to have zero bearing on usability.
  • only intended to raise it as an interesting finding when it comes to rotation, as external monitors seem to have rotation options presented by default where monitors designated as internal ones don't (not as a todo to fix!). Also, I found it interesting that the power cycle changed it from external to internal (e.g., you can see in screenshots above), but I don't know what that means either). Next job re-break and get logs when I can.

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

Awesome progress!

4k monitor now works alone in either port and is detected properly in dual on either port

Can't get much better than that. I'm glad the solution was rather easy though not easy t find other than messing around and experiment. I don't think I could've done this with my little dummy, it's too tricky and I don't fully trust it. You got a proper 4k screen on a real DP connection. I'll just re-do my basic dual 1080p testing where one or both screens use hdmi conversion.

I'll try those values right now and if they work here and don't cause issues which I don't expect I'll update the config. I'm also happy it isn't a WEG bug cuz I would thin kit might be hard to fix this kind of stuff but Im not a programmer so I'm just guessing haha.

Really happy with this progress, we don't fully now what we're doing but still manage to get things done without asking for outside help. I like that, very educational too. Rotation will be a fun one to play around with. I do find it ciruoous that even with a Mac mini SMBIOS which has no internal screen things are still elected as internal even with the (hopefully) correct flags indicating internal/external screen.

Please don't apologise, I'm too pragmatic sometimes and with the other stuff not sorted it wasn't really important to fix but now with your progress why not try and get as close to "perfection" as possible 😅

I'm going to do some reboots and quick tests!

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

Some quick test results:

  • One hdmi monitor connected to either of the ports = no display at all
  • Two hdmi monitors connected to either of the ports also no display
  • One DP connected monitor connected to top work works, bottom port no display
  • Plugging in hdmi in bottom port with DP in top results in nothing happening, no crashes either

I'm pretty sure I saw my machine pop-up in my VNC client with all of the above so nothing panics or crashes. Will double check to make sure.

I'm intrigued these small changes seems to have completely broken any hdmi from working. It works up to the point where it switches to the graphical interface. Also odd that my DP monitor only works on one port. Specially since your 4k screen works in both ports stand-alone. Does your DP 1080p screen work on both ports for you?

You change doesn't do anything drastic, it swaps the ports and bus-id only. I will try with the bus-id left as it was and the other way around too. I did cycle thought all the possible bus-id combinations but I'm limited by h/w in my testing ability here.

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

To swap them out in a different way we could try to leave the all-data as is and change con0 to con1 and con1 to con0. Those are software indexes and maybe more flexible?

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

With only the first bit swapped I can use my DP screen on both ports again.

con0 = 02060800
con1 = 03050A00

I haven't tried dual screen and stand-alone hdmi yet. And I don't know if this will break anything 4k related. I will also try swapping just the con's. There must be a configuration that works for everything, bummed out somehow hdmi completely broke cuz it was looking so promising. Be right back again.

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

Interestingly when I did my dual screen testing it only worked with my DP screen connected to the bottom port. I tried it again on a different hdmi monitor and I got a panic using the current repo config while in mirror mode. This didn't happen with the other screen combination, both using the same DP -> hdmi cable.

The panic log is a red herring imho, the kernel crashes due to a failed assertion (content_filter.c). I will do the same with the other screen that worked before. Can't be that it stopped working with no changes in the config. I need my sanity check haha.

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

I go and connect the other screen that worked when I did my testing and of course it still worked, extended and mirror. I shut down and plug back the monitor that caused the panic to see if it happens again but nope. So it must have been cause by me plugging in the screen without power cycling the machine. DisplayPort is know for these kind of things but yikes lol.

Both hdmi screens work in dual display as long as there is 1 DP monitor connected to the bottom port. My sanity check is completed haha. I was really baffled there but I guess from here on out I will power cycle when swapping cables/displays. Now I can resume where I was before, just had to do a sanity check.

I'm not sure which port is the boss, for me dual screen breaks if I use the top port with the DP monitor.

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

No rotation options for me on either display with the current repo's config, forgot to check that earlier. Both do show as internal. I'll try to get those to show first. I need to think on why hdmi breaks with your config, at least we know it can work and at worst some more config editing may be needed for those with dual screen setups.

Maybe there's another way to fix the detection thing. Maybe something ACPI hack or user land tool that forces re-detection during or right after booting up. I still think WEG or whatever is doing this detection should detect it correctly the first time.

I did search Apple's own forums on it and found some users reporting similar issues on their MacBooks, they had to power cycle external screens after boot before the correct resolution was used. In some threads people said Apple knows about this and was working on a fix. These were posts from 2019 or 2020 I think. Might be fixed, might not be fixed, might be a total red herring.

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

Rotation options return with CNUknownFlag_10 disabled. When disabled on both connectors dual screen stops working surprisingly its the DP display that stays black. I'll play around with the flags some more cuz with that flag disabled hotplug events cause a crash or panic. It would be nice to be able to keep that one enabled. Not essential though.

@mgrimace
Copy link
Contributor Author

mgrimace commented Jul 27, 2021

To swap them out in a different way we could try to leave the all-data as is and change con0 to con1 and con1 to con0. Those are software indexes and maybe more flexible?

Quick test:

  • returning all-data back to normal (default config), then instead switching the labels (e.g., switching the key framebuffer-con0-alldata and framebuffer-con1-alldata) also accomplished the same thing (working 4k on boot with 4k in top port).
  • Reading your tests, interesting!!!

@mgrimace
Copy link
Contributor Author

Just notice I think made a typo in my earlier post, in my actual config I have:
03040A00 00040000 10000000 noting on the second byte I have 04 not 05. Maybe try with 04 and see if that gets rid of the weirdness?

With only the first bit swapped I can use my DP screen on both ports again.

con0 = 02060800
con1 = 03050A00

I haven't tried dual screen and stand-alone hdmi yet. And I don't know if this will break anything 4k related. I will also try swapping just the con's. There must be a configuration that works for everything, bummed out somehow hdmi completely broke cuz it was looking so promising. Be right back again.

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

Ohh, if switching con0/con1 solves it then that might be the way to go. I will check if that breaks anything here.

Haha, so I may have tested with the wrong values if there's a typo. I tested with 02050A00 not 02040A00 which might explain it as bus-id for hdmi is more fiddly, DP worked for me with any of the allowed DP bus-ids.

@mgrimace
Copy link
Contributor Author

Quick test:

  • returning all-data back to normal default and just swapping the first two bytes also accomplishes the same thing (working 4k detection on boot, 4k is primary monitor). Here's what I got:

Screen Shot 2021-07-27 at 1 41 27 PM

So for DP monitors, either swapping the first byte (02/03) or swapping con0/con1 seems to provide the same working result (i.e., fixed).

@zearp
Copy link
Owner

zearp commented Jul 27, 2021

Yeah that also does the same, interesting it matters for monitor detection, a good thing to know!

I can't reboot to test it right now cuz macOS will update itself to beta 4 it just downloaded once I do. I'd assume swapping them like that doesn't matter for (my) basic usage. I just need one DP screen connected for dual 1080p screen to work. With single 1080p screens DP and hdmi work fine

@zearp
Copy link
Owner

zearp commented Jul 28, 2021

Beta 4 installed fine from the App Store, thats a first for me. It didn't work from beta 1 to 2 and from beta 2 to 3. Everything works fine. I was deep diving in the frame buffer drivers and Apple's iGPU power management trying to figure out how the clock speeds work.

Which I know now, but changing them proves rather difficult as my patches/edits don't seem to get applied when done from OpenCore. Directly pathing things with a binary patch might work but will depend on Apple not changing those which is always a gamble and not preferred.

Not sure what I could test or experiment with in regards to 4k/hdmi/dp today. I'm trying to find some old screen with DP so I can test dual DP and such. Seems DP is easier to get going as its less picky about what bus-id its on and such.

@mgrimace
Copy link
Contributor Author

mgrimace commented Aug 2, 2021

Beta 4 installed fine for me from App Store as well! Basically, I've just kept the connectors switched on my end (so 4k can be plugged into the top physical DP position) and it's been working fine with both monitors DP->DP (fine meaning 4k is detected automatically, and the boot screens show up on the 4k as the primary monitor). It looks like that connector swap was giving you some issues with different combos (e.g., HDMI vs., DP) though, so I'm not sure what the optimal fix here would be!

@zearp
Copy link
Owner

zearp commented Oct 29, 2021

I was wondering about what needed to be changed for Monterey but following the guide will result in a working Monterey setup.

I think if we want to make it default to Monterey all we need to do is change the SecureBootModel to x86legacy and that should also work fine on all previous macOS versions. I will push that change and update everything when I get a little bit more time.

I've updated a few machines to Monterey without any issues so I assume no other changes to the config or kexts are needed. Let me know if you have any ideas too!

@mgrimace
Copy link
Contributor Author

mgrimace commented Oct 29, 2021

I was wondering about what needed to be changed for Monterey but following the guide will result in a working Monterey setup.

I think if we want to make it default to Monterey all we need to do is change the SecureBootModel to x86legacy and that should also work fine on all previous macOS versions. I will push that change and update everything when I get a little bit more time.

I've updated a few machines to Monterey without any issues so I assume no other changes to the config or kexts are needed. Let me know if you have any ideas too!

Agreed, as far as I can tell no further changes are required for a working Monterey setup. On my end, I do still switch con0 and con1 but I think that's particular to my specific monitor setup (4k primary + second 1080p monitor, both connected DisplayPort).

Re. this switch, specifically what I do is swap framebuffer-con0-alldata with framebuffer-con1-alldata so that con0 has the data 03060800 and con1 is 02040A00 (i.e., opposite). This allows me to put the 4k monitor in the top-most DP port, which sets it as the primary monitor (e.g., during boot sequence, etc. since my second monitor is veritcally-oriented). 4k/60 is automatically detected properly with this arrangement.

For most users, simply plugging the 4k monitor into the bottom-most DP port and using the default config should fix any issues with automatic 4k detection. Also noting that most users shouldn't experience any problems with a single 4k monitor in either port, I think things only got weird with dual monitors.

@zearp
Copy link
Owner

zearp commented Oct 30, 2021

Thanks!

I think there's some info about the swapping of connectors in the guide. For normal setups everything should work. And those with multi displays have to adjust some settings to suit their needs. Like with the audio layout.

The EFI is very stable on my side. These Dell machines make very good Macs lol.

@mgrimace
Copy link
Contributor Author

The EFI is very stable on my side.

Me too, and definitely should work out-of-the-box for normal setups including system updates, etc. With the right BT/Wifi card, all the handoff/continuity/apple-watch login stuff is working as well. As far as I can tell the system is a fully functioning Mac for my use!

I've been using Monterey as a daily driving now and it's been as stable as Catalina was for me previously (I skipped Big Sur), minus some beta hiccups (unrelated to the EFI).

Repository owner deleted a comment from joaodezembro Nov 27, 2021
@zearp
Copy link
Owner

zearp commented Dec 19, 2021

Trying to update to 12.1 results in a reboot without any error messages. It just shows the kernel being loaded and reboots right away. Did you have any luck with it?

I tried both with the OTA update and downloading the full installer. Didn't try installing when booting form the installer though. I will do that next and a clean install. Maybe my test machine has been updated and messed with too much.

@mgrimace
Copy link
Contributor Author

Trying to update to 12.1 results in a reboot without any error messages. It just shows the kernel being loaded and reboots right away. Did you have any luck with it?

I tried both with the OTA update and downloading the full installer. Didn't try installing when booting form the installer though. I will do that next and a clean install. Maybe my test machine has been updated and messed with too much.

No problem on my end, I just let it auto-update through the in-built software update function in preferences - received a notification, clicked "try installing tonight" woke up in and it was installed. No changes on the EFI other than serials, and a con0/con1 swap for my dual monitor setup. I had forgotten to turn off the beta enrolment, so it did run through a few beta updates before the 12.1 proper so possibly that helped?

@zearp
Copy link
Owner

zearp commented Dec 19, 2021

Thanks, I think my test machine just needs a clean install then. It has been messed with too much. I'll try a clean install with the latest versions of everything and update the repo once I confirmed it's working. I usually do a clean install but lately I been busy with some other things. I run still use Catalina on my main 7020s. Just wanted to see if everything still worked for 12.1 -- good to know you even went thought beta updates without issues. Thanks!

@mgrimace
Copy link
Contributor Author

mgrimace commented Dec 19, 2021

It has been messed with too much

Maybe double check the SecureBootModel is set to x86legacy? I think that was giving me update problems way earlier on but I might be mis-remembering. I think AdviseFeatures=True was maybe another one that had something to do with updates. I believe those were both set up fine in later EFI updates, but I vaguely recall one or the other had something to do with updates as I was working up through the Monterey betas. I'll see if I can find more.

@zearp
Copy link
Owner

zearp commented Dec 19, 2021

I was able to upgrade successfully without changing the EFI and booting from the installer directly. No idea why it couldn't upgrade using OTA or the app from within macOS. I blame my test machine. I use it to build the the EFIs for both my repo's so I prefer not to clean install it as it takes too much time to set things up, even when restoring it from a backup. I'm now running 12.1 on it without any issues, other than it being slow now because macOS is doing "optimisations" or something in the background.

@zearp
Copy link
Owner

zearp commented Dec 19, 2021

The reboot right after loading the kernel came back. It was caused by my Dell DW1820 card, removing it fixed it all. Still weird it booted fine for a few times and then crapped itself. The cards have a few revisions that don't always play nice with macOS, I guess I have one of those. Not an issue with the EFI for sure.

@zearp
Copy link
Owner

zearp commented Jun 18, 2022

Whilst doing something unrelated I stumbled upon this command:

test@test ~ % system_profiler SPDisplaysDataType -json | grep current
            "spdisplays_displayport_current_bandwidth" : " 5.40 Gbps",
            "spdisplays_displayport_current_lanes" : "4",
            "spdisplays_displayport_current_spread" : "<= 0.5%",

Without grep there is even more information. The current speed and such would've bene useful in our testing haha.

@mgrimace
Copy link
Contributor Author

Whilst doing something unrelated I stumbled upon this command:

test@test ~ % system_profiler SPDisplaysDataType -json | grep current
            "spdisplays_displayport_current_bandwidth" : " 5.40 Gbps",
            "spdisplays_displayport_current_lanes" : "4",
            "spdisplays_displayport_current_spread" : "<= 0.5%",

Without grep there is even more information. The current speed and such would've bene useful in our testing haha.

HAHA definitely, hey at least we got there though right, taking the long way :P On an unrelated note, I actually just set finished setting up HomeBridge at home too (on a new Raspberry Pi). It works as a homekit bridge to connect all my non-homekit smart devices. Thought of this as I was doing another non-apple -> apple project :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants