From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: "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>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel@collabora.com, wayland-devel@lists.freedesktop.org,
"Marius Vlad" <marius.vlad@collabora.com>
Subject: Re: [PATCH RESEND v7 2/2] drm: Send per-connector hotplug events
Date: Mon, 20 Apr 2026 17:59:30 +0200 [thread overview]
Message-ID: <r-xBuaTfSk6trETBz3ToHw@collabora.com> (raw)
In-Reply-To: <lmrord5zegfnpuemhbrbyxxhjisetghs4aryt6mf7yd7ej72kw@znaubwsdz657>
On Sunday, 19 April 2026 03:02:29 Central European Summer Time Dmitry Baryshkov wrote:
> On Wed, Apr 15, 2026 at 07:59:40PM +0200, Nicolas Frattaroli wrote:
> > From: Marius Vlad <marius.vlad@collabora.com>
> >
> > Use the new pending_hp member of drm_connector to always send
> > per-connector hotplug events for those connectors that need it, rather
> > than sending a global event, or only an event for one connector.
> >
> > On the HPD (Hot Plug Detect) path this change notifies all connectors,
> > rather than just first changed connector.
>
> I'd like to point out that there are enough places were the code calls
> drm_kms_helper_hotplug_event() directly. Some of them are ridiculous and
> can easily be sorted out (e.g. bridges or single connector drivers,
> where we know exactly for which connector or bridge to report the HPD
> event).
I'll see if I can fix those easy cases up in the next revision.
> Others might be not that obvious. So, if we are to promise to
> userspace to always deliver connector-based events, there is more work
> to be done (and it probably makes a nice TODO item).
I agree. I'll need to reword the message to not claim it "always"
sends per-connector events; the existence of that statement is to
be blamed on me since I wrote that.
> >
> > The polling path is changed to no longer send a connector-less hotplug
> > event, but similarly send a hotplug event for each changed connector.
> >
> > Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
> > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > ---
> > drivers/gpu/drm/drm_probe_helper.c | 22 +++++++++++++++++-----
> > 1 file changed, 17 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index f8cbd6713960..5c39f27ada1d 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -860,8 +860,14 @@ static void output_poll_execute(struct work_struct *work)
> > mutex_unlock(&dev->mode_config.mutex);
> >
> > out:
> > - if (changed)
> > - drm_kms_helper_hotplug_event(dev);
> > + if (changed) {
> > + drm_connector_list_iter_begin(dev, &conn_iter);
> > + drm_for_each_connector_iter(connector, &conn_iter) {
> > + if (connector->pending_hp)
> > + drm_kms_helper_connector_hotplug_event(connector);
> > + }
> > + drm_connector_list_iter_end(&conn_iter);
> > + }
> >
> > if (repoll)
> > schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD);
> > @@ -1124,10 +1130,16 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
> > drm_connector_list_iter_end(&conn_iter);
> > mutex_unlock(&dev->mode_config.mutex);
> >
> > - if (changed == 1)
> > + if (changed == 1) {
> > drm_kms_helper_connector_hotplug_event(first_changed_connector);
> > - else if (changed > 0)
> > - drm_kms_helper_hotplug_event(dev);
> > + } else if (changed > 0) {
> > + drm_connector_list_iter_begin(dev, &conn_iter);
> > + drm_for_each_connector_iter(connector, &conn_iter) {
> > + if (connector->pending_hp)
> > + drm_kms_helper_connector_hotplug_event(connector);
>
> So, instead of sending one HPD event, we can now send a set of events in
> a very short time, potentially triggering undesired events in the
> userspace. At least this change of te behaviour must be documented in
> the commit message and in the cover letter.
Will do.
> > + }
> > + drm_connector_list_iter_end(&conn_iter);
>
> Should this still be executed under the mode_config mutex?
Hmmm, can the number of connectors change while we don't hold it here?
I'll dig into this, if the mutex_unlock miraculously jumps down a few
lines in the next revision then you know what the answer is. :)
> > + }
> >
> > if (first_changed_connector)
> > drm_connector_put(first_changed_connector);
>
> With the code in place, is there a point in keeping a special case for a
> single connector change?
Only as a tiny fast path, but realistically speaking, no. I will get rid
of this, it's only confusing.
> >
>
>
next prev parent reply other threads:[~2026-04-20 16:00 UTC|newest]
Thread overview: 30+ 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-19 0:45 ` Dmitry Baryshkov
2026-04-15 17:59 ` [PATCH RESEND v7 2/2] drm: Send per-connector hotplug events Nicolas Frattaroli
2026-04-19 1:02 ` Dmitry Baryshkov
2026-04-20 15:59 ` Nicolas Frattaroli [this message]
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ä
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-21 10:13 ` Michel Dänzer
2026-04-20 18:13 ` 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=r-xBuaTfSk6trETBz3ToHw@collabora.com \
--to=nicolas.frattaroli@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=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=mripard@kernel.org \
--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