diff mbox

drm/i915/dp: Update connector status for DP MST hotplugs

Message ID 1478230712-18720-1-git-send-email-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan Nov. 4, 2016, 3:38 a.m. UTC
Hotplugging a monitor in DP MST configuration triggers short pulses.
Although the short pulse handling path ends up in the MST hotplug function,
we do not perform a detect before sending the hotplug uvent. This leads to
the connector status not being updated when the userspace calls
DRM_IOCTL_MODE_GETCONNECTOR.

So, let's call the connector function ->detect() to update the connector
status before sending the uevent.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/i915/intel_dp_mst.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä Nov. 7, 2016, 4:14 p.m. UTC | #1
On Thu, Nov 03, 2016 at 08:38:32PM -0700, Dhinakaran Pandiyan wrote:
> Hotplugging a monitor in DP MST configuration triggers short pulses.
> Although the short pulse handling path ends up in the MST hotplug function,
> we do not perform a detect before sending the hotplug uvent. This leads to
> the connector status not being updated when the userspace calls
> DRM_IOCTL_MODE_GETCONNECTOR.
> 
> So, let's call the connector function ->detect() to update the connector
> status before sending the uevent.
> 
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp_mst.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 3ffbd69..80810c9 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -492,8 +492,25 @@ static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
>  	struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
>  	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_device *dev = intel_dig_port->base.base.dev;
> +	struct intel_connector *intel_connector;
> +	bool changed = false;
> +	enum drm_connector_status old_status;
> +
> +	for_each_intel_connector(dev, intel_connector) {
> +		struct drm_connector *connector = &(intel_connector->base);
> +
> +		if (intel_connector->mst_port != intel_dp)
> +			continue;
> +
> +		old_status = connector->status;
> +		connector->status = connector->funcs->detect(connector, false);
> +
> +		if (old_status != connector->status)
> +			changed = true;
> +	}

So what's the story with the locking? This sort of stuff needs the
protection of the mode_config mutex.

>  
> -	drm_kms_helper_hotplug_event(dev);
> +	if (changed)
> +		drm_kms_helper_hotplug_event(dev);
>  }
>  
>  static const struct drm_dp_mst_topology_cbs mst_cbs = {
> -- 
> 2.7.4
Dhinakaran Pandiyan Nov. 7, 2016, 11:58 p.m. UTC | #2
On Mon, 2016-11-07 at 18:14 +0200, Ville Syrjälä wrote:
> On Thu, Nov 03, 2016 at 08:38:32PM -0700, Dhinakaran Pandiyan wrote:

> > Hotplugging a monitor in DP MST configuration triggers short pulses.

> > Although the short pulse handling path ends up in the MST hotplug function,

> > we do not perform a detect before sending the hotplug uvent. This leads to

> > the connector status not being updated when the userspace calls

> > DRM_IOCTL_MODE_GETCONNECTOR.

> > 

> > So, let's call the connector function ->detect() to update the connector

> > status before sending the uevent.

> > 

> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

> > ---

> >  drivers/gpu/drm/i915/intel_dp_mst.c | 19 ++++++++++++++++++-

> >  1 file changed, 18 insertions(+), 1 deletion(-)

> > 

> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c

> > index 3ffbd69..80810c9 100644

> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c

> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c

> > @@ -492,8 +492,25 @@ static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)

> >  	struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);

> >  	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);

> >  	struct drm_device *dev = intel_dig_port->base.base.dev;

> > +	struct intel_connector *intel_connector;

> > +	bool changed = false;

> > +	enum drm_connector_status old_status;

> > +

> > +	for_each_intel_connector(dev, intel_connector) {

> > +		struct drm_connector *connector = &(intel_connector->base);

> > +

> > +		if (intel_connector->mst_port != intel_dp)

> > +			continue;

> > +

> > +		old_status = connector->status;

> > +		connector->status = connector->funcs->detect(connector, false);

> > +

> > +		if (old_status != connector->status)

> > +			changed = true;

> > +	}

> 

> So what's the story with the locking? This sort of stuff needs the

> protection of the mode_config mutex.

> 


I wasn't sure, will send another patch.


-DK

> >  

> > -	drm_kms_helper_hotplug_event(dev);

> > +	if (changed)

> > +		drm_kms_helper_hotplug_event(dev);

> >  }

> >  

> >  static const struct drm_dp_mst_topology_cbs mst_cbs = {

> > -- 

> > 2.7.4

>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 3ffbd69..80810c9 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -492,8 +492,25 @@  static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
 	struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = intel_dig_port->base.base.dev;
+	struct intel_connector *intel_connector;
+	bool changed = false;
+	enum drm_connector_status old_status;
+
+	for_each_intel_connector(dev, intel_connector) {
+		struct drm_connector *connector = &(intel_connector->base);
+
+		if (intel_connector->mst_port != intel_dp)
+			continue;
+
+		old_status = connector->status;
+		connector->status = connector->funcs->detect(connector, false);
+
+		if (old_status != connector->status)
+			changed = true;
+	}
 
-	drm_kms_helper_hotplug_event(dev);
+	if (changed)
+		drm_kms_helper_hotplug_event(dev);
 }
 
 static const struct drm_dp_mst_topology_cbs mst_cbs = {