All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Egbert Eich <eich@freedesktop.org>, intel-gfx@lists.freedesktop.org
Cc: Egbert Eich <eich@suse.de>, Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v3 7/7] drm/i915: Only reprobe display on encoder which has received an HPD event
Date: Thu, 11 Apr 2013 16:35:04 +0300	[thread overview]
Message-ID: <87wqs9nqbb.fsf@intel.com> (raw)
In-Reply-To: <1365499470-28646-8-git-send-email-eich@freedesktop.org>

On Tue, 09 Apr 2013, Egbert Eich <eich@freedesktop.org> wrote:
> From: Egbert Eich <eich@suse.de>
>
> Instead of calling into the DRM helper layer to poll all connectors for
> changes in connected displays probe only those connectors which have
> received a hotplug event.

Thanks, we've all been waiting for someone(tm) to do this.

Apart from the bikesheds below,
Reviewed-by: Jani Nikula <jani.nikula@intel.com>


>
> Signed-off-by: Egbert Eich <eich@suse.de>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 37 +++++++++++++++++++++++++++++++------
>  1 file changed, 31 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 92041b9..7788536 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -334,6 +334,24 @@ static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe,
>  						     crtc);
>  }
>  
> +/**
> + * drm_helper_hpd_irq_single_connector_event() - call this function with mode_config.mutex lock held
> + */

That kernel-doc line should include a one line description what the
function does, not what the preconditions are. You can achieve the same
with:

	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));

I'd also like to bikeshed the function name, because we'll be seeing it
a lot in the dmesgs through DRM_DEBUG_KMS. Just intel_hpd_irq_event()?

> +
> +static int intel_hpd_irq_single_connector_event(struct drm_device *dev, struct drm_connector *connector)
> +{
> +	enum drm_connector_status old_status;
> +
> +	old_status = connector->status;
> +
> +	connector->status = connector->funcs->detect(connector, false);
> +	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
> +		      connector->base.id,
> +		      drm_get_connector_name(connector),
> +		      old_status, connector->status);

And while at it, another bikeshed about having different messages for
when old_status == connector->status vs. not. I've always found the
"status updated from 1 to 1" messages a bit dumb... ;)

> +	return (old_status != connector->status);
> +}
> +
>  /*
>   * Handle hotplug events outside the interrupt handler proper.
>   */
> @@ -348,6 +366,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
>  	struct drm_connector *connector;
>  	unsigned long irqflags;
>  	bool connector_disabled = false;
> +	bool changed = false;
>  	u32 hpd_event_bits;
>  
>  	/* HPD irq before everything is fully set up. */
> @@ -387,14 +406,20 @@ static void i915_hotplug_work_func(struct work_struct *work)
>  
>  	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
>  
> -	list_for_each_entry(intel_encoder, &mode_config->encoder_list, base.head)
> -		if (intel_encoder->hot_plug)
> -			intel_encoder->hot_plug(intel_encoder);
> -
> +	list_for_each_entry(connector, &mode_config->connector_list, head) {
> +		intel_connector = to_intel_connector(connector);
> +		intel_encoder = intel_connector->encoder;
> +		if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) {
> +			if (intel_encoder->hot_plug)
> +				intel_encoder->hot_plug(intel_encoder);
> +			if (intel_hpd_irq_single_connector_event(dev, connector))
> +				changed = true;
> +		}
> +	}
>  	mutex_unlock(&mode_config->mutex);
>  
> -	/* Just fire off a uevent and let userspace tell us what to do */
> -	drm_helper_hpd_irq_event(dev);
> +	if (changed)
> +		drm_kms_helper_hotplug_event(dev);
>  }
>  
>  static void ironlake_handle_rps_change(struct drm_device *dev)
> -- 
> 1.8.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2013-04-11 13:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09  9:24 [PATCH v3 0/7] Add HPD interrupt storm detection Egbert Eich
2013-04-09  9:24 ` [PATCH v3 1/7] drm/i915: Add HPD IRQ storm detection (v4) Egbert Eich
2013-04-11  9:32   ` Jani Nikula
2013-04-11 10:46     ` Daniel Vetter
2013-04-16  9:50     ` Egbert Eich
2013-04-16 11:34     ` Egbert Eich
2013-04-16 11:36       ` [PATCH 1/7] drm/i915: Add HPD IRQ storm detection (v5) Egbert Eich
2013-04-16 11:36         ` [PATCH 2/7] drm/i915: (re)init HPD interrupt storm statistics Egbert Eich
2013-04-16 11:36         ` [PATCH 3/7] drm/i915: Mask out the HPD irq bits before setting them individually Egbert Eich
2013-04-16 11:36         ` [PATCH 4/7] drm/i915: Disable HPD interrupt on pin when irq storm is detected (v3) Egbert Eich
2013-04-16 11:36         ` [PATCH 5/7] drm/i915: Add Reenable Timer to turn Hotplug Detection back on (v4) Egbert Eich
2013-04-16 18:07           ` Daniel Vetter
2013-04-16 20:22             ` Egbert Eich
2013-04-16 20:26               ` Daniel Vetter
2013-04-16 11:36         ` [PATCH 6/7] drm/i915: Add bit field to record which pins have received HPD events (v3) Egbert Eich
2013-04-16 11:37         ` [PATCH 7/7] drm/i915: Only reprobe display on encoder which has received an HPD event (v2) Egbert Eich
2013-04-09  9:24 ` [PATCH v3 2/7] drm/i915: (re)init HPD interrupt storm statistics Egbert Eich
2013-04-11  9:54   ` Jani Nikula
2013-04-09  9:24 ` [PATCH v3 3/7] drm/i915: Mask out the HPD irq bits before setting them individually Egbert Eich
2013-04-11  9:56   ` Jani Nikula
2013-04-09  9:24 ` [PATCH v3 4/7] drm/i915: Disable HPD interrupt on pin when irq storm is detected (v2) Egbert Eich
2013-04-11 10:13   ` Jani Nikula
2013-04-11 13:25     ` [PATCH v3] drm/i915: Disable HPD interrupt on pin when irq storm is detected (v3) Egbert Eich
2013-04-11 14:20       ` Jani Nikula
2013-04-09  9:24 ` [PATCH v3 5/7] drm/i915: Add Reenable Timer to turn Hotplug Detection back on (v3) Egbert Eich
2013-04-11 10:44   ` Jani Nikula
2013-04-11 13:10     ` Egbert Eich
2013-04-11 14:48       ` Jani Nikula
2013-04-11 13:28     ` [PATCH v4] drm/i915: Add Reenable Timer to turn Hotplug Detection back on (v4) Egbert Eich
2013-04-11 14:30       ` Jani Nikula
2013-04-09  9:24 ` [PATCH v3 6/7] drm/i915: Add bit field to record which pins have received HPD events (v2) Egbert Eich
2013-04-11 13:21   ` Jani Nikula
2013-04-11 13:34     ` Egbert Eich
2013-04-11 13:57     ` [PATCH v3] drm/i915: Add bit field to record which pins have received HPD events (v3) Egbert Eich
2013-04-11 14:03       ` [PATCH v3 Update] " Egbert Eich
2013-04-11 15:00         ` Jani Nikula
2013-04-09  9:24 ` [PATCH v3 7/7] drm/i915: Only reprobe display on encoder which has received an HPD event Egbert Eich
2013-04-11 13:35   ` Jani Nikula [this message]
     [not found] <Message-ID: <87wqs9nqbb.fsf@intel.com>
2013-04-11 14:00 ` [PATCH v2] drm/i915: Only reprobe display on encoder which has received an HPD event (v2) Egbert Eich
2013-04-11 15:06   ` Jani Nikula
2013-04-23 12:26     ` Daniel Vetter

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=87wqs9nqbb.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=eich@freedesktop.org \
    --cc=eich@suse.de \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.