From owner-freebsd-current@freebsd.org Tue Dec 1 13:14:34 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15F4B4A9691 for ; Tue, 1 Dec 2020 13:14:34 +0000 (UTC) (envelope-from ali.abdallah@suse.com) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.suse.de", Issuer "Let's Encrypt Authority X3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CljHY1XTTz3mNj for ; Tue, 1 Dec 2020 13:14:32 +0000 (UTC) (envelope-from ali.abdallah@suse.com) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 191FCAC55 for ; Tue, 1 Dec 2020 13:14:31 +0000 (UTC) Date: Tue, 1 Dec 2020 14:14:30 +0100 From: Ali Abdallah To: freebsd-current@freebsd.org Subject: Issues with USB-C external monitors Message-ID: <20201201131430.ol7pzms24h743iwf@frix230> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Queue-Id: 4CljHY1XTTz3mNj X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.20 / 15.00]; MID_RHS_NOT_FQDN(0.50)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_MED(-2.00)[suse.com:dkim]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:195.135.220.15]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[195.135.220.15:from]; RCPT_COUNT_ONE(0.00)[1]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCVD_IN_DNSWL_MED(-0.20)[195.135.220.15:from]; DKIM_TRACE(0.00)[suse.com:+]; DMARC_POLICY_ALLOW(-0.50)[suse.com,quarantine]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:29298, ipnet:195.135.220.0/22, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-current] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:14:34 -0000 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]); 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? Regards, Ali.