Unplugging external monitor leaves laptop screen black

So I'm running FreeBSD 13.1-RELEASE-p3 on a laptop, and have observed that if I hot-unplug an external monitor that was working before, the built-in screen just goes totally black. There's a hint of a cursor, but it doesn't move when I move the trackpad (or external mouse). Non-dangerous key combinations like alt-tab don't nudge anything into appearing. However, nothing has crashed: I'm fortunate to have a laptop on which suspend/resume work, and if I close the laptop lid (which I have set to suspend) and re-open it a few seconds later to resume, the built-in display works again. I originally observed this with XFCE and speculated that it was an XFCE-specific issue, but have since switched over to MATE and the same problem occurs. I know it's not hardware related because until a few weeks ago I was running GhostBSD with MATE, and unplugging the monitor there did not do this (it did sometimes keep the external display "alive" after disconnect until I opened the display settings applet, but I digress).

Does anyone have any ideas how to diagnose and fix this? Is there some obvious setting I'm missing, either system-wide for Xorg or specific to MATE? Worst case I guess in principle I could dig into the suspend/resume scripts and see if there's something in there I could trigger from the console rather than suspending and resuming, but I'd rather just have the screen not go blank until I manually intervene.
 
When booting enable verbose logging. Look at and save bits of /var/log/messages as you plug/unplug the monitor, also messages from suspend through to resume.

Video state is saved then reset on resume; could be clues reported there.

Some BIOS have options re built-in and/or external display selection.

Importantly, make/model of laptop? Is it running the most recent BIOS available?
 
Nothing relevant shows up in /var/log/messages or dmesg output, even with rc_debug and rc_info set. I don't think it's a BIOS issue because I haven't changed any BIOS settings since this worked just fine with GhostBSD.

I'm running on a Lenovo X1 Carbon 6th gen, with the most recent BIOS release (I have checked this).

You mention that video state is saved and reset on resume: do you know a specific place I could look at this information or what the reset process entails?
 
First step is look at xrandr output. See how the laptop screen shows up and how the external monitor connects.

Wild guess is when you plug in external monitor it is grabbing display id. Start at xrandr and see whats what.
 
Nothing relevant shows up in /var/log/messages or dmesg output, even with rc_debug and rc_info set. I don't think it's a BIOS issue because I haven't changed any BIOS settings since this worked just fine with GhostBSD.

For maximal logging I have boot_verbose=YES plus verbose_loading=YES in /boot/loader.conf and hw.acpi.verbose=1 in /etc/sysctl.conf .

I'm running on a Lenovo X1 Carbon 6th gen, with the most recent BIOS release (I have checked this).
Ok, nice.

You mention that video state is saved and reset on resume: do you know a specific place I could look at this information or what the reset process entails?

Not specifically, and not on 13.1. You should see messages around setting ACPI power state D2 or D3 on suspend, and restoring state D0 on resume? I imagine the latter is when it comes good.

Anything else about / around \_SB_.PCI0.VID_ might hold a clue. Sorry, that's all that springs to mind just now.
 
Back
Top