From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Julian Orth <ju.orth@gmail.com>
Cc: "Michel Dänzer" <michel.daenzer@mailbox.org>,
"Nicolas Frattaroli" <nicolas.frattaroli@collabora.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Louis Chauvet" <louis.chauvet@bootlin.com>,
"Haneen Mohammed" <hamohammed.sa@gmail.com>,
"Melissa Wen" <melissa.srw@gmail.com>,
"Daniel Stone" <daniel.stone@collabora.com>,
"Ian Forbes" <ian.forbes@broadcom.com>,
"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel@collabora.com, wayland-devel@lists.freedesktop.org,
"Marius Vlad" <marius.vlad@collabora.com>,
"Imre Deak" <imre.deak@intel.com>
Subject: Re: [PATCH RESEND v7 0/2] Pass down hot-plug CONNECTOR ID to user-space
Date: Fri, 17 Apr 2026 17:36:26 +0300 [thread overview]
Message-ID: <aeJFarMGjG0ruFy8@intel.com> (raw)
In-Reply-To: <CAHijbEW7ZUSAf4HWBGnzC5fOYT9cbQNPNkzL3rL5w8k_-bME3w@mail.gmail.com>
On Fri, Apr 17, 2026 at 02:36:11PM +0200, Julian Orth wrote:
> On Fri, Apr 17, 2026 at 12:58 PM Ville Syrjälä
> <ville.syrjala@linux.intel.com> wrote:
> >
> > On Fri, Apr 17, 2026 at 09:49:36AM +0200, Michel Dänzer wrote:
> > > On 4/16/26 15:16, Julian Orth wrote:
> > > > On Thu, Apr 16, 2026 at 9:46 AM Nicolas Frattaroli
> > > > <nicolas.frattaroli@collabora.com> wrote:
> > > >> On Wednesday, 15 April 2026 20:57:53 Central European Summer Time Julian Orth wrote:
> > > >>> On Wed, Apr 15, 2026 at 8:19 PM Nicolas Frattaroli
> > > >>> <nicolas.frattaroli@collabora.com> wrote:
> > > >>>>
> > > >>>> This series addresses a shortcoming whereby a hot plug event is sent
> > > >>>> without it being passed the actual connector that caused it. This takes
> > > >>>> into consideration both the polling path and the HPD (Hot Plug Detect)
> > > >>>> path. It also adds support for the vkms driver (using ConfigFS) for
> > > >>>> propagating the connector ID when changing the connector's status.
> > > >>>>
> > > >>>> The motivation is that user-space applications such as Weston would
> > > >>>> previously receive non-connector-specific hotplug events, and then have
> > > >>>> to figure out themselves which connector needs to have a modeset
> > > >>>> executed on. This notably did not work when the hotplug events came in
> > > >>>> too fast, resulting in Weston missing an on-off-on transition of a
> > > >>>> connector, seeing that its state was unchanged from "on" so can't be the
> > > >>>> one that was hotplugged, and skipping reinitialising it as it looks
> > > >>>> through the other connectors that could've caused it.
> > > >>>
> > > >>> Have you considered adding a u64 serial number as a DRM connector
> > > >>> property that is incremented every time the connector changes in some
> > > >>> way? Userspace could then check this serial number to see if the
> > > >>> connector has changed since the last time it queried the serial
> > > >>> number.
> > > >>
> > > >> The connector internally already has an epoch_counter member which
> > > >> could be used for this. However, for the particular thing this
> > > >> series fixes, I don't think exposing it through the uAPI is necessary
> > > >> or desirable. Sending hotplug events specific to the connector does
> > > >> not need any additional handling on the userspace side as long as it
> > > >> already listens to the per-connector hotplug events in order to
> > > >> avoid the pitfall described in the cover letter.
> > > >
> > > > I currently do not handle per-connector hotplug events. Instead,
> > > > whenever I get a UDEV change event for a device, I re-fetch the entire
> > > > kernel state for the device. That is
> > > >
> > > > - DRM_IOCTL_MODE_GETRESOURCES
> > > > - DRM_IOCTL_MODE_OBJ_GETPROPERTIES for each connector, crtc, plane
> > > > - DRM_IOCTL_MODE_GETCONNECTOR for each connector
> > > > - DRM_IOCTL_MODE_GETPROPERTY for each connector property
> > > > - DRM_IOCTL_MODE_GETPROPBLOB for the EDID
> > > >
> > > > Once I have the new state, I compare it against the desired compositor
> > > > state and perform a modeset if necessary.
> > >
> > > mutter is doing something similar as well.
> > >
> > >
> > > Note that some are arguing a modeset is always required after a hotplug event, even if the state hasn't changed.
> > >
> > > The most convincing argument I've seen is the scenario of a GPU reset, after which a modeset is required to light up the displays again.
> >
> > GPU reset should relight the display on its own really. That's what
> > i915 does, albeit somewhat badly at the moment.
> >
> > > A hotplug event seems the only mechanism available for the kernel to request a modeset from the compositor. (The kernel may not be able to reliably do the modeset on its own, e.g. due to interactions with user-space atomic commits)
> >
> > There's nothing preventing the kernel from doing extra atomic
> > commits whenever it wants. But if you want to punt the thing to
> > userspace then the kernel must set the link-status property to
> > bad, and then fire the hotplug uevent.
> >
> > > If this "modeset required after hotplug event" rule is confirmed, it means that after a hotplug event without connector ID, the compositor must do a modeset for all connectors.
> >
> > Only for connectors where things changed, or the link-status shows bad.
> >
> > >
> > >
> > > P.S. https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/14420#note_2984697 even argued that two modesets are required after a hotplug event, one which turns things off and another one which turns them on again. I don't agree with that though, a single modeset should suffice.
> >
> > The actual argument is that you should not defer the hotplug
> > handling when things get disconnected, mainly because of crap type-c
> > firmware.
> >
> > I think the userspace behaviour there was that you get a disconnected,
> > defer processing it, and then you get a reconnect, and then decide that
> > nothing actually changed and a modeset is not needed after all. That is
> > not correct IMO. Clearly a ->disconnect->reconnect should count as a
> > change in the connector's state, and a full modeset is thus required.
> > The kernel can of course then decide that the full modeset is not
> > actually required and skip the modeset part during the commit. But
> > userspace cannot make that determination.
> >
> > I suppose what we could maybe do there to force userspace's hand is set
> > the link-status to bad already when the thing gets disconnected, and keep
> > it like that until a full disable+re-enable cycle has been done. Then
> > userspace could not think that the ->disconnect->reconnect is a NOP
> > (which I still think is incorrect behaviour).
>
> I don't think the kernel can make the assumption that userspace sees
> any udev events. For example, say such a disconnect/reconnect cycle
> happens that leaves the connector in a state that would require two
> modeset. Nobody acts on these modesets and some time later the
> compositor starts. Obviously the compositor is not going to receive
> any udev events for the disconnect/reconnect cycle that happened long
> ago. This would leave the connector in a permanently unusable state.
I'm not sure why those outputs would even be enabled if there is
no one around to do kms stuff? Though I suppose there might be some
race conditions if you are switching drm masters exactly when the
uevents are sent.
We do have a sort of plan to always do the disconnect disable from
the kernel, but we can't just disable everything the normal way
as we're not allowed to corrupt the uapi kms state. So the idea
is we'd disable everything internally, and fake it so that
userspace still sees it as enabled. But no one has actually
implemented this so far.
A potential short term solution might be to disable+re-enable
(in our current fallback tbt mode) automagically on disconnect.
But that extra re-enable is not something we actually want in
case userspace is going to do its job properly. Instead of
having one disable modeset on disconnect, we'd always end up
with disable+re-enable+disable. Though I suppose one option
would be to defer the internal disable+re-enable a little bit
to give userspace some time to do its job.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-04-17 14:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 17:59 [PATCH RESEND v7 0/2] Pass down hot-plug CONNECTOR ID to user-space Nicolas Frattaroli
2026-04-15 17:59 ` [PATCH RESEND v7 1/2] drm: Introduce pending_hp to drm_connector Nicolas Frattaroli
2026-04-15 17:59 ` [PATCH RESEND v7 2/2] drm: Send per-connector hotplug events Nicolas Frattaroli
2026-04-15 18:57 ` [PATCH RESEND v7 0/2] Pass down hot-plug CONNECTOR ID to user-space Julian Orth
2026-04-16 7:45 ` Nicolas Frattaroli
2026-04-16 13:16 ` Julian Orth
2026-04-16 13:35 ` Marius Vlad
2026-04-16 13:55 ` Julian Orth
2026-04-16 14:21 ` Nicolas Frattaroli
2026-04-16 15:27 ` Julian Orth
2026-04-17 7:49 ` Michel Dänzer
2026-04-17 10:57 ` Ville Syrjälä
2026-04-17 12:18 ` Julian Orth
2026-04-17 12:36 ` Julian Orth
2026-04-17 14:36 ` Ville Syrjälä [this message]
2026-04-17 12:42 ` Nicolas Frattaroli
2026-04-17 14:16 ` Ville Syrjälä
2026-04-17 15:00 ` Nicolas Frattaroli
2026-04-17 15:19 ` Ville Syrjälä
2026-04-17 14:17 ` Michel Dänzer
2026-04-17 14:55 ` Ville Syrjälä
2026-04-17 16:40 ` Michel Dänzer
2026-04-17 18:50 ` Ville Syrjälä
2026-04-17 14:25 ` Alex Deucher
2026-04-17 14:29 ` Michel Dänzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aeJFarMGjG0ruFy8@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@gmail.com \
--cc=daniel.stone@collabora.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=ian.forbes@broadcom.com \
--cc=imre.deak@intel.com \
--cc=ju.orth@gmail.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=louis.chauvet@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marius.vlad@collabora.com \
--cc=melissa.srw@gmail.com \
--cc=michel.daenzer@mailbox.org \
--cc=mripard@kernel.org \
--cc=nicolas.frattaroli@collabora.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=wayland-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox