dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marius Vlad <marius.vlad@collabora.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, daniel.stone@collabora.com,
	jani.nikula@linux.intel.com, tzimmermann@suse.de,
	simona.vetter@ffwll.ch, derek.foreman@collabora.com
Subject: Re: [PATCH 1/2] drm: Introduce a new connector status
Date: Mon, 3 Nov 2025 20:07:46 +0200	[thread overview]
Message-ID: <aQjvcgiLekSSe8kO@xpredator> (raw)
In-Reply-To: <whsopn2fp4pa6mcomezcib35uxsubxtr5qtltxthbsv2apbuxl@xtxuvuyfaib2>

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

Hi Dmitry,
On Tue, Sep 23, 2025 at 06:53:01PM +0300, Dmitry Baryshkov wrote:
> On Tue, Sep 23, 2025 at 11:36:35AM +0300, Marius Vlad wrote:
> > This patch introduces a new boolean variable used to track connector's
> > connect/disconnect status and it is being used on both polling and
> > the HPD (Hot Plug Detect) paths.
> 
> Please see Documentation/process/submitting-patches.rst, it has special
> paragraph about "This patch".
Yes, removed that.
> 
> > 
> > A subsequent patch would make use of this connector status to propagate
> > per-connector udev hot plug events. This allows user-space to receive
> > the connector's ID, rather than having a generic hot-plug event for all
> > connectors, or in the HPD path, just the first one found with a
> > connection status change.
> 
> It's not clear from the commit message, what is the expected behaviour.
> The flag has to be set when we've detected the status change - e.g.
> monitor being plugged or unplugged. When is it expected to be cleared?
Flag should be cleared when firing up KMS uevents and set when detecting
connected/disconnected events. Added a note in the commit desc for v4.
> 
> > 
> > Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
> > ---
> >  drivers/gpu/drm/drm_connector.c    |  1 +
> >  drivers/gpu/drm/drm_probe_helper.c | 18 ++++++++++++++++++
> >  drivers/gpu/drm/drm_sysfs.c        |  1 +
> >  include/drm/drm_connector.h        |  3 +++
> >  4 files changed, 23 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> > index 272d6254ea47..3c6628ee3096 100644
> > --- a/drivers/gpu/drm/drm_connector.c
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -274,6 +274,7 @@ static int drm_connector_init_only(struct drm_device *dev,
> >  
> >  	/* provide ddc symlink in sysfs */
> >  	connector->ddc = ddc;
> > +	connector->status_changed = false;
> >  
> >  	INIT_LIST_HEAD(&connector->head);
> >  	INIT_LIST_HEAD(&connector->global_connector_list_entry);
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index 09b12c30df69..a865d5aa6f73 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -629,6 +629,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> >  			mod_delayed_work(system_wq,
> >  					 &dev->mode_config.output_poll_work,
> >  					 0);
> > +		mutex_lock(&dev->mode_config.mutex);
> > +		connector->status_changed = true;
> > +		mutex_unlock(&dev->mode_config.mutex);
> >  	}
> >  
> >  	/*
> > @@ -732,6 +735,17 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
> >   */
> >  void drm_kms_helper_hotplug_event(struct drm_device *dev)
> >  {
> > +	struct drm_connector *connector;
> > +	struct drm_connector_list_iter conn_iter;
> > +
> > +	drm_connector_list_iter_begin(dev, &conn_iter);
> > +	drm_for_each_connector_iter(connector, &conn_iter) {
> > +		mutex_lock(&dev->mode_config.mutex);
> > +		connector->status_changed = false;
> > +		mutex_unlock(&dev->mode_config.mutex);
> > +	}
> > +	drm_connector_list_iter_end(&conn_iter);
> > +
> >  	drm_sysfs_hotplug_event(dev);
> >  	drm_client_dev_hotplug(dev);
> >  }
> > @@ -748,6 +762,10 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
> >  {
> >  	struct drm_device *dev = connector->dev;
> >  
> > +	mutex_lock(&dev->mode_config.mutex);
> > +	connector->status_changed = false;
> > +	mutex_unlock(&dev->mode_config.mutex);
> > +
> >  	drm_sysfs_connector_hotplug_event(connector);
> >  	drm_client_dev_hotplug(dev);
> >  }
> > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> > index b01ffa4d6509..bd9161490116 100644
> > --- a/drivers/gpu/drm/drm_sysfs.c
> > +++ b/drivers/gpu/drm/drm_sysfs.c
> > @@ -199,6 +199,7 @@ static ssize_t status_store(struct device *device,
> >  		return ret;
> >  
> >  	old_force = connector->force;
> > +	connector->status_changed = true;
> >  
> >  	if (sysfs_streq(buf, "detect"))
> >  		connector->force = 0;
> > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> > index 8f34f4b8183d..e4310df3d55c 100644
> > --- a/include/drm/drm_connector.h
> > +++ b/include/drm/drm_connector.h
> > @@ -2146,6 +2146,9 @@ struct drm_connector {
> >  	/** @force: a DRM_FORCE_<foo> state for forced mode sets */
> >  	enum drm_connector_force force;
> >  
> > +	/** @status_changed: if the old status doesn't match current connection status */
> > +	bool status_changed;
> > +
> >  	/**
> >  	 * @edid_override: Override EDID set via debugfs.
> >  	 *
> > -- 
> > 2.47.2
> > 
> 
> -- 
> With best wishes
> Dmitry

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

  reply	other threads:[~2025-11-03 18:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23  8:36 [PATCH v3 0/2] Pass down hot plug CONNECTOR ID to user-space Marius Vlad
2025-09-23  8:36 ` [PATCH 1/2] drm: Introduce a new connector status Marius Vlad
2025-09-23 15:53   ` Dmitry Baryshkov
2025-11-03 18:07     ` Marius Vlad [this message]
2025-09-23 17:34   ` Ian Forbes
2025-11-03 18:01     ` Marius Vlad
2025-09-25  6:51   ` kernel test robot
2025-09-23  8:36 ` [PATCH 2/2] drm: Propagate connector status change Marius Vlad

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=aQjvcgiLekSSe8kO@xpredator \
    --to=marius.vlad@collabora.com \
    --cc=daniel.stone@collabora.com \
    --cc=derek.foreman@collabora.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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