dortania / OpenCore-Legacy-Patcher

Experience macOS just like before
https://dortania.github.io/OpenCore-Legacy-Patcher/
Other
11.68k stars 1.12k forks source link

5k Output issues on iMac15,1 (27" 5k iMac - 2014) #359

Closed khronokernel closed 2 years ago

khronokernel commented 3 years ago

When booting OpenCore on an iMac15,1, the iMac's firmware will enforce a 3840x2160 resolution on the internal display. This seems to be an unfortunate issue with the 5k iMac series as the issue plagued Windows, Linux and UEFI. Apple eventually made a driver hack for Windows however both UEFI and Linux fixes are missing.

Work-Arounds

The only current solution to restore 5k output is to boot macOS without any 3rd party boot loaders. However this therefore breaks OTA updates, AirPlay to Mac, Universal Control and other patches. Additionally forcing a higher resolution within macOS only emulates 5k, the actual screen resolution stays at 4k.

As we have no hardware locally, we cannot continue researching. Hardware donations would be appreciated, see Supporting the patcher page for more information.

Thanks to the gracious donation from @turbomacs we have a 2014 5k iMac locally now! Currently research is being done and patch sets developed.

Working solution can be found here: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/359#issuecomment-988417731

Associated branch: 5k patch

Issue will be closed once patch set is merged into mainline.

Additional Information

Original Issues Thread:

owenzhao commented 3 years ago

Is that possible to just give the resolution options like 5K in 4K? In 5K, I was used to using the resolution of 2880 x 1620. There is no 2880x 1620 in 4K mode, the counter resolution was a little bigger about 3020x1698 as I remembered. However, the resolution bigger and smaller are the same, still 3200x1800 and 2560x1440.

So I will be pleased if 2880x1620 could also be listed as an option under 4K. Is that possible? As I have almost never used the native 5K resolution, but use 2880x1620 a lot.

截屏2021-07-05 上午7 42 33
jonblatho commented 3 years ago

@owenzhao, I have tried this through SwitchResX and been unable to arrive at a fully correct solution. I have been able to get to 2880x1620, but not scaled at 2x (for the Retina display). Even then, since macOS believes the display is 4K, it still wouldn’t appear fully correct, particularly with aliased graphics because macOS is still running downsampling for 4K resolution.

We know this because you actually can run at the display's native resolution of 5120x2880 (2560x1440@2x) through macOS’s display preferences and the 4K downsampling leads aliased graphics to look horrible on the 5K display, even though it’s ostensibly running at the display’s native resolution.

jonblatho commented 2 years ago

I was poking around and stumbled on a forum post about setting up a custom resolution on the 12" MacBook. Is there any chance there's a path to a fix through the /System/Library/Displays/Contents/Resources/Overrides directory?

razordynamics commented 2 years ago

Hi, I have this model and should be able to provide a hardware info dump with IOReg Explorer, will that help? Unfortunately I won't be able to donate actual hardware, since I'm using it currently, but I can provide info/testing/etc, whatever else might help.

khronokernel commented 2 years ago

Appreciate the offer but unfortunately not. This issue is not user space nor kernel space, this is an issue with the UEFI firmware. So any and all data from macOS is unfortunately worthless. The only way we can resolve this issue is either:

So from our perspective, this is mostly a lost cause unless the community plans to research and develop patch sets on their machines or people have machine's they're willing to donate. Someone had offered previously but had ghosted us after initial contact unfortunately

dgaastra commented 2 years ago

Dear sustainability friends,

I also have a machine like this, and would really appreciate if OpenCore would work successfully for it. The machine is super-fast, and as such, it would be a real waist to have to replace it due to Apple's UN-sustainability.

Thanks Dennis

owenzhao commented 2 years ago

For workaround, I would like to say there are possibility to keep using both 5K display and macOS 12. Just don't install this patch on the internal disk, install it on a usb drive.

If you want 5K display, just boot from internal disk and run macOS 11.

If you want try macOS 12, then boot from usb drive and choose the macOS 12. macOS could install on the internal disk. The display will be 4k.

If you install this patch to the internal disk, even in macOS 11, the display will not be 5K. So don't do that unless you are intent.

Ausdauersportler commented 2 years ago

You can have/leave OC installed on your internal disk. Just reset the PRAM on boot and hold alt/option on reboot and pick your Big Sur installation directly without booting OC.

dgaastra commented 2 years ago

@owenzhao: Sure, thanks, but that defeats the purpose of having main production systems running the current version of macOS without any compromises. Since several of my buds also have this 27" iMac 15,1, it is of great interest for us to get this working properly. The main feature of such iMacs is that 5K screen. Hopefully, there will be resolution to this problem soon.

turbomacs commented 2 years ago

I may have some insight. I tinker with iMacs, take them apart, rebuild them, upgrade them, etc.

The 2014 iMac 5K uses an A1 display. The 2015, B1, 2017, C1. Understand?

Ok, so when you try to use anything but an A1 display panel on a 2014 it will only display at 4K. For example if you take the display off of a 2015,17,19 iMac and connect it to a 2014 you’ll only get 4K and all the symptoms you guys describe.

2015 and up don’t suffer from this, all the display revisions are interchangeable. So you can put a 2014 display on a 2015,17,19 and you’ll get 5K. Put a 2019 display on a 2015 and you’ll get 5K.

Also all the physical display cables that connect the display to the logic board are interchangeable between any year.

I believe it has something to do with the A1 display having special firmware on board to help the Radeon 290X display at 5K….but who knows?

If I get some time I will put a B1 display on a 2014 and install Monterey and see if it displays at 5K.

Hope this helps.

dgaastra commented 2 years ago

I don't know it this helps:


AMD Radeon R9 M295X:

  Chipset Model:    AMD Radeon R9 M295X
  Type: GPU
  Bus:  PCIe
  PCIe Lane Width:  x16
  VRAM (Total): 4 GB
  Vendor:   AMD (0x1002)
  Device ID:    0x6938
  Revision ID:  0x0000
  ROM Revision: 113-C773AA-731
  VBIOS Version:    113-C773A1-014
  EFI Driver Version:   01.00.731
  Metal Family: Supported, Metal GPUFamily macOS 2
  Displays:
iMac:
  Display Type: Built-In Retina LCD
  Resolution:   Retina 5K (5120x2880)
  Framebuffer Depth:    30-Bit Colour (ARGB2101010)
  Main Display: Yes
  Mirror:   Off
  Online:   Yes
  Automatically Adjust Brightness:  Yes
  Connection Type:  Internal
LG HDR WQHD:
  Resolution:   3840x1600 (Ultra-wide 4K)
  UI Looks like:    3840 x 1600 @ 60.00Hz
  Framebuffer Depth:    30-Bit Colour (ARGB2101010)
  Mirror:   Off
  Online:   Yes
  Rotation: Supported
  Automatically Adjust Brightness:  No
  Connection Type:  Thunderbolt/DisplayPort
  Television:   Yes

Question: Would the external display still work?

turbomacs commented 2 years ago

Ok so today I got a minute and connected a B1 display and it still shows at 4K. If I can find a damaged unit, cracked screen but otherwise functional, to donate would that be ok?

dgaastra commented 2 years ago

Since Big Sur works with this iMac 15,1, would it not be possible for OpenCore to use parts of that driver?

moritzj29 commented 2 years ago

Just to support the relevance of this issue, I would also love to see 5K support for the iMac15,1! It is the key feature of the product and the performance of the system is still very high. So I would like to use it for another couple of years :)

lephitar commented 2 years ago

Good to read so much enthusiasm for this issue. This iMac is also my workhorse for photography and I'd love to keep it running a few more years up to date

sroby commented 2 years ago

@dgaastra: As previously mentioned this is an issue at the firmware level, hacking the Big Sur driver into Monterey wouldn't solve it.

ragian commented 2 years ago

A lot of us uses the iMac 5K so an hadware donation is not possible, but what about a fundraiser? A second hand iMac 5k Late 2014 costs about 1000€ on ebay, we can raise the fund and sent to the guys (or raise it, buy the iMac and sent it).

turbomacs commented 2 years ago

Like I said previously, I am willing to donate a 2014 iMac if the team is ok with the display glass being broken/cracked but otherwise working. You would need to throw some clear packing tape over the cracked areas to prevent cuts but it would give you a machine to test on. Is that acceptable?

EverlastEngineering commented 2 years ago

Like I said previously, I am willing to donate a 2014 iMac if the team is ok with the display glass being broken/cracked but otherwise working. You would need to throw some clear packing tape over the cracked areas to prevent cuts but it would give you a machine to test on. Is that acceptable?

Doing god's work right there. Props man. Hopefully the devs can take it and find a solution!

I have a question about the symptom: is the main issue that there is bad aliasing at 4K?

khronokernel commented 2 years ago

@turbomacs Hi, thank you so much for offering, really appreciate it! So long as the iMac is functional with respect to the the motherboard, screen as well as a stock drive, should be no issue.

My main concern is shipping, as sending a cracked iMac to Alberta, Canada would be quite costly as well as risking additional damages. Especially if you're located in the United States or even Europe.

Without doxxing your location, etc in the public issue, you can email me: khronokernel@icloud.com

turbomacs commented 2 years ago

@khronokernel I sent you an email.

EverlastEngineering commented 2 years ago

We're all here with fingers crossed. 😆

wesmosis commented 2 years ago

That sucks, I hope there is a solution since I have late iMac 5k Late 2014 (greets for a fellow albertan ^^)

dgaastra commented 2 years ago

Just checking in to see what the status is with our Alberta Magic. My wife is also from there.

Thanks Dennis

Jaaap commented 2 years ago

According to https://www.reddit.com/r/MontereyPatcher/comments/nz1896/working_great_on_imac_5k_late_2014/ it broke in beta8. Can we use the beta7 driver / firmware / files?

deadsunrise commented 2 years ago

According to https://www.reddit.com/r/MontereyPatcher/comments/nz1896/working_great_on_imac_5k_late_2014/ it broke in beta8. Can we use the beta7 driver / firmware / files?

That's me. Here's a couple of screenshots, the resolution is not completely correct but at least it works, beta 8 broke everything for me and I haven't tried to upgrade yet.

EDIT TO CLARIFY: No it does not work in 5k in beta 6

CleanShot 2021-11-15 at 18 04 58@2x CleanShot 2021-11-15 at 18 04 03@2x
Jaaap commented 2 years ago

Wait so does real 5k (5120 × 2880) work on beta6/7?

khronokernel commented 2 years ago

@Jaaap As mentioned at the start of this thread, this 5k output issue is entirely firmware based and was not introduced with macOS Monterey. Someone could boot Yosemite, Big Sur, etc and still have their display downgraded to 4k. Some firmware protocol is not being initialized and thus breaking if boot.efi is not the first loader to be started.

turbomacs's has offered to send a machine so I respectfully ask everyone in this thread to be patient and wait till I receive the machine. I am as eager as everyone else to reverse and better understand the iMac's firmware structure with regards to the dual DP handling, however due to the sheer complexity of this issue there's no simple solution that can be done from macOS's kernel/userspace.

turbomacs commented 2 years ago

@khronokernel I have procured the following iMac to donate. It is being shipped to me now. I will inspect it, update it to the latest version of Big Sur and verify firmware’s are the latest.

Late 2014 iMac 27” I5 3.5 8gb ddr3-1600 1tb fusion 2gb radeon 290x

Display is not cracked however there is a line of dead pixels present. See photo. Please email me the shipping address and I will send the tracking number when it ships.

E2B58B20-96C9-4074-8527-F8C87FFC0D55

turbomacs commented 2 years ago

Just an update. The donor iMac was delivered today. I didn’t get a chance to open it but I will tomorrow. Spirit of Jobs willing, I will ship it Friday for the long journey to Canada.

turbomacs commented 2 years ago

Another update: Updated to latest version of Big Sur. All firmware’s and boot roms updated to latest versions. DriveDX shows 90% life remaining on SSD portion of the fusion drive, so this machine has had light use.

Missed UPS pickup today but it will go out tomorrow.

Hope the team can make something out of this!

8B3B4F5B-8799-45D8-9369-C4738B6558D7
turbomacs commented 2 years ago

Just letting everyone know this shipped yesterday. I hope it helps! Please be sure to update this thread if you manage to get it fixed so I remember. Good luck!

sroby commented 2 years ago

Since this is firmware level, are there any chances that fixing this will also solve the issue of not being able to access native resolution under Linux as well? That would be pretty awesome if that's the case.

razordynamics commented 2 years ago

Outstanding news on the donor hardware! I was considering letting go of my Mid-2015 5K iMac (15,1 for .edu market), but now I think I'll hold onto it for a bit longer.

khronokernel commented 2 years ago

are there any chances that fixing this will also solve the issue of not being able to access native resolution under Linux as well?

Ideally yes! Assuming we can resolve this from UEFI land, all OSes should see a 5k display. Main concern however would be whether Linux' drivers will have a stroke seeing the dual DP output internally, but that's more of a concern for the Linux drivers to handle.

mth75 commented 2 years ago

any news :-) ?

dgaastra commented 2 years ago

Please let us know the Paypal accounts for the procurement and development where we can donate after you guys get this thing working correctly on our iMac 15,1 5K. Thanks Dennis

Ausdauersportler commented 2 years ago

Check this link….

khronokernel commented 2 years ago

Hello everyone! Just wanted to pop into to say the iMac15,1 arrived safely yesterday!

Right now she's sitting on the kitchen table running tests, and I must say it's a beautiful machine. Even played around with AirPlay to Mac as a 4k Display for my development laptop.

And just want to say huge thank you again to @Turbomacs for sending the machine! It's an honor to be donated such a machine and get to work with this community!

Regarding researching, I will be posting mini blog posts in here about my findings. However please be respectful about asking for timelines, as neither I nor our developers can predict when or even if we'll be able to resolve this 5k bug. However I promise everyone here that I will put the utmost effort into this project.

Bonus pic of the system in action! IMG_4227

khronokernel commented 2 years ago

iMac15,1 Research: Entry 1

So having the iMac for over a day, I was able to research and document some of the inital intricacies.

Affected Models

Unlike what was previously determined, it seems this 5k output bug affects all 5k iMacs potentially also including the iMac Pro.

We originally believed this issue to be isolated to 2014-2016 iMacs (15,1/17,1) however the issue was masked when Apple/AMD added 5k support to the Windows driver. Thus there are far less reports of output issues as well as complaints filed to Apple regarding this output issue.

Inital Observations: macOS

Once I got the machine in hand, my first set of tests were to dump system information from both a clean slate as well as with OpenCore booted to better see how macOS handles every case.

From initial use, I could clearly see that the system had a much higher scaling option set just from the login window. Signing in we see that 1080p HiDPI is set and About This Mac reports 3840x2160 resolution. However System Profiler reports 5k regardless, likely some hard coded resolution unlike the dynamic reporting elsewhere.

EDID Changes

After this, I started to probe EDID and found some interesting information. Namely the system changes Display Models and EDID outright when booting with OpenCore:

Display Resolution Model Vendor ID Product ID Supported Timings
Stock 5120x2880 APP Model ae03 1552 44547 Missing from EDID (labeled dummy block)
OpenCore 3840x2160 APP Model ae01 1552 44545 3840x2160, 3200x1800, 2560x1440

Here we can see the fall back 4k mode has a more complete EDID, and seems Apple wanted the 4k mode to be a complete compatibility layer to avoid any issues in Ones they don't have full control over. Additionally because of this EDID change, some machines may experience broken scaling as macOS's DisplayOverrides profiles do not match the Product ID expected.

IOService Changes

Looking into IOService, we can see Apple's display magic in effect.

On the GFX0 device (representing the R9 M290X), there are 4 total framebuffers present:

ATY,Namako@0 - Internal LCD     - LVDS 1.2 (0x2)
ATY,Namako@1 - Internal LCD     - LVDS 1.2 (0x2)
ATY,Namako@2 - External Display - DisplayPort 1.2 (0x400)
ATY,Namako@3 - External Display - DisplayPort 1.2 (0x400)

Here we can see Apple is tunneling 2 DisplayPort 1.2 streams to help drive the 5120x2880 display (Model ID ae03)

However once we boot via OpenCore, IOService changes:

ATY,Namako@0 - Internal LCD     - LVDS 1.2 (0x2)
ATY,Namako@1 - Empty            - LVDS 1.2 (0x2)
ATY,Namako@2 - External Display - DisplayPort 1.2 (0x400)
ATY,Namako@3 - External Display - DisplayPort 1.2 (0x400)

We see that macOS only registers a single active DisplayPort 1.2 stream into a new 3840x2160 display (Model ID ae01).

Inital Observations: UEFI

Doing a few tests, I was able to observe the following:

We can see that some section of the iMac's firmware is detecting whether it's booting an unsupported entry, and will tell the Display Controller to force a compatibly mode with a new EDID and thus lock out the second DisplayPort/LVDS stream.

Because of how this lock out happens, we have 2 options:

Closing Thoughts

From this initial testing batch, I've been able to learn quite a bit about how macOS and UEFI interacts with the system. Currently we still have many more tests to run in the coming weeks. Additionally we still need to research how Apple implemented the 5k Resolution fix in Windows back in 2016, as this will indicate to us how to best proceed.

EverlastEngineering commented 2 years ago

I love this. Following someone through the discovery and learning path is so utterly enjoyable, and one of my fav pastimes as well.

viking1304 commented 2 years ago

@khronokernel I can confirm that most of the things you wrote are applicable to iMac18,3 too. Without OC I have DisplayProductID of ae03 and with OC I am getting ae11. There is also one additional EDID block if I boot without OC.

but.. there are 6 frame buffers instead of 4 that you see with your model:

ATY,Florin@0 - 0x2 ATY,Florin@1 - 0x2 ATY,Florin@2 - 0x400 ATY,Florin@3 - 0x400 ATY,Florin@4 - 0x400 ATY,Florin@5 - 0x400

I only know how to see if display-type string is set to NONE or to something else, so I can't give you more information unless you instruct me how to see if it is internal or external display. I can see that with OC ATY,Florin@0 have display-type of LCD, and the other 5 have NONE.

Hope this helps at least a little.

If you need more information from me, just let me know.

macbookator commented 2 years ago

I tried to use AirPlay to Mac with my 16" Intel MBP and iMac 27" 5K 2014 over Wi-Fi, but there is a resolution issue too. I can't choose resolution other than 1920x1080 and 1280x720 both on extended and mirrored, although iMac's screen resolution is 2560x1440. And it looks very bad.

Is it related to same issue, or I should create a new issue?

Ekran Resmi 2021-12-07 18 32 36 Ekran Resmi 2021-12-07 18 31 31

Display Settings

Ekran Resmi 2021-12-07 18 34 07 AirPlay Settings

khronokernel commented 2 years ago

@macbookator That is a bandwidth issue, make sure both machines are hooked up directly via Ethernet or Thunderbolt to enable 4k output. AirPlaySupport determines whether both the sender and receiver can handle a continuous 4k stream, if not it'll lock the option out to the end user. Using Wifi is not enough

With my setup, I have a mini Network Switch behind the iMac that I use to hook the iMac and MacBook Pro up directly allowing 4k output:

Screen Shot 2021-12-05 at 2 48 18 PM
viking1304 commented 2 years ago

@macbookator I was typing almost the same message as @khronokernel, but he was faster. I already opened (and closed) this ticket since I now have exactly the same resolutions as him over Thunderbolt.

macbookator commented 2 years ago

I didn't try this way because I don't have Ethernet to Thunderbolt 3 or Thunderbolt 2 to Thunderbolt 3 cable. I'll try it soon. Thank you both.

khronokernel commented 2 years ago

iMac15,1 Research: Entry 2

Now having the machine for 2 days, I've been able to test some methodologies to try and trick the firmware into thinking we're only ever booting Apple supported enviroments.

Currently the main 2 "supported" UEFI enviroments would be boot.efi and diags.efi. The former being a loader for XNU, latter being the loader for Apple's Diagnostic Tests.

While I could go over the many failed attempts from today, I'll make this post semi short and sweet by showing the more sucessful entries.

diags.efi testing

With inital tests, I loaded up an ESP with Apple's Hardware Diagnostic Test to see where Apple "blessed" us with 5k output here. As semi expected, we did get 5k.

After this, I replaced /S*/L*/C*/.diagnostics/Drivers/HardwareDrivers/Fan.efi with OpenCore's loader and had the iMac boot diags.efi once again. And once I started the tests, OpenCore was triggered and I could see OpenCore's menu was rendered in 5120x2880!

Then booting into Monterey, we still retained 5k! Screen Shot 2021-12-07 at 5 58 39 PM

Closing Thoughts

Overall I'm quite amazed that we've found a solution already, even if a bit "hacky". I will still be doing more research to better understand why loading this way works and whether we can integrate this into OpenCore itself and remove the reliance on diags.efi itself.

And for users hoping for 5k AirPlay to Mac support, know that currently Apple's AirPlaySupport.framework maxes out at 4K HDR. Thus while the iMac in front of me is running at 5k in Monterey, connecting my MacBook Pro over ethernet unfortunately does not yield a 5k option.

Currently I do not know how this affects either Windows and Linux support, more research and testing will be needed. Additionally I will unlikely add this fix into mainline OCLP for a bit to ensure no additional issues occur under this setup. However I will most likely create a new branch for users to experiment with.

mth75 commented 2 years ago

Amazing! Great work you guys!

khronokernel commented 2 years ago

iMac15,1 Research: First Public Test

So after cleaning up the patch set a bit, we should be good to test our first public build. As expected, ensure you have a native OS you can return to in the event the build has unexpected issues.

Binary below is based on the 5k-display branch (commit fd26627)

Note: Github artifacts require you to be signed in to download.

ElreboCM commented 2 years ago

Great Job! Is it possible to install Monterey with the patcher on a USB drive?