Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No internal display after disconnecting external displays #69

Closed
Chivs opened this issue Jul 22, 2020 · 32 comments
Closed

No internal display after disconnecting external displays #69

Chivs opened this issue Jul 22, 2020 · 32 comments
Labels
I/O USB, SD Card Reader, and/or Thunderbolt Issues

Comments

@Chivs
Copy link

Chivs commented Jul 22, 2020

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
Copy link
Contributor

@Chivs for my acpi-patches: #28 (comment)

@benbender
Copy link
Contributor

benbender commented Jul 22, 2020

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
Copy link
Contributor

Porco-Rosso commented Jul 22, 2020

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:

  • open the display
  • press power
  • wait for the pc to come out of sleep
  • login
  • unplug the HDMI or TB3
  • replug the HDMI/TB3
  • close the display while hitting a key on my bt keyboard/mouse

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
Copy link
Contributor

@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
Copy link
Contributor

Porco-Rosso commented Jul 22, 2020

@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
Copy link
Contributor

@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
Copy link
Contributor

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
Copy link
Contributor

Let's sort a bit:

  • you are using "hibernatemode 3", which is S3 Persist to ram and fine.
  • Your internal display is not waking up on opening without further interaction, right?
  • HDMI/Displayport-problems may be a different bug, so let's put them aside for the moment and open another bug if applicable after resolving this one.

@Porco-Rosso
Copy link
Contributor

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
Copy link
Author

Chivs commented Jul 22, 2020

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:

  • Connect monitors via USB-C ports and close lid.
  • Sleep/wake works as normal, (assuming you open lid to wake as BT wake is not working)
  • Disconnect external monitors
  • Open lid, and screen remains black
  • Sleep wake on lid open/close continue to work, however display remains black.

@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
Copy link
Contributor

benbender commented Jul 22, 2020

Please test the following config.

It:

  • removes all sleep-related patches. They shouldn't be needed with working and complete usb-config anyways.
  • adds another approach to the LED-Wake-Problem
  • updates Whatevergreen to the latest git-version
  • adds acpi-wake-type device-property to the usb-controller
  • removes the connector-patch for hdmi as whatevergreen patches all connectors to hdmi on boot

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
Copy link
Owner

tylernguyen commented Jul 22, 2020

@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

@tylernguyen tylernguyen added the I/O USB, SD Card Reader, and/or Thunderbolt Issues label Jul 22, 2020
@benbender
Copy link
Contributor

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

@tylernguyen
Copy link
Owner

@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
Copy link
Contributor

Please test the following config.
It:

  • updates Whatevergreen to the latest git-version

;)

@Porco-Rosso
Copy link
Contributor

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

@Chivs
Copy link
Author

Chivs commented Jul 23, 2020

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,

  • The SSDT-TTS needed compiling, you had the dsl file in the attachment.

  • Referencing my earlier comment on ZWAK and ZPTS, if I pull the DSDT after boot under this config, ZWAK and ZPTS is not found. The original repo has renamed WAK and PTS to ZWAK to ZPTS, so I have no global ZPTS defined.

  • I added my own graphics changes to enable 4k as seen below:

      	<key>PciRoot(0x0)/Pci(0x2,0x0)</key>
      	<dict>
      		<key>AAPL00,override-no-connect</key>
      		<data>AP///////wAwrq5AAAAAAAAbAQSQHxF44vvVplM0tiUOUFQAAAABAQEBAQEBAQEBAQEBAQEB5l8AoKCgQFAwIDUAgGghAAAYj2YAoKCgLVAwIDUAgGghAAAY22cAoKCgKVAwIDUAgGghAAAYMGUAoKCgMFAwIDUAgGghAAAYADc=</data>
      		<key>AAPL,ig-platform-id</key>
      		<data>BAAnWQ==</data>
      		<key>device-id</key>
      		<data>FlkAAA==</data>
      		<key>framebuffer-con1-enable</key>
      		<data>AQAAAA==</data>
      		<key>framebuffer-con1-type</key>
      		<data>AAgAAA==</data>
      		<key>framebuffer-patch-enable</key>
      		<data>AQAAAA==</data>
      	</dict>
    

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

  • The LED fix doesn't work, on wake, the red LED continues to flash

  • I thought the BT wake worked once, and on the second sleep it did not however. Doing a pmset -g log, I get no output however. My pmset -g output is as follows:
    System-wide power settings:
    Currently in use:
    lidwake 1
    autopoweroff 1
    standbydelayhigh 86400
    autopoweroffdelay 28800
    standbydelaylow 10800
    standby 1
    proximitywake 1
    ttyskeepawake 1
    hibernatemode 0
    powernap 1
    gpuswitch 2
    hibernatefile /var/vm/sleepimage
    highstandbythreshold 50
    womp 1
    displaysleep 5
    networkoversleep 0
    sleep 5
    tcpkeepalive 1
    halfdim 1
    disksleep 10

  • After waking the laptop by opening the lid, the external monitors fixed up, but the internal screen remained black.

  • log show --last boot|grep -I kbl attached.
    dump.zip

@benbender
Copy link
Contributor

benbender commented Jul 23, 2020

Hey, I would try the following:

  • Disable SSDT-TTS out for the moment, its purely cosmetic
  • set hibernatemode to 3 ("sudo pmset -a hibernatemode 3"). Its the default on modern mac-laptops.
  • ZPTS & ZWAK are intentionally missing. Remover any redirects, renames, etc for them to test

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
Copy link
Author

Chivs commented Jul 23, 2020

Ok, so followed these steps:

  • Applied changes, rebooted
  • Cleared NVRAM
  • Rebuilt caches, rebooted
  • Cleared NVRAM

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

  • 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.

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

BTW Thanks for all this assistance, really appreciated.

@benbender
Copy link
Contributor

benbender commented Jul 23, 2020

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
Copy link
Author

Chivs commented Jul 23, 2020

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
Copy link
Contributor

  • 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
Copy link
Owner

tylernguyen commented Jul 27, 2020

@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
Copy link
Author

Chivs commented Jul 27, 2020

@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
Copy link
Contributor

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

@Chivs
Copy link
Author

Chivs commented Jul 27, 2020

@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
Copy link
Owner

@Chivs

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

tylernguyen pushed a commit that referenced this issue Aug 3, 2020
@tylernguyen
Copy link
Owner

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

@benbender
Copy link
Contributor

@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:

  • 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)

@Chivs
Copy link
Author

Chivs commented Aug 18, 2020

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
Copy link
Contributor

benbender commented Aug 18, 2020

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
Copy link
Author

Chivs commented Aug 21, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I/O USB, SD Card Reader, and/or Thunderbolt Issues
Projects
None yet
Development

No branches or pull requests

4 participants