[Intel-gfx] [PATCH v3 2/7] drm/i915: (re)init HPD interrupt storm statistics
Jani Nikula
jani.nikula at linux.intel.com
Thu Apr 11 11:54:19 CEST 2013
On Tue, 09 Apr 2013, Egbert Eich <eich at freedesktop.org> wrote:
> From: Egbert Eich <eich at suse.de>
>
> When an encoder is shared on several connectors there is only
> one hotplug line, thus this line needs to be shared among these
> connectors.
> If HPD detect only works reliably on a subset of those connectors,
> we want to poll the others. Thus we need to make sure that storm
> detection doesn't mess up the settings for those connectors.
> Therefore we store the settings in the intel_connector struct and
> restore them from there.
> If nothing is set but the encoder has a hpd_pin set we assume this
> connector is hotplug capable.
> On init/reset we make sure the polled state of the connectors
> is (re)set to the default value, the HPD interrupts are marked
> enabled.
Reviewed-by: Jani Nikula <jani.nikula at intel.com>
>
> Signed-off-by: Egbert Eich <eich at suse.de>
> ---
> drivers/gpu/drm/i915/i915_irq.c | 13 +++++++++++++
> drivers/gpu/drm/i915/intel_crt.c | 6 ++----
> drivers/gpu/drm/i915/intel_dp.c | 1 -
> drivers/gpu/drm/i915/intel_drv.h | 4 ++++
> drivers/gpu/drm/i915/intel_hdmi.c | 1 -
> drivers/gpu/drm/i915/intel_sdvo.c | 5 ++---
> drivers/gpu/drm/i915/intel_tv.c | 2 +-
> 7 files changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 32b5527..5408a3a 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -3045,7 +3045,20 @@ void intel_irq_init(struct drm_device *dev)
> void intel_hpd_init(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> + struct drm_mode_config *mode_config = &dev->mode_config;
> + struct drm_connector *connector;
> + int i;
>
> + for (i = 1; i < HPD_NUM_PINS; i++) {
> + dev_priv->hpd_stats[i].hpd_cnt = 0;
> + dev_priv->hpd_stats[i].hpd_mark = HPD_ENABLED;
> + }
> + list_for_each_entry(connector, &mode_config->connector_list, head) {
> + struct intel_connector *intel_connector = to_intel_connector(connector);
> + connector->polled = intel_connector->polled;
> + if (!connector->polled && I915_HAS_HOTPLUG(dev) && intel_connector->encoder->hpd_pin > HPD_NONE)
> + connector->polled = DRM_CONNECTOR_POLL_HPD;
> + }
> if (dev_priv->display.hpd_irq_setup)
> dev_priv->display.hpd_irq_setup(dev);
> }
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 1ae2d7f..c063b9f 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -793,10 +793,8 @@ void intel_crt_init(struct drm_device *dev)
>
> drm_sysfs_connector_add(connector);
>
> - if (I915_HAS_HOTPLUG(dev))
> - connector->polled = DRM_CONNECTOR_POLL_HPD;
> - else
> - connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> + if (!I915_HAS_HOTPLUG(dev))
> + intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
>
> /*
> * Configure the automatic hotplug detection stuff
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 482b5e5..1e9b19a 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2786,7 +2786,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
> drm_connector_init(dev, connector, &intel_dp_connector_funcs, type);
> drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs);
>
> - connector->polled = DRM_CONNECTOR_POLL_HPD;
> connector->interlace_allowed = true;
> connector->doublescan_allowed = 0;
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index d7bd031..a05fde7 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -171,6 +171,10 @@ struct intel_connector {
>
> /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
> struct edid *edid;
> +
> + /* since POLL and HPD connectors may use the same HPD line keep the native
> + state of connector->polled in case hotplug storm detection changes it */
> + u8 polled;
> };
>
> struct intel_crtc_config {
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index ee4a8da..8912201 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -998,7 +998,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
> DRM_MODE_CONNECTOR_HDMIA);
> drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
>
> - connector->polled = DRM_CONNECTOR_POLL_HPD;
> connector->interlace_allowed = 1;
> connector->doublescan_allowed = 0;
>
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 298dc85..64b8b40 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -2276,7 +2276,6 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
> connector = &intel_connector->base;
> if (intel_sdvo_get_hotplug_support(intel_sdvo) &
> intel_sdvo_connector->output_flag) {
> - connector->polled = DRM_CONNECTOR_POLL_HPD;
> intel_sdvo->hotplug_active |= intel_sdvo_connector->output_flag;
> /* Some SDVO devices have one-shot hotplug interrupts.
> * Ensure that they get re-enabled when an interrupt happens.
> @@ -2284,7 +2283,7 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
> intel_encoder->hot_plug = intel_sdvo_enable_hotplug;
> intel_sdvo_enable_hotplug(intel_encoder);
> } else {
> - connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
> + intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
> }
> encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
> connector->connector_type = DRM_MODE_CONNECTOR_DVID;
> @@ -2353,7 +2352,7 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
>
> intel_connector = &intel_sdvo_connector->base;
> connector = &intel_connector->base;
> - connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> + intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> encoder->encoder_type = DRM_MODE_ENCODER_DAC;
> connector->connector_type = DRM_MODE_CONNECTOR_VGA;
>
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 6673726..b945bc5 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -1613,7 +1613,7 @@ intel_tv_init(struct drm_device *dev)
> *
> * More recent chipsets favour HDMI rather than integrated S-Video.
> */
> - connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> + intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
>
> drm_connector_init(dev, connector, &intel_tv_connector_funcs,
> DRM_MODE_CONNECTOR_SVIDEO);
> --
> 1.8.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list