From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/8] drm/i915: Nuke dev_priv->irq_port[]
Date: Mon, 9 Jul 2018 14:27:31 -0700 [thread overview]
Message-ID: <20180709212731.GK28253@intel.com> (raw)
In-Reply-To: <20180705164357.28512-5-ville.syrjala@linux.intel.com>
On Thu, Jul 05, 2018 at 07:43:53PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Instead of looping over ports and hpd_pins, let's loop over
> the encoders when doing hotplug processing. And instead of
> depending on dev_priv->irq_port[] to tell us whether the
> encoder has the ->hpd_pulse() hook or not, we can just
> check for that directly. So we can just nuke irq_port[] entirely.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 -
> drivers/gpu/drm/i915/intel_ddi.c | 1 -
> drivers/gpu/drm/i915/intel_dp.c | 1 -
> drivers/gpu/drm/i915/intel_drv.h | 2 ++
> drivers/gpu/drm/i915/intel_hotplug.c | 61 +++++++++++++++++++-----------------
> 5 files changed, 34 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 550e86dfbfe8..a808bb8aa4d8 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -299,7 +299,6 @@ struct i915_hotplug {
> u32 event_bits;
> struct delayed_work reenable_work;
>
> - struct intel_digital_port *irq_port[I915_MAX_PORTS];
> u32 long_port_mask;
> u32 short_port_mask;
> struct work_struct dig_port_work;
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index c74b01a52082..b15527ad0ebd 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3635,7 +3635,6 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
> goto err;
>
> intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
> - dev_priv->hotplug.irq_port[port] = intel_dig_port;
> }
>
> /* In theory we don't need the encoder->type check, but leave it just in
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index e9bc0f9f5e54..58933a3e1ae4 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -6471,7 +6471,6 @@ bool intel_dp_init(struct drm_i915_private *dev_priv,
> intel_encoder->port = port;
>
> intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
> - dev_priv->hotplug.irq_port[port] = intel_dig_port;
>
> if (port != PORT_A)
> intel_infoframe_init(intel_dig_port);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index dc11106b2081..e0c88ca53d9c 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -304,6 +304,8 @@ struct intel_panel {
> } backlight;
> };
>
> +struct intel_digital_port;
> +
> /*
> * This structure serves as a translation layer between the generic HDCP code
> * and the bus-specific code. What that means is that HDCP over HDMI differs
> diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
> index 43aa92beff2a..f862441158e1 100644
> --- a/drivers/gpu/drm/i915/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/intel_hotplug.c
> @@ -301,13 +301,18 @@ bool intel_encoder_hotplug(struct intel_encoder *encoder,
> return true;
> }
>
> +static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
> +{
> + return intel_encoder_is_dig_port(encoder) &&
> + enc_to_dig_port(&encoder->base)->hpd_pulse != NULL;
> +}
> +
> static void i915_digport_work_func(struct work_struct *work)
> {
> struct drm_i915_private *dev_priv =
> container_of(work, struct drm_i915_private, hotplug.dig_port_work);
> u32 long_port_mask, short_port_mask;
> - struct intel_digital_port *intel_dig_port;
> - int i;
> + struct intel_encoder *encoder;
> u32 old_bits = 0;
>
> spin_lock_irq(&dev_priv->irq_lock);
> @@ -317,27 +322,27 @@ static void i915_digport_work_func(struct work_struct *work)
> dev_priv->hotplug.short_port_mask = 0;
> spin_unlock_irq(&dev_priv->irq_lock);
>
> - for (i = 0; i < I915_MAX_PORTS; i++) {
> - bool valid = false;
> - bool long_hpd = false;
> - intel_dig_port = dev_priv->hotplug.irq_port[i];
> - if (!intel_dig_port || !intel_dig_port->hpd_pulse)
> + for_each_intel_encoder(&dev_priv->drm, encoder) {
> + struct intel_digital_port *dig_port;
> + enum port port = encoder->port;
> + bool long_hpd, short_hpd;
> + enum irqreturn ret;
> +
> + if (!intel_encoder_has_hpd_pulse(encoder))
> continue;
>
> - if (long_port_mask & (1 << i)) {
> - valid = true;
> - long_hpd = true;
> - } else if (short_port_mask & (1 << i))
> - valid = true;
> + long_hpd = long_port_mask & BIT(port);
> + short_hpd = short_port_mask & BIT(port);
> +
> + if (!long_hpd && !short_hpd)
> + continue;
>
> - if (valid) {
> - enum irqreturn ret;
> + dig_port = enc_to_dig_port(&encoder->base);
>
> - ret = intel_dig_port->hpd_pulse(intel_dig_port, long_hpd);
> - if (ret == IRQ_NONE) {
> - /* fall back to old school hpd */
> - old_bits |= (1 << intel_dig_port->base.hpd_pin);
> - }
> + ret = dig_port->hpd_pulse(dig_port, long_hpd);
> + if (ret == IRQ_NONE) {
> + /* fall back to old school hpd */
> + old_bits |= BIT(encoder->hpd_pin);
> }
> }
>
> @@ -418,26 +423,24 @@ static void i915_hotplug_work_func(struct work_struct *work)
> void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
> u32 pin_mask, u32 long_mask)
> {
> - int i;
> - enum port port;
> + struct intel_encoder *encoder;
> bool storm_detected = false;
> bool queue_dig = false, queue_hp = false;
> - bool is_dig_port;
>
> if (!pin_mask)
> return;
>
> spin_lock(&dev_priv->irq_lock);
> - for_each_hpd_pin(i) {
> + for_each_intel_encoder(&dev_priv->drm, encoder) {
> + enum hpd_pin i = encoder->hpd_pin;
> + bool has_hpd_pulse = intel_encoder_has_hpd_pulse(encoder);
> +
> if (!(BIT(i) & pin_mask))
> continue;
>
> - port = intel_hpd_pin_to_port(dev_priv, i);
> - is_dig_port = port != PORT_NONE &&
> - dev_priv->hotplug.irq_port[port];
> -
> - if (is_dig_port) {
> + if (has_hpd_pulse) {
> bool long_hpd = long_mask & BIT(i);
> + enum port port = encoder->port;
>
> DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port),
> long_hpd ? "long" : "short");
> @@ -470,7 +473,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
> if (dev_priv->hotplug.stats[i].state != HPD_ENABLED)
> continue;
>
> - if (!is_dig_port) {
> + if (!has_hpd_pulse) {
> dev_priv->hotplug.event_bits |= BIT(i);
> queue_hp = true;
> }
> --
> 2.16.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-07-09 21:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-05 16:43 [PATCH 0/8] drm/i915: Hotplug cleanups and whanot Ville Syrjala
2018-07-05 16:43 ` [PATCH 1/8] drm/i915: Introduce for_each_intel_dp() Ville Syrjala
2018-07-05 21:17 ` Rodrigo Vivi
2018-07-05 16:43 ` [PATCH 2/8] drm/i915: Introduce intel_encoder_is_dig_port() Ville Syrjala
2018-07-06 17:01 ` Rodrigo Vivi
2018-07-05 16:43 ` [PATCH 3/8] drm/i915: Rewrite mst suspend/resume in terms of encoders Ville Syrjala
2018-07-05 21:29 ` Rodrigo Vivi
2018-07-06 10:42 ` Ville Syrjälä
2018-07-06 17:00 ` Rodrigo Vivi
2018-07-05 16:43 ` [PATCH 4/8] drm/i915: Nuke dev_priv->irq_port[] Ville Syrjala
2018-07-09 21:27 ` Rodrigo Vivi [this message]
2018-07-05 16:43 ` [PATCH 5/8] drm/i915: s/int i/enum hpd_pin pin/ Ville Syrjala
2018-07-09 21:28 ` Rodrigo Vivi
2018-07-05 16:43 ` [PATCH 6/8] drm/i915: Pass hpd_pin to long_pulse_detect() Ville Syrjala
2018-07-05 21:14 ` Rodrigo Vivi
2018-07-05 16:43 ` [PATCH 7/8] drm/i915: Assert that our hpd pin bitmasks don't overflow Ville Syrjala
2018-07-05 16:52 ` Chris Wilson
2018-07-05 17:51 ` Ville Syrjälä
2018-07-05 17:57 ` Chris Wilson
2018-07-05 16:43 ` [PATCH 8/8] drm/i915: Print the long_mask alongside the pin_mask Ville Syrjala
2018-07-05 18:00 ` Chris Wilson
2018-07-05 20:55 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Hotplug cleanups and whanot Patchwork
2018-07-05 20:58 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-07-05 21:14 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-06 11:05 ` ✓ Fi.CI.IGT: " Patchwork
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=20180709212731.GK28253@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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;
as well as URLs for NNTP newsgroup(s).