public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 06/10] drm/i915/dp: Initialize eDP fixed mode in intel_dp_init
Date: Fri, 19 Oct 2012 10:00:49 -0700	[thread overview]
Message-ID: <20121019100049.08652147@jbarnes-desktop> (raw)
In-Reply-To: <59d015fdd087b23f4d19008bf18c823e1f00c4aa.1350644022.git.jani.nikula@intel.com>

On Fri, 19 Oct 2012 14:51:48 +0300
Jani Nikula <jani.nikula@intel.com> wrote:

> Since we do EDID caching in intel_dp_init, we can do the fixed mode
> initialization there too. This should not change the functionality apart
> from initializing fixed mode earlier. Particularly retain the behaviour of
> only falling back to VBT if EDID is not available to not regress
> 
> commit 47f0eb2234a2a1c790825393bbaccfadf82463d3
> Author: Keith Packard <keithp@keithp.com>
> Date:   Mon Sep 19 14:33:26 2011 -0700
> 
>     drm/i915: Only use VBT panel mode on eDP if no EDID is found
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c |   53 ++++++++++++++++++---------------------
>  1 file changed, 25 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 09244f3..52cbee7 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2407,42 +2407,20 @@ static int intel_dp_get_modes(struct drm_connector *connector)
>  {
>  	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	struct drm_device *dev = intel_dp->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int ret;
>  
>  	/* We should parse the EDID data and find out if it has an audio sink
>  	 */
>  
>  	ret = intel_dp_get_edid_modes(connector, &intel_dp->adapter);
> -	if (ret) {
> -		if (is_edp(intel_dp) && !intel_dp->panel_fixed_mode) {
> -			struct drm_display_mode *newmode;
> -			list_for_each_entry(newmode, &connector->probed_modes,
> -					    head) {
> -				if ((newmode->type & DRM_MODE_TYPE_PREFERRED)) {
> -					intel_dp->panel_fixed_mode =
> -						drm_mode_duplicate(dev, newmode);
> -					break;
> -				}
> -			}
> -		}
> +	if (ret)
>  		return ret;
> -	}
>  
> -	/* if eDP has no EDID, try to use fixed panel mode from VBT */
> -	if (is_edp(intel_dp)) {
> -		/* initialize panel mode from VBT if available for eDP */
> -		if (intel_dp->panel_fixed_mode == NULL && dev_priv->lfp_lvds_vbt_mode != NULL) {
> -			intel_dp->panel_fixed_mode =
> -				drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
> -			if (intel_dp->panel_fixed_mode) {
> -				intel_dp->panel_fixed_mode->type |=
> -					DRM_MODE_TYPE_PREFERRED;
> -			}
> -		}
> -		if (intel_dp->panel_fixed_mode) {
> -			struct drm_display_mode *mode;
> -			mode = drm_mode_duplicate(dev, intel_dp->panel_fixed_mode);
> +	/* if eDP has no EDID, fall back to fixed mode */
> +	if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) {
> +		struct drm_display_mode *mode;
> +		mode = drm_mode_duplicate(dev, intel_dp->panel_fixed_mode);
> +		if (mode) {
>  			drm_mode_probed_add(connector, mode);
>  			return 1;
>  		}
> @@ -2638,6 +2616,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
>  	struct intel_dp *intel_dp;
>  	struct intel_encoder *intel_encoder;
>  	struct intel_connector *intel_connector;
> +	struct drm_display_mode *fixed_mode = NULL;
>  	const char *name = NULL;
>  	int type;
>  
> @@ -2802,6 +2781,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
>  
>  	if (is_edp(intel_dp)) {
>  		bool ret;
> +		struct drm_display_mode *scan;
>  		struct edid *edid;
>  
>  		ironlake_edp_panel_vdd_on(intel_dp);
> @@ -2831,6 +2811,23 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
>  			drm_edid_to_eld(connector, edid);
>  			intel_dp->edid = edid;
>  		}
> +
> +		/* prefer fixed mode from EDID if available */
> +		list_for_each_entry(scan, &connector->probed_modes, head) {
> +			if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
> +				fixed_mode = drm_mode_duplicate(dev, scan);
> +				break;
> +			}
> +		}
> +
> +		/* fallback to VBT if available for eDP */
> +		if (!fixed_mode && dev_priv->lfp_lvds_vbt_mode) {
> +			fixed_mode = drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
> +			if (fixed_mode)
> +				fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
> +		}
> +		intel_dp->panel_fixed_mode = fixed_mode;
> +
>  		ironlake_edp_panel_vdd_off(intel_dp, false);
>  	}
>  

Might be nice to factor out some of this fixed mode/eDP stuff into a
separate function, but that's just a cleanup and can happen on top.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

  reply	other threads:[~2012-10-19 16:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 11:51 [PATCH 00/10] drm/i915: LVDS/eDP panel, EDID and fixed mode refactoring Jani Nikula
2012-10-19 11:51 ` [PATCH 01/10] drm/i915/lvds: Rename intel_lvds to intel_lvds_encoder Jani Nikula
2012-10-19 16:46   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 02/10] drm/i915/lvds: Introduce intel_lvds_connector Jani Nikula
2012-10-19 16:47   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 03/10] drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector Jani Nikula
2012-10-19 16:48   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 04/10] drm/i915: Backlight setup requires connector so pass it as parameter Jani Nikula
2012-10-19 16:54   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 05/10] drm/i915/lvds: Move some connector specific info across from the encoder Jani Nikula
2012-10-19 16:55   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 06/10] drm/i915/dp: Initialize eDP fixed mode in intel_dp_init Jani Nikula
2012-10-19 17:00   ` Jesse Barnes [this message]
2012-10-19 11:51 ` [PATCH 07/10] drm/i915: Create generic intel_panel for LVDS and eDP Jani Nikula
2012-10-19 17:04   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 08/10] drm/i915: Move the fixed mode to intel_panel Jani Nikula
2012-10-19 17:09   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 09/10] drm/i915: Do not free the passed EDID in intel_connector_update_modes() Jani Nikula
2012-10-19 17:10   ` Jesse Barnes
2012-10-19 11:51 ` [PATCH 10/10] drm/i915: Move cached EDID to intel_connector Jani Nikula
2012-10-19 17:13   ` Jesse Barnes
2012-10-19 17:58 ` [PATCH 00/10] drm/i915: LVDS/eDP panel, EDID and fixed mode refactoring Chris Wilson
2012-10-22 17:37   ` 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=20121019100049.08652147@jbarnes-desktop \
    --to=jbarnes@virtuousgeek.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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