daliansky / XiaoMi-Pro-Hackintosh

XiaoMi NoteBook Pro Hackintosh
BSD Zero Clause License
2.61k stars 474 forks source link

Using 4k@60Hz monitor #117

Open shilch opened 5 years ago

shilch commented 5 years ago

Hey,

I am having difficulties getting my Xiaomi Notebook Pro to run with the HP Envy 27s at 4k. It only shows 2560x1600 as max resolution when connecting with either HDMI (which should do 4k@30Hz) or DisplayPort via USB-C-(+Power-Delivery)-Adapter (which should do 4k@60Hz). I also tried to use SwitchResX which didn't help either. I believe this is due to the fact that the UHD 620 is faked to HD 620 which is known to have issues with 4k. There haven't been any issues when I booted from a GParted Live USB, 4k was working flawlessly with the Live USB.

Any ideas? Can we fake the UHD 620 to UHD 630 (which is used in the 2018 MacBooks)?

Thank you in advance!

stevezhengshiqi commented 5 years ago

Hi, you can try to open HiDPI in your external screen.

First, insert you screen and close the laptop lid. Second, run the script in https://github.com/xzhih/one-key-hidpi Third, restart and see whether it works.

Screen is not working if we fake with UHD 630 id, and it's not recommended by Clover and Whatevergreen. For example, in https://github.com/acidanthera/WhateverGreen/blob/master/WhateverGreen/kern_model.cpp, you can see { 0x5917, 0x5916, "Intel UHD Graphics 620" },.

shilch commented 5 years ago

Hey, thanks for the response.
I connected the screen, closed the lid and ran the script:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/master/hidpi.sh)"

Spoiler: one-key-hidpi script output ============================================ Note: I don't have an external monitor to test the script.If you have multiple monitors, please run the script on a single monitor, or cover the notebook when it is connected to the monitor. ============================================ Backing up... Password: (1) Enable HIDPI (2) Enable HIDPI (with patch) (3) Disable HIDPI Enter your choice [1~3]: 1 ------------------------------------ |********** Choose Icon ***********| ------------------------------------ (1) iMac (2) MacBook (3) MacBook Pro (4) LG Display (5) Remain as it is Enter your choice [1~5]: 5 ------------------------------------------ |********** resolution config ***********| ------------------------------------------ (1) 1080P Display (2) 2K Display (3) Manual input resolution Enter your choice: 3 Enter the HIDPI resolution, separated by a space,like this: 1680x945 1600x900 1440x810 :3840x2160 Enabled, please reboot. Rebooting the logo for the first time will become huge, then it will not be.

Then I rebooted. Unfortunately, that didn't change anything in the monitor settings.

stevezhengshiqi commented 5 years ago

Maybe the script is not perfect yet. You can try to manually add resolution according to Rehabman's instruction. Because I am not able to access an external monitor, I haven't tested yet.

shilch commented 5 years ago

Thanks for the link. I played a bit with the files and was able to make the monitor settings show higher resolutions. But if I select them, they are still only transmitted at 2560x1600@60Hz max (so I get a stretched screen). That means, macOS is not able to output higher resolutions.
I also ordered the official Xiaomi USB-C-to-Mini-DP Adapter which I should receive in a few days/weeks, maybe it works better with macOS. That still keeps me wondering why GParted didn't have any issues with the current adapter.
Edit: When using the same config file for HDMI (to test 4k@30Hz), I just get a black screen.

shilch commented 5 years ago

So, I just received the Xiaomi USBC-to-miniDP Adapter and a 4k-miniDP-to-DP cable and it still does not work. I tried it with the display overrides and switchResX. When I set 4k in switchResX, I get a black screen with sometimes a frame showing up for a fraction of a second (not a 4k frame though).

nanking commented 5 years ago

@shilch I have the same problem, I have a little progress now. But it's not perfect, because it looks a bit fuzzy, I think this is caused by the graphics driver.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/master/hidpi.sh)"

Spoiler: one-key-hidpi script output ============================================ Note: I don't have an external monitor to test the script.If you have multiple monitors, please run the script on a single monitor, or cover the notebook when it is connected to the monitor. ============================================ (1) Enable HIDPI (2) Enable HIDPI (with patch) (3) Disable HIDPI Enter your choice [1~3]: 1 ------------------------------------ |********** Choose Icon ***********| ------------------------------------ (1) iMac (2) MacBook (3) MacBook Pro (4) LG Display (5) Remain as it is Enter your choice [1~5]: 5 ------------------------------------------ |********** resolution config ***********| ------------------------------------------ (1) 1080P Display (2) 2K Display (3) Manual input resolution Enter your choice: 1 (do not use manual resolution)
shilch commented 5 years ago

@nanking Thank you! I will check out your configuration once I am next to my monitor and will report back.

shilch commented 5 years ago

I just had the chance to test the tool. I tried 1080p as well as 2k settings, both just overwrite the default display settings but the output resolution is still limited to 2560x1600.

ghostJun commented 5 years ago

你好,我和上面那位仁兄一样尝试了很多种方法,通过typc转miniDP转DP连接4k显示器,windows下可以实现4k60hz,但是黑果下只能实现2560x1600

请问下未来是否有完善的可能。

stevezhengshiqi commented 5 years ago

Today, I tested with 4K HDMI, and it works fine in 30Hz. screen shot 2019-01-16 at 00 58 19 I think the size of DVMT may make a difference. I increased my DVMT to 64MB by using the script in #8, and deleting framebuffer-fbmem and framebuffer-stolenmem.

shilch commented 5 years ago

@stevezhengshiqi Interesting, thanks the suggestion of increasing DVMT! I will try this later.
Is there a way to find out the current DVMT size?

stevezhengshiqi commented 5 years ago

Default is 32 MB.

shilch commented 5 years ago

I am not sure whether increasing DVMT to 64MB was successful.
I downloaded the exps5.5_en.zip, executed the Backup.cmd, executed the bios_unlock.cmd and then the DVMT_set.cmd. After restarting, I removed the framebuffer-fbmem and framebuffer-stolenmen from Clover. After another restart, macOS booted as before without any issues (would it have issues if DVMT was 32MB?). Now, using Displayport to connect to the 4k monitor does no longer work and HDMI still only allows 2560x1600 max.
I am not sure whether DVMT actually was set to 64MB (I had some PowerShell issues which I believe I fixed). Windows says that "Dedicated Video Memory" is set to 128MB which according to this table (source) means 128MB DVMT?!

shilch commented 5 years ago

I got, what I would at least call a partial success: While my external monitor is still black via DP, I was able to move the display configuration window over to my laptop screen:

image

The configuration looks different than before as the external monitor is now detected as HiDPI. Changing the resolution doesn't do anything though, the screen is still black. With HDMI, I don't get offered these settings, it's still limited to 2560x1600 and SwitchResX doesn't help either.

shilch commented 5 years ago

After adding back framebuffer-fbmem and framebuffer-stolenmem, connecting via DP works as before. But no HiDPI settings now.

stevezhengshiqi commented 5 years ago

@shilch Try to remove boot argument -cdfon in config.plist, and delete the two sets of data you mentioned above.

shilch commented 5 years ago

@stevezhengshiqi I don't have -cdfon in my boot argument list.
This is my config.plist:
config.plist.zip

stevezhengshiqi commented 5 years ago

Maybe you can try to use the latest config in the repository, ACPI tables/SMBIOS model may affect the HDMI. Also don't forget to close the lid for a few seconds and reopen it after connecting to HDMI.

shilch commented 5 years ago

I just removed my EFI stuff and used the new content from the repository. However, HDMI is still limited as before and DP results in a black screen (when removing framebuffer-fbmem and framebuffer-stolenmem). Do you mind sharing your EFI folder?

shilch commented 5 years ago

By the way, I just noticed that in your screenshot it says "Metal: Supported, feature set macOS GPUFamily1 v3" while for me it says "Metal: Supported, feature set macOS GPUFamily2 v1". Does this indicate a difference in graphic configuration?

shilch commented 5 years ago

bump

Mateo1234454545 commented 5 years ago

Today, I tested with 4K HDMI, and it works fine in 30Hz. screen shot 2019-01-16 at 00 58 19 I think the size of DVMT may make a difference. I increased my DVMT to 64MB by using the script in #8, and deleting framebuffer-fbmem and framebuffer-stolenmem.

For your information , you are right. For HIDPI to work we need DVMT set to 64mb in bios. When I changed it it worked. But , I don't recommend HIDPI for 2 reasons : 1) high battery consumprion. When HIDPI is enabled , dram is at 0,76. When off stays at 0,36. 2) fonts are blurry.

Can i ask something else ? Do you thing setting DVMT to 128 would have benefits ?

shilch commented 5 years ago

@Mateo1234454545 It looks like it shows "Metal: macOS GPUFamily1 v3" for you as well. Do you mind sharing your EFI or CLOVER folder?

stevezhengshiqi commented 5 years ago

@shilch That’s my sample screenshot which was quoted by him. I believe the Metal version is related to macOS version and has nothing to do with EFI. I am using 10.13.6.

FallenChromium commented 5 years ago

By the way, I'm having macOS GPUFamily 2 v1 P.S Mojave 10.14.3 On Wed, Jan 30, 2019, 1:53 PM Steve Zheng <notifications@github.com wrote:

@shilch https://github.com/shilch That’s my sample screenshot which was quoted by him. I believe the Metal version is related to macOS version and have nothing to do with EFI.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daliansky/XiaoMi-Pro/issues/117#issuecomment-458901039, or mute the thread https://github.com/notifications/unsubscribe-auth/ApNk8xL1JXsbB2jfV6htq4LoErZS8Kh4ks5vIXm_gaJpZM4ZKHar .

shilch commented 5 years ago

@stevezhengshiqi Oh, my fault 🤦‍♂️ Do you mind sharing your EFI folder? I am having a hard time getting 4k via HDMI or DP.

stevezhengshiqi commented 5 years ago

@shilch Sure, but I don't think my EFI folder would help you a lot. I leave only necessary kexts in CLOVER/kexts/Other, and change SMBIOS model to MacBook10,1 for stricter Graphics power control. CLOVER.zip

shilch commented 5 years ago

Thanks! I will run diff to see what's different.

Mateo1234454545 commented 5 years ago

@stevezhengshiqi , would you mind testing smbios macbookair 8,1 ? I'm using it right now and seems promising.

stevezhengshiqi commented 5 years ago

@Mateo1234454545 I am using HS 10.13.6, and it doesn't support macbookair8,1. Maybe other kind people are encouraged to test.

shilch commented 5 years ago

I had a partial success getting 4k working.
I installed Windows on my laptop (was using a Windows Live-USB before) to go through the whole dvmt process again. Since I switched from DP to HDMI a few weeks ago because DP did no longer work with macOS since removing these two framebuffer- settings, Windows connected to the external monitor via HDMI as well. To my surprise, Windows only got 2560x1600 as resolution. With Display-Port I got 4k@60Hz again. On the back of the monitor I have two HDMI ports, I was always using the one that was advertised as supporting 4k. Interestingly, when connecting to the other port, Windows as well as macOS support 4k.
Unfortunately, the HDMI version used in the Xiaomi Notebook Pro doesn't support 4k@60Hz. Any ideas how we can get 4k@60Hz via Display-Port?

alex-and-the commented 5 years ago

Hi, I'm having the same issue driving a 3840x1600 monitor. I've patched the DVMT to 64mb and removed the framebuffer data. I'm able to set the monitor at full resolution but I get a blank screen. However on one occasion, I woke the laptop from sleep and was able to get the monitor to work at full resolution. Any ideas?

stevezhengshiqi commented 5 years ago

@alex-and-the That's normal as README says, and you need reopen the lid if the internal screen is blank.

alex-and-the commented 5 years ago

Sorry, I wasn't clear in the previous post. I'm connecting to my external display via DP over USB C. I have no problems with the internal display, it's the external that is blank. Only on one occasion where I woke the laptop from sleep did I manage to get the external monitor to display a picture.

Mateo1234454545 commented 5 years ago

@shilch Sure, but I don't think my EFI folder would help you a lot. I leave only necessary kexts in CLOVER/kexts/Other, and change SMBIOS model to MacBook10,1 for stricter Graphics power control. CLOVER.zip

@stevezhengshiqi , how is macbook 10,1 compared to 14,1 or 15,2 ?

stevezhengshiqi commented 5 years ago

@Mateo1234454545 I don’t think there is much difference. CPUFriend and injected ig-platform-id determine the CPU and GPU performance in a large extent. In my case, geekbench score is almost the same for the three models.

leogcry22 commented 5 years ago

同样的问题,我是通过type-c转miniDP接4K显示器,最大输出分辨率只能选2560x1600,目前还是没有解决办法吗?

shilch commented 5 years ago

@leogcry22 I recently tried connecting via miniDP again and after a few seconds of black screen it worked at 4k@60Hz. After a restart I haven't been able to reproduce this again.

leogcry22 commented 5 years ago
WX20190319-175624@2x

现在miniDP外接可以正常输出4K了,但是不管是开缩放还是原生分辨率下,显示器上字体显示都很模糊

ghost commented 5 years ago

Hi, I'm having the same behaviour as the author of this post. I am using the same graphical configuration as is in the config.plist in this repo. USB-C and HDMI both give a max res of 1440P at 60Hz.

kydxone commented 5 years ago
WX20190319-175624@2x

现在miniDP外接可以正常输出4K了,但是不管是开缩放还是原生分辨率下,显示器上字体显示都很模糊

感觉看起来好像还可以.我是连4K都无法输出,一直只有2K的分辨率

Jyunta commented 5 years ago

https://github.com/daliansky/XiaoMi-Pro/issues/117#issuecomment-458505214 I guess you r right. I found a thread in tonymax about uhd620's similar problem. It said that dvmt pre-allocated requires 128MB for 4k-60hz.

I'm looking for ways to set dvmt as 128MB. I guess mabbe the bios doesn't support 128mb dvmt option.

shilch commented 5 years ago

@Jyunta Thanks for the tip, just tested setting to 128MB but it looks like I'm still at 96MB. I believe you can find out the DVMT by dividing that number on "About this Mac" by 16: 1536 / 16 = 96 - but I'm not sure.

image

@stevezhengshiqi Since it's working for you: Which number is shown for you on this window?

Nevermind, you also have 1536: https://github.com/daliansky/XiaoMi-Pro/issues/117#issuecomment-454467155

THUVAVA commented 5 years ago

I am now capable to use my extern 4k monitor in 4k@30Hz through both HDMI and type-c-2-miniDP. I followed the instruction to modify DVMT to 64MB and remove the framebuffer data.

![Uploading 屏幕快照 2019-05-12 下午9.58.17.png…]()

THUVAVA commented 5 years ago

However, when I switched to 4k@60Hz, the monitor went blank. The monitor turned to normal when I switched back to 4k@30Hz. I wonder if the 64MB-DMVT limit the performance. Does some of you have the way to set DMVT to 96MB?

THUVAVA commented 5 years ago
屏幕快照 2019-05-12 下午9 58 17 屏幕快照 2019-05-12 下午9 57 16
shilch commented 5 years ago

I can achieve 30Hz via HDMI as well, but I prefer lower resolution with higher frequency over 30Hz 4k.

@THUVAVA In the dvmt PowerShell file there's some hex number you can increase to set to higher than 64mb dvmt.

Menchen commented 5 years ago

Change sasetup_patched.txt to below for 128M DVMT, and flash the dvmt mod as before, NOT TESTED as I don't own 4k monitor.. so use it with your own risk!!! CAN BRICK YOUR COMPUTER And please do a backup before using below script. So if this don't work and your computer is bricked you can restore with some hardware programmer...

#************************************************************************************
Insyde H2OUVE (UEFI Variable Editor) Version 100.00.16.08
Copyright (c) 2012 - 2015, Insyde Software Corp. All Rights Reserved.

#************************************************************************************
#  Please follow file format to modify variable information.
#
#  File Format:
#
#   [Index] Variable Name
#          GUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
#          Attributes: 0xXX
#          DataSize: 0xXX
#          Data:
#                00000000: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 
#                00000010: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 
#                 .....                         .....
#  
#  1. Index is a number in Hex.
#  2. The number of data must be equal to datasize.(Except datasize = 0)
#  3. "X") represents a hex number.
#
#  Delete Variable:
#    Please modify datasize or Attributes value to zero.
#
#************************************************************************************

 [001] "SaSetup"
      GUID: 72C5E28C-7783-43A1-8767-FAD73FCCAFA4
      Attributes: 0x7
      DataSize: 0x1D9
      Data:
            00000000: 05 00 00 00 00 00 00 00 00 01 02 02 00 01 00 00 
            00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
            00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
            00000030: 00 17 59 00 00 00 00 01 02 00 00 00 00 00 01 03 
            00000040: 00 03 01 01 01 00 01 FF 01 FF 00 00 00 00 00 04 
            00000050: 04 04 03 03 03 02 02 02 00 00 00 00 00 00 01 01 
            00000060: 01 00 00 00 00 00 00 00 02 02 02 01 01 01 FF FF 
            00000070: FF 01 01 01 01 01 01 01 07 07 07 07 07 07 07 07 
            00000080: 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 
            00000090: 07 07 07 07 07 07 07 07 02 02 02 02 02 02 02 02 
            000000A0: 02 02 02 02 02 02 02 02 00 00 00 00 00 00 00 00 
            000000B0: 00 B8 0B 00 00 01 02 00 00 02 10 27 02 00 02 00 
            000000C0: 00 00 00 00 00 4B 4B 4B 01 00 02 00 03 00 00 00 
            000000D0: 00 0A 00 0A 00 0A 00 04 04 04 00 1A 00 0B 00 04 
            000000E0: 02 00 00 01 00 01 01 02 00 00 00 01 00 00 01 02 
            000000F0: 00 01 04 04 04 04 07 07 07 07 02 02 02 02 03 03 
            00000100: 02 00 01 01 04 02 2C 01 64 00 02 1F 00 01 00 00 
            00000110: 00 00 00 01 01 00 00 02 01 20 03 00 00 18 01 07 
            00000120: 00 01 00 01 01 00 01 00 00 04 0C 00 03 00 00 00 
            00000130: 01 01 01 01 01 01 01 01 01 01 01 01 00 01 01 01 
            00000140: 01 01 01 01 01 01 01 01 01 00 00 01 01 01 00 01 
            00000150: 01 01 00 00 00 01 01 00 01 01 00 04 00 00 00 01 
            00000160: 0A 00 DE 00 00 00 00 00 00 FF FF FF FF FF FF FF 
            00000170: FF FF FF FF FF FF FF FF FF 0A 0A 06 06 AC AC D4 
            00000180: D4 DD DD 0A 0A 06 06 AC AC D4 D4 DD DD 01 00 02 
            00000190: 00 30 01 40 00 00 00 00 00 01 00 00 00 01 00 01 
            000001A0: 00 0B 00 01 00 00 01 00 00 00 00 00 00 00 00 00 
            000001B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
            000001C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
            000001D0: 00 00 00 00 00 00 00 01 00 
shilch commented 5 years ago

Thank you @Menchen. Is this different from editing line number 19 in this file: https://github.com/daliansky/XiaoMi-Pro/blob/master/BIOS/DVMT_and_0xE2_fix/bin/patchscript_dvmt.ps1?

Menchen commented 5 years ago

@shilch It's the same. Have confirmed patching that file myself under windows VM. Noted 96M (0x03) is default after the patch, not 64M (There is also some DOS(bios) unit to macOS unit that's weir....). So changing to 0x04 make it 128M, recommended for 4K@60. All my modification is changing the last hex in 000000D0 from 01(32M) to 04(4x32M->128M), so theoretically it's pretty safe to flash...