Re: Issues with USB-C external monitors

From: myfreeweb <greg_at_unrelenting.technology>
Date: Tue, 01 Dec 2020 17:10:17 +0000
On December 1, 2020 2:00:55 PM UTC, Hans Petter Selasky <hps_at_selasky.org> wrote:
>On 12/1/20 2:14 PM, Ali Abdallah wrote:
>> Hello,
>> 
>> I have a T495 with a USB-C docking station with two external monitors,
>> running current to get the vega 10 amdgpu to work.
>> 
>> When the power is lost for on the USB-C dock, then the X server looses
>> all external monitors. They appear as disconnected after running xrandr
>> and I cannot figure out a way to bring them back without killing my
>> current session and start X again, but that is very annoying...
>> 
>> I tried to debug the issue and I'm pretty sure that the X server on
>> FreeBSD is not reconfiguring the drm connectors automatically.
>> 
>> Let's say I have DP-4 as external connector, when the power is lost,
>> DP-4 disappears, when the power is back, DP-4 re-appear again but in
>> unknown status.
>> 
>> $ sysctl sys.class.drm | grep DP-4
>> sys.class.drm.card0-DP-4.modes:
>> sys.class.drm.card0-DP-4.dpms: Off
>> sys.class.drm.card0-DP-4.enabled: disabled
>> sys.class.drm.card0-DP-4.status: unknown
>> 
>> Now just running a simple libdrm code to rescan the connectors:
>> 
>> __snippet__
>> res = drmModeGetResources(fd);
>> for (int i = 0; i < res->count_connectors; ++i) {
>>     conn = drmModeGetConnector(fd, res->connectors[i]);

Note: you can run graphics/drm_info instead of writing custom code.

>> After running the above code, the drm stack is somehow triggered to
>> re-read the DP-4.status, which appears now to be connected, but not
>> configured.
>> 
>> $ sysctl sys.class.drm | grep DP-4
>> sys.class.drm.card0-DP-4.modes: 1920x1080
>> sys.class.drm.card0-DP-4.dpms: Off
>> sys.class.drm.card0-DP-4.enabled: disabled
>> sys.class.drm.card0-DP-4.status: connected
>> 
>> I didn't dig further to see if I can trigger the X server to re-scan drm
>> connectors and eventually remove those that vanished, and add newly
>> detected connectors. On Linux that seems to work automatically.
>> 
>> Any thoughts?

devd (really drm in the kernel) provides hotplug events (system DRM, type HOTPLUG).
libudev-devd translates these to UD_ACTION_HOTPLUG.
This works well with wlroots compositors at least.
How xorg does this I have no idea, as I don't use xorg.
If your xorg is built with DEVD instead of UDEV option, it shouldn't work, I don't recall anyone adding support for that there.
With UDEV it might work?

>There is missing code in the kernel to handle USB-C PCI express 
>attach/detach. CC'ing Scott Long.

Seems like this is about regular DisplayPort over USB-C (the USB side almost always handled in firmware for this on non-embedded computers).
I don't think I've ever seen a *monitor* connecting over PCIe to an existing GPU ;)
(in this case card0, the onboard vega)
Received on Tue Dec 01 2020 - 16:10:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:26 UTC