From owner-freebsd-current@freebsd.org Thu Dec 3 07:05:53 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 3360D47C6DB for ; Thu, 3 Dec 2020 07:05:53 +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 4Cmn1D3Cqqz4t6F; Thu, 3 Dec 2020 07:05:52 +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 574F4ABE9; Thu, 3 Dec 2020 07:05:50 +0000 (UTC) Date: Thu, 3 Dec 2020 08:05:49 +0100 From: Ali Abdallah To: myfreeweb Cc: freebsd-current@freebsd.org, Hans Petter Selasky , Scott Long Subject: Re: Issues with USB-C external monitors Message-ID: <20201203070549.d7or5kb43jm3rztz@frix230> References: <20201201131430.ol7pzms24h743iwf@frix230> <342519ee-6f73-98be-29b1-cea7890ccb1e@selasky.org> <20201202102841.ysv52uc6oseuurwh@frix230> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3gegjkejxlz4nh2u" Content-Disposition: inline In-Reply-To: <20201202102841.ysv52uc6oseuurwh@frix230> X-Rspamd-Queue-Id: 4Cmn1D3Cqqz4t6F X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.70 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:195.135.220.15]; HAS_ATTACHMENT(0.00)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RWL_MAILSPIKE_GOOD(0.00)[195.135.220.15:from]; 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]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:+,5:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:29298, ipnet:195.135.220.0/22, country:DE]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DWL_DNSWL_MED(-2.00)[suse.com:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain,text/x-csrc]; MIME_BAD_ATTACHMENT(1.60)[c]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-current] X-Content-Filtered-By: Mailman/MimeDel 2.1.34 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: Thu, 03 Dec 2020 07:05:53 -0000 --3gegjkejxlz4nh2u Content-Type: multipart/mixed; boundary="rv2hyufnfu3ijhtj" Content-Disposition: inline --rv2hyufnfu3ijhtj Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 02.12.2020 11:28, Ali Abdallah wrote: > Actually Xorg on FreeBSD with UDEV is compiled with > --disable-config-udev-kms, thus the server never calls: >=20 > udev_monitor_filter_add_match_subsystem_devtype >=20 > for GPU devices, and thus libudev-devd doesn't forward kms events to the > server. Actually Xorg doesn't even process them, even if the filter check > is bypassed in libudev-devd (udev-monitor.c:261). >=20 > Basically Xorg is missing bsd platform code for drm devices, on Linux > the code that implements that can be found in: > hw/xfree86/os-support/linux/lnx_platform.c I'm attaching two patches that make hotpluggable drm connectors work on FreeBSD with xorg-server compiled with UDEV. If you want to give them a try, for libudev-devd it is enough to apply patch-libudev-devd-drm-hotplug.c, but for xorg-server you need to change its Makefile to enable udev-kms, and apply patch-xorg-server-drm-bsd-platfo= rm.c UDEV_CONFIGURE_ON=3D --disable-config-udev-kms to UDEV_CONFIGURE_ON=3D --enabled-config-udev-kms The bsd-platform code for the xorg-server is basically the same as Linux, expect for the systemd bit obviously. For now, I appended the code to hw/xfree86/os-support/bsd/bsd_VTsw.c just because I didn't want to patch the Makefile.in or Makefile.am and fight with autotools. But that code should finish in the future in bsd_platform.c. It is working perfectly fine for me, also got positive feedback from a friend using it on a Thinkpad X280 with a USB-C dock. The patches even for onboard connectors deliver for "complete" desktop plugging/unplugging external monitors events (such as Xfce, gnome, KDE), and then the external monitors are configured automatically. I will also later on work on DEVD support as well. Regards. --=20 Ali Abdallah | SUSE Linux L3 Engineer GPG fingerprint: 51A0 F4A0 C8CF C98F 842E A9A8 B945 56F8 1C85 D0D5 --rv2hyufnfu3ijhtj-- --3gegjkejxlz4nh2u Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEUaD0oMjPyY+ELqmouUVW+ByF0NUFAl/IjkkACgkQuUVW+ByF 0NUsCA/9Hc2GWzRh2jU21Cl3p57lW5+/jkeUqYt6xko7CN16DDDRLDCtTzBB2Ulx 3EWD35NEjB0Gti7OBoQV9EopIHxbu5DXxdbZEn9P3wF6ZQmLSPG+kkGucaEaeXFf ScNbWoBKLs7g7lqgORHjFS4/vKiVNB5CZ0D9cAgOeNAQClOGzkjwyCRWujGz8kzd SmOzLdmuNpLpL5EactupsJnFuKFDA6IG8c0kWTpVx4TG2ggO0twQjaP4L+pOaP/1 qRAgYIZUIA4DlhmCqjwQXr+VhHtzK1w8WOk6xx/4nnyt05gEu5mkrYLakdqouuvN WuBWhTENWkux5f5qP6jzcGjEqEsvzYFZoVkhZTr/X4aShe6a8ThVABNNUFL0oJTC hJAYNe45jdxvwDEOulFbLWs1yL5bvwQ0PV4CDQTP1jWgLEWYGJc4uGmvqhSYE7gg IQk9zV4fZoPRM8mBWzhGK8avytZKPA/kMJjF7to/Cc3g0/VPPZXNNF2iAJyF9bY9 CZycBmaYH9GWVFlVKumAACFKODegwexZec4epqsJMEDmWpCbXudNS2UqQ//jjxw0 MDXgiJMWTgsue/gp08usuNgOLJmyWeRX73quej7rr85QDmS+Ris+0ReY5PBtIGsW npLxdm/hHqa222nbcYvXrby0VtBzRSm5ICQJDgtF2Hmij9koHh8= =XCZ9 -----END PGP SIGNATURE----- --3gegjkejxlz4nh2u--