public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marius Vlad <marius.vlad@collabora.com>
To: Julian Orth <ju.orth@gmail.com>
Cc: "Nicolas Frattaroli" <nicolas.frattaroli@collabora.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.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
Subject: Re: [PATCH RESEND v7 0/2] Pass down hot-plug CONNECTOR ID to user-space
Date: Thu, 16 Apr 2026 16:35:00 +0300	[thread overview]
Message-ID: <aeDlhJjzS8sxumNn@xpredator> (raw)
In-Reply-To: <CAHijbEViae+=Fcnh3v0ODxwTPUaRgU1H4OVGM3VFPSLMPzJzOA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 7848 bytes --]

On Thu, Apr 16, 2026 at 03:16:39PM +0200, 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:
> > > >
> > > > I will be taking over this series from Marius Vlad.
> > > >
> > > > 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
With this change you wouldn't need to go over all of them as the kernel
will supply the connector ID that has changed.
> - 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.
> 
> This makes it robust against the situation you're describing, but also
> means that a lot of work is done for unchanged objects. If the change
> makes a modeset necessary, then that work is almost negligible
> compared to the time the modeset takes.
> 
> I don't know if your patches will cause more change events to be sent
> or if they will just add the connector property to existing events. If
> there are additional events, then I'd prefer to have an early out for
> some of this work. E.g. by having access to the epoch_counter.
> 
> >
> > Kind regards,
> > Nicolas Frattaroli
> >
> > > >
> > > > The real world implication is that on setups with slightly sketchy HDMI
> > > > connections, a brief flicker in the HPD signal could result in video
> > > > output bidding farewell entirely until a manual proper re-plug was
> > > > performed.
> > > >
> > > > By sending connector specific hotplug events, this ambiguity is
> > > > resolved without any change to the user-space API.
> > > >
> > > > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > > > ---
> > > > Changes in v7 RESEND:
> > > > - None, other than removing the leftover diffstat from the cover letter
> > > > - Link to v7: https://lore.kernel.org/r/20260217-hot-plug-passup-v7-0-f8221b2aab51@collabora.com
> > > >
> > > > Changes in v7:
> > > > - Drop the two vkms patches, as I don't want them to be blocked on
> > > >   review. I still think they're correct, but they're not essential and
> > > >   don't need to block this series.
> > > > - Link to v6: https://lore.kernel.org/r/20260123-hot-plug-passup-v6-0-aaaf61d960bb@collabora.com
> > > >
> > > > Changes in v6:
> > > > - Rewrote cover letter to explain the motivation for this series more
> > > >   plainly
> > > > - Rename "status_changed" to "pending_hp"
> > > > - Set "pending_hp" in the existing path that would also affect
> > > >   epoch_counter
> > > > - No longer set the boolean in drm_helper_probe_single_connector_modes,
> > > >   as it does not appear to be necessary
> > > > - Reword commits to better justify the changes
> > > > - Link to v5: https://lore.kernel.org/r/20251111162338.15141-1-marius.vlad@collabora.com/
> > > >
> > > > Changes in v5:
> > > > - vkms: add support for sending the CONNECTOR ID when hot-plugging through
> > > >   ConfigFS - as reported by Louis, vkms can now make use of ConfigFS to
> > > >   simulate connector status.
> > > > - vkms: add a small change to ignore previous/old drm connector status
> > > >   when sending out hot-plug uevent.
> > > > - Link to v4: https://lore.kernel.org/r/20251103174558.7709-1-marius.vlad@collabora.com/
> > > >
> > > > Changes in v4:
> > > > - removed the "This patch" bit - Dmitry
> > > > - added a short note when the flag is set and cleared - Dmitry
> > > > - address double dead-locking detected - kbot: https://lore.kernel.org/dri-devel/202509251410.fdfbcac3-lkp@intel.com/
> > > > - virtual connectors do not seem have any kind of hotplug - added
> > > >   polling in vkms - as noted by Ian
> > > > - Link to v3: https://lore.kernel.org/r/20250923083636.4749-1-marius.vlad@collabora.com/
> > > >
> > > > Changes in v3:
> > > > - Address comments from Dmitry:
> > > >   - guard connector status write with mode_config.mutex
> > > >   - avoid setting up the connector status and immediately unset it. Do the
> > > >     unset in drm_kms_helper_hotplug_event/drm_kms_helper_connector_hotplug_event
> > > > - Link to v2: https://lore.kernel.org/r/20250729165708.9947-1-marius.vlad@collabora.com/
> > > >
> > > > Changes in v2:
> > > > - Address comments from Daniel:
> > > >   - split patch into 2, one that introduces a bool to track connector
> > > >     connection status change and a patch that uses that to be able to send
> > > >     hot plug events with the proper CONNECTOR ID to udev and further pass
> > > >     that down to user-space
> > > >   - nuke out mutex when iterating connector list
> > > >   - fix typo
> > > > - Link to v1: https://lore.kernel.org/r/20250627131751.2004-1-marius.vlad@collabora.com/
> > > >
> > > > ---
> > > > Marius Vlad (2):
> > > >       drm: Introduce pending_hp to drm_connector
> > > >       drm: Send per-connector hotplug events
> > > >
> > > >  drivers/gpu/drm/drm_connector.c    |  1 +
> > > >  drivers/gpu/drm/drm_probe_helper.c | 39 +++++++++++++++++++++++++++++++++-----
> > > >  drivers/gpu/drm/drm_sysfs.c        |  2 ++
> > > >  include/drm/drm_connector.h        |  3 +++
> > > >  4 files changed, 40 insertions(+), 5 deletions(-)
> > > > ---
> > > > base-commit: 4c59525db84aca677fd9f052e662912ad9d88448
> > > > change-id: 20260121-hot-plug-passup-f8ed03f7c202
> > > >
> > > > Best regards,
> > > > --
> > > > Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > > >
> > >
> >
> >
> >
> >

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-04-16 13:35 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 [this message]
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ä
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=aeDlhJjzS8sxumNn@xpredator \
    --to=marius.vlad@collabora.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=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=melissa.srw@gmail.com \
    --cc=mripard@kernel.org \
    --cc=nicolas.frattaroli@collabora.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    --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