diff mbox

drm/i915: moved edid read from _force() to _get_modes()

Message ID 1482360550-7909-1-git-send-email-anitha.chrisanthus@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chrisanthus, Anitha Dec. 21, 2016, 10:49 p.m. UTC
From: "Chrisanthus, Anitha" <anitha.chrisanthus@intel.com>

When the connector is forced ON and firmware EDID is provided,
driver still tries to read the EDID from the sink device, this can increase
the driver's start up time by ~25ms per attempt.
This change is to fix this problem.
By moving the point where we attempt to read EDID from the hdmi and dp
_force functions to the corresponding _get_modes() functions we only
attempt to read EDID if EDID firmware is not provided or if there is no
valid EDID.
This change should have no effect on the general case where the EDID is
normally read during the hdmi or dp _detect() call.

Signed-off-by: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c   | 31 +++++++++++++++++++++----------
 drivers/gpu/drm/i915/intel_hdmi.c | 14 ++++++++------
 2 files changed, 29 insertions(+), 16 deletions(-)

Comments

Ville Syrjala Dec. 22, 2016, 12:27 p.m. UTC | #1
On Wed, Dec 21, 2016 at 02:49:10PM -0800, Anitha Chrisanthus wrote:
> From: "Chrisanthus, Anitha" <anitha.chrisanthus@intel.com>
> 
> When the connector is forced ON and firmware EDID is provided,
> driver still tries to read the EDID from the sink device, this can increase
> the driver's start up time by ~25ms per attempt.
> This change is to fix this problem.
> By moving the point where we attempt to read EDID from the hdmi and dp
> _force functions to the corresponding _get_modes() functions we only
> attempt to read EDID if EDID firmware is not provided or if there is no
> valid EDID.
> This change should have no effect on the general case where the EDID is
> normally read during the hdmi or dp _detect() call.

Someone should just move the EDID override stuff to happen at a 
lower level so that _all_ EDID parsing will see the override EDID.

> 
> Signed-off-by: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c   | 31 +++++++++++++++++++++----------
>  drivers/gpu/drm/i915/intel_hdmi.c | 14 ++++++++------
>  2 files changed, 29 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 66b5bc8..0fcecc9 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4563,23 +4563,13 @@ intel_dp_force(struct drm_connector *connector)
>  {
>  	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
> -	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> -	enum intel_display_power_domain power_domain;
>  
>  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
>  		      connector->base.id, connector->name);
> -	intel_dp_unset_edid(intel_dp);
>  
>  	if (connector->status != connector_status_connected)
>  		return;
>  
> -	power_domain = intel_display_port_aux_power_domain(intel_encoder);
> -	intel_display_power_get(dev_priv, power_domain);
> -
> -	intel_dp_set_edid(intel_dp);
> -
> -	intel_display_power_put(dev_priv, power_domain);
> -
>  	if (intel_encoder->type != INTEL_OUTPUT_EDP)
>  		intel_encoder->type = INTEL_OUTPUT_DP;
>  }
> @@ -4588,8 +4578,29 @@ static int intel_dp_get_modes(struct drm_connector *connector)
>  {
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct edid *edid;
> +	struct intel_dp *intel_dp = intel_attached_dp(connector);
> +	struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
> +	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
> +	enum intel_display_power_domain power_domain;
>  
>  	edid = intel_connector->detect_edid;
> +	if ((edid == NULL) &&
> +	    (connector->status == connector_status_connected)) {
> +
> +		intel_dp_unset_edid(intel_dp);
> +
> +		power_domain =
> +			intel_display_port_aux_power_domain(intel_encoder);
> +		intel_display_power_get(dev_priv, power_domain);
> +
> +		intel_dp_detect_dpcd(intel_dp);
> +
> +		intel_dp_set_edid(intel_dp);
> +
> +		intel_display_power_put(dev_priv, power_domain);
> +
> +		edid = intel_connector->detect_edid;
> +	}
>  	if (edid) {
>  		int ret = intel_connector_update_modes(connector, edid);
>  		if (ret)
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 0bcfead..e2f8bde 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1520,12 +1520,9 @@ intel_hdmi_force(struct drm_connector *connector)
>  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
>  		      connector->base.id, connector->name);
>  
> -	intel_hdmi_unset_edid(connector);
> -
>  	if (connector->status != connector_status_connected)
>  		return;
>  
> -	intel_hdmi_set_edid(connector);
>  	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
>  }
>  
> @@ -1534,9 +1531,14 @@ static int intel_hdmi_get_modes(struct drm_connector *connector)
>  	struct edid *edid;
>  
>  	edid = to_intel_connector(connector)->detect_edid;
> -	if (edid == NULL)
> -		return 0;
> -
> +	if ((edid == NULL) &&
> +	    (connector->status == connector_status_connected)) {
> +		intel_hdmi_unset_edid(connector);
> +		intel_hdmi_set_edid(connector);
> +		edid = to_intel_connector(connector)->detect_edid;
> +		if (edid == NULL)
> +			return 0;
> +	}
>  	return intel_connector_update_modes(connector, edid);
>  }
>  
> -- 
> 2.5.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 66b5bc8..0fcecc9 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4563,23 +4563,13 @@  intel_dp_force(struct drm_connector *connector)
 {
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
-	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
-	enum intel_display_power_domain power_domain;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
-	intel_dp_unset_edid(intel_dp);
 
 	if (connector->status != connector_status_connected)
 		return;
 
-	power_domain = intel_display_port_aux_power_domain(intel_encoder);
-	intel_display_power_get(dev_priv, power_domain);
-
-	intel_dp_set_edid(intel_dp);
-
-	intel_display_power_put(dev_priv, power_domain);
-
 	if (intel_encoder->type != INTEL_OUTPUT_EDP)
 		intel_encoder->type = INTEL_OUTPUT_DP;
 }
@@ -4588,8 +4578,29 @@  static int intel_dp_get_modes(struct drm_connector *connector)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct edid *edid;
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
+	struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
+	enum intel_display_power_domain power_domain;
 
 	edid = intel_connector->detect_edid;
+	if ((edid == NULL) &&
+	    (connector->status == connector_status_connected)) {
+
+		intel_dp_unset_edid(intel_dp);
+
+		power_domain =
+			intel_display_port_aux_power_domain(intel_encoder);
+		intel_display_power_get(dev_priv, power_domain);
+
+		intel_dp_detect_dpcd(intel_dp);
+
+		intel_dp_set_edid(intel_dp);
+
+		intel_display_power_put(dev_priv, power_domain);
+
+		edid = intel_connector->detect_edid;
+	}
 	if (edid) {
 		int ret = intel_connector_update_modes(connector, edid);
 		if (ret)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 0bcfead..e2f8bde 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1520,12 +1520,9 @@  intel_hdmi_force(struct drm_connector *connector)
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
-	intel_hdmi_unset_edid(connector);
-
 	if (connector->status != connector_status_connected)
 		return;
 
-	intel_hdmi_set_edid(connector);
 	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
 }
 
@@ -1534,9 +1531,14 @@  static int intel_hdmi_get_modes(struct drm_connector *connector)
 	struct edid *edid;
 
 	edid = to_intel_connector(connector)->detect_edid;
-	if (edid == NULL)
-		return 0;
-
+	if ((edid == NULL) &&
+	    (connector->status == connector_status_connected)) {
+		intel_hdmi_unset_edid(connector);
+		intel_hdmi_set_edid(connector);
+		edid = to_intel_connector(connector)->detect_edid;
+		if (edid == NULL)
+			return 0;
+	}
 	return intel_connector_update_modes(connector, edid);
 }