[Intel-gfx] [PATCH] Poll for HDMI disconnects.

Daniel Vetter daniel at ffwll.ch
Fri Oct 12 10:24:20 CEST 2012


On Thu, Oct 11, 2012 at 04:27:54PM -0700, Stuart Abercrombie wrote:
> Following a hotplug interrupt the driver uses a successful EDID read to indicate HDMI sink presence.
> 
> This leads to missing HDMI cable unplug events because the DDC lines can remain up, allowing an EDID read to complete, well after the HPD line goes down during unplugging
> 
> Since it is only the disconnect case that suffers from unplug ordering problems with the DDC lines, restrict polling to that.  Otherwise we waste power.

Nope, the real fix is to simply check the status of the hpd line before
trying the edid read. We already have that for g4x class chips, check
g4x_hdmi_connected. We'd need to add similar checks for all other
platforms.
-Daniel

> ---
>  drivers/gpu/drm/drm_crtc_helper.c |    8 ++++++--
>  drivers/gpu/drm/i915/intel_hdmi.c |    2 +-
>  include/drm/drm_crtc.h            |    2 ++
>  3 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index 3252e70..b38ea4f 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -938,8 +938,12 @@ static void output_poll_execute(struct work_struct *work)
>  		if (!connector->polled)
>  			continue;
>  
> -		else if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT))
> -			repoll = true;
> +		if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT)) {
> +			if (connector->polled & DRM_CONNECTOR_POLL_DISCONNECT_ONLY)
> +				repoll = (connector->status == connector_status_connected);
> +			else
> +				repoll = true;
> +		}
>  
>  		old_status = connector->status;
>  		/* if we are connected and don't want to poll for disconnect
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 229897f..246e8f4 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -964,7 +964,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port)
>  
>  	intel_encoder->type = INTEL_OUTPUT_HDMI;
>  
> -	connector->polled = DRM_CONNECTOR_POLL_HPD;
> +	connector->polled = DRM_CONNECTOR_POLL_DISCONNECT | DRM_CONNECTOR_POLL_DISCONNECT_ONLY;
>  	connector->interlace_allowed = 1;
>  	connector->doublescan_allowed = 0;
>  	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 316ce64..a60abb5 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -503,6 +503,8 @@ enum drm_connector_force {
>  /* can cleanly poll for disconnections without flickering the screen */
>  /* DACs should rarely do this without a lot of testing */
>  #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
> +/* Only poll for disconnections. */
> +#define DRM_CONNECTOR_POLL_DISCONNECT_ONLY (1 << 3)
>  
>  #define MAX_ELD_BYTES	128
>  
> -- 
> 1.7.7.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list