tylernguyen / x1c6-hackintosh

READMEs, OpenCore configurations, patches, and notes for the Thinkpad X1 Carbon 6th Gen 2018 Hackintosh
https://tylernguyen.github.io/x1c6-hackintosh/
The Unlicense
634 stars 109 forks source link

No internal display after disconnecting external displays #69

Closed Chivs closed 4 years ago

Chivs commented 4 years ago

When using the laptop with lid closed connected to two 4k monitors via Thunderbolt/USB-C, if you disconnect the external monitors in a grab-and-go fashion, opening the lid does not re-enable the internal display requiring a hard shutdown and reboot.

benbender commented 4 years ago

@Chivs for my acpi-patches: https://github.com/tylernguyen/x1c6-hackintosh/issues/28#issuecomment-649120727

benbender commented 4 years ago

Does the machine wakeup by opening the lid when not connected to an external monitor without pressing an additional key or similar? I just checked your usecase and it's working for me as expected. As I said, it depends on the _PRW-config in ACPI which is patched in this repo.

Working original config for LID-Device:

            Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
            {
                If (\LWCP)
                {
                    Return (Package (0x02)
                    {
                        0x17, 
                        0x04
                    })
                }
                Else
                {
                    Return (Package (0x02)
                    {
                        0x17, 
                        0x03
                    })
                }
            }

lid

Porco-Rosso commented 4 years ago

Please let me know if you manage to use BT devices to wake the PC. I am also using it in clamshell mode, but after putting the computer to sleep I must:

Needless to say this is a pain, and involves the displays rearranging/changing resolution several times.

I used to suffer from the black screen at wake problem, but some changes to the config by tylernguyen fixed it for me - albeit with HDMI. Not sure maybe it has to do with the TB3 running as a displayport vs. just USB C ?

benbender commented 4 years ago

@Porco-Rosso What mode of sleep are you talking about? And by TB3 you are talking about DisplayPort over USB-C, right? TB3 is a complete different topic and we shouldn't mix up. Also I have no TB3-Devices to test, so I can't help with that.

Blackscreens on HDMI where a bug on KabyLake-Framebuffers in Catalina with WhateverGreen afaik. In Github those bugs should be resolved, but they never occured to me in the first place.

Porco-Rosso commented 4 years ago

@benbender Sorry, not that knowledgable about the USBC/TB spec. I assumed that displayport (4k etc) would be carried over TB3, but it seems you have corrected me; it is over USB C.

I believe it is a regular sleep state:

2020-07-22 10:32:35 +0300 Wake                  Wake from Normal Sleep [CDNVA] : due to /Lid Open Using AC (Charge:96%)
2020-07-22 15:29:21 +0300 Wake                  Wake from Normal Sleep [CDNVA] : due to /UserActivity Assertion Using AC (Charge:95%)

As for my HDMI situation (not in the office to test with usb-c display) It works, but upon wake does not seem to detect the display. I need to unplug it and replug it in to re-discover. Simply waking does not power on or wake the display.

benbender commented 4 years ago

@Porco-Rosso Nope - its "DisplayPort over USB-C"[1] and has nothing to do with Thunderbolt or its controller in the thinkpad Please post the output of "pmset -g" to see what sleepmode you are using.

[1] https://www.displayport.org/displayport-over-usb-c/

Porco-Rosso commented 4 years ago

Here it is:

System-wide power settings:
Currently in use:
 lidwake              1
 autopoweroff         1
 standbydelayhigh     86400
 autopoweroffdelay    28800
 standbydelaylow      10800
 standby              1
 proximitywake        1
 ttyskeepawake        1
 hibernatemode        3
 powernap             0
 gpuswitch            2
 hibernatefile        /var/vm/sleepimage
 highstandbythreshold 50
 womp                 0
 displaysleep         0
 networkoversleep     0
 sleep                0 (sleep prevented by UserEventAgent, backupd-helper, backupd, backupd)
 tcpkeepalive         0
 halfdim              1
 disksleep            10
benbender commented 4 years ago

Let's sort a bit:

Porco-Rosso commented 4 years ago

Correction, my internal display is indeed turning on with the lid opening. I am just not getting the external display to connect without a replug on the HDMI. As a separate issue, using a usbc-to-HDMI dock also fails to detect the resolutions available.

Sorry to detract, I thought there might be some overlap but that does not seem to be the case. I will wait for this issue to be resolved and will raise my inconveniences later.

Like I mentioned, I used to have the same issue as @Chivs but the latest EFI resolved these issues. Maybe clearing NVRAM might help?

Chivs commented 4 years ago

Does the machine wakeup by opening the lid when not connected to an external monitor without pressing an additional key or similar? I just checked your usecase and it's working for me as expected. As I said, it depends on the _PRW-config in ACPI which is patched in this repo.

Yes, wakeup via LID is fine.

The exact repo steps are as follows:

@Porco-Rosso issue via HDMI is a separate issue which I also experienced. Single monitor connected by HDMI will not wake up after lid open.

benbender commented 4 years ago

Please test the following config.

It:

Report back afterwards. In case of further problems, pls paste a recent "pmset -g log"-output beginning with the according "sleep"-event until the full wake incl. display and the output of "log show --last boot|grep -i kbl" to see what the framebuffer is doing.

OC.zip

tylernguyen commented 4 years ago

@Chivs @Porco-Rosso Do you have the appropriate internal display EDID override installed? See patches/Internal Displays/

At least your HDMI replug issue is related to that @Porco-Rosso

benbender commented 4 years ago

@tylernguyen this is more like a mitigation afaik. The underlying bug should be this one in WEG: https://github.com/acidanthera/WhateverGreen/commit/677b48631a5c904c4b74bcc40ec6e12cb27e2179

tylernguyen commented 4 years ago

@tylernguyen this is more like a mitigation afaik. The underlying bug should be this one in WEG: acidanthera/WhateverGreen@677b486

Yeah, I'm thinking that it is up to WEG developers also. Meanwhile, if applying an EDID override still does not fix this issue, @Chivs @Porco-Rosso , you guys should try testing: force-online, complete-modeset, and complete-modeset-framebuffers to the iGPU device.

benbender commented 4 years ago

Please test the following config. It:

  • updates Whatevergreen to the latest git-version

;)

Porco-Rosso commented 4 years ago

Yes, I have the EDID override, will doublecheck but will try the iGPU tests you are suggesting as well

Chivs commented 4 years ago

Report back afterwards. In case of further problems, pls paste a recent "pmset -g log"-output beginning with the according "sleep"-event until the full wake incl. display and the output of "log show --last boot|grep -i kbl" to see what the framebuffer is doing.

OC.zip

Ok, so I ran some tests using your config and ACPI files. Couple of points first,

Using the updated config, here's what I found.

benbender commented 4 years ago

Hey, I would try the following:

Additionally test the following framebuffer-config:

                        <dict>
                                <key>AAPL,GfxYTile</key>
                                <data>AQAAAA==</data>
                                <key>AAPL,ig-platform-id</key>
                                <data>BQDAhw==</data>
                                <key>AAPL00,override-no-connect</key>                                   
                                <data>AP///////wAwrq5AAAAAAAAbAQSQHxF44vvVplM0tiUOUFQAAAABAQEBAQEBAQEBAQEBAQEB5l8AoKCgQFAwIDUAgGghAAAYj2YAoKCgLVAwIDUAgGghAAAY22cAoKCgKVAwIDUAgGghAAAYMGUAoKCgMFAwIDUAgGghAAAYADc=</data>
                                <key>device-id</key>
                                <data>FlkAAA==</data>
                                <key>hda-gfx</key>
                                <string>onboard-1</string>
                                <key>model</key>
                                <string>Intel UHD 620</string>
                        </dict>

From your logs FB0 (internal display) is waking up. So lets eliminate stuff that could interfere and try a more modern framebuffer.

Chivs commented 4 years ago

Ok, so followed these steps:

Tried three times now and display is waking up properly. I am finding a couple of other quirks, which may be unavoidable.

BTW Thanks for all this assistance, really appreciated.

benbender commented 4 years ago

Just to be sure: use "pmset restoredefaults" to reset your pm-settings.

Just to clearify: What resolution does your external monitor use? If 4k, which method/patches are you using? When you refer to sleep/wake up, we are now talking about hibernatemode 3/S3 with pulsating power-light, right?

  • Occasionally one of the monitors does not wake up properly, usually the one directly connected via USB-C (the other is on the Apple USB-C media dongle) connected to other USB-C port
  • The monitor connected via the dongle only reports 30Hz, consistently, although I have managed to get both @ 60Hz rarely, so I think there are still some issues with the USB-C ports.

Might be a cached edid. Check if it can be changed with https://github.com/avibrazil/RDM.

  • BT wakeup is still failing, despite the additional injection and lack of PRW/WAK overrides.

BT on mac is connected on mac via UART afaik. I'm not sure if its even possible. Pls check if you can wake up the device via usb (mouse/keyboard f.e.)

BTW Thanks for all this assistance, really appreciated.

Sharing is caring ;)

EDIT: just checked about the method for the LED used in this repo and noticed I didn't checked before - just use https://github.com/tylernguyen/x1c6-hackintosh/blob/master/patches/SSDT-LED.dsl from the repo without any renames and delete my SSDT-TTS. Sorry about that!

Chivs commented 4 years ago

Just to be sure: use "pmset restoredefaults" to reset your pm-settings.

Done Just to clearify: What resolution does your external monitor use? If 4k, which method/patches are you using? When you refer to sleep/wake up, we are now talking about hibernatemode 3/S3 with pulsating power-light, right?

Both monitors are 4k, enabled via DVMT prealloc in BIOS

  • Occasionally one of the monitors does not wake up properly, usually the one directly connected via USB-C (the other is on the Apple USB-C media dongle) connected to other USB-C port
  • The monitor connected via the dongle only reports 30Hz, consistently, although I have managed to get both @ 60Hz rarely, so I think there are still some issues with the USB-C ports.

Might be a cached edid. Check if it can be changed with https://github.com/avibrazil/RDM.

May be my mistake as the media dongle is HDMI 1.4 which I believe limits to 30Hz

  • BT wakeup is still failing, despite the additional injection and lack of PRW/WAK overrides.

BT on mac is connected on mac via UART afaik. I'm not sure if its even possible. Pls check if you can wake up the device via usb (mouse/keyboard f.e.)

Good question. No, a USB mouse plugged in does not wake the laptop.

benbender commented 4 years ago
  • Occasionally one of the monitors does not wake up properly, usually the one directly connected via USB-C (the other is on the Apple USB-C media dongle) connected to other USB-C port
  • The monitor connected via the dongle only reports 30Hz, consistently, although I have managed to get both @ 60Hz rarely, so I think there are still some issues with the USB-C ports.

May be my mistake as the media dongle is HDMI 1.4 which I believe limits to 30Hz

Crosscheck on another machine/OS.

  • BT wakeup is still failing, despite the additional injection and lack of PRW/WAK overrides.

BT on mac is connected on mac via UART afaik. I'm not sure if its even possible. Pls check if you can wake up the device via usb (mouse/keyboard f.e.)

Good question. No, a USB mouse plugged in does not wake the laptop.

try the following: https://osy.gitbook.io/hac-mini-guide/details/usb-fix / https://github.com/osy86/USBWakeFixup

tylernguyen commented 4 years ago

@Chivs @Porco-Rosso Did you guys get a chance to try the patch I suggested? Here's an attachment if that makes it easier:

Config.plist.zip

Just add it on the my latest EFI folder and let me know if that resolves the issue.

Chivs commented 4 years ago

@Chivs @Porco-Rosso Did you guys get a chance to try the patch I suggested? Here's an attachment if that makes it easier:

Config.plist.zip

Just add it on the my latest EFI folder and let me know if that resolves the issue.

Gave it a try with @benbender updated DeviceProperties but it's a no go. Let laptop fall asleep with 2 monitors connected and lid closed. Opened lid to wake, and all screens except internal woke up.

Porco-Rosso commented 4 years ago

@Chivs That's weird. I just tried it and it worked for me. Do you have the 4k fix enabled?

Chivs commented 4 years ago

@Chivs That's weird. I just tried it and it worked for me. Do you have the 4k fix enabled?

Nope, have 4k by the DVMT-prealloc in BIOS.

I just tried by disconnecting external monitors before waking with lid and it worked, so it seems unreliable so far.

tylernguyen commented 4 years ago

@Chivs

Try it with a clean copy of my latest EFI. Don't forget to add EDID override.

tylernguyen commented 4 years ago

The latest commit, a598de6 should resolve this issue. Fix was to enforce complete modeset in iGPU

benbender commented 4 years ago

@tylernguyen Complete modeset is enforced for KabyLake-Framebuffers anyway. See https://github.com/acidanthera/WhateverGreen/blob/1.4.1/WhateverGreen/kern_igfx.cpp#L107.

I've recently changed my framebuffer to 591C0005 and tested every scenario here with success:

Chivs commented 4 years ago

I've recently changed my framebuffer to 591C0005 and tested every scenario here with success:

  • Close and open lid while connected via usb-c-DP. Display turned off and back on.
  • Sleep (hibernatemode 3) and wake (via USB-Keyboard connected to the USB-C-to-DP-Adapter) while lid is closed.
  • Sound works in every scenario via DP (when con1 is set to HDMI)

@benbender would you mind posting your OC folder/config. This has still been plaguing me together with sleep/wake unreliability. Additionally, are you also using the one-key-hidpi ?

benbender commented 4 years ago

Sure. Be aware that this is from a T480 (extremly similar to X1C6) but you'll need at least a different EDID. I'm also using macbookpro14,2 as a platform, because of the similarity of the hardware. Besides that, the system tries to mimic a genuine macbook while keeping the patches clean & minimal. Kexts are latest stable and left out for size (0C 0.6, WEG 1.4.1). Most stuff is really hotkeys and battery-patching. My system also has the patched bios.

OC Kopie.zip

Chivs commented 4 years ago

Thanks @benbender, I've created a new config based on your setup and getting decent results. Still some more testing to do as I've also flashed TB and switched to BIOS Assist disabled and getting around 1.00 PKG on battery. Promising so far.