All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/6] drm/i915: Refactor EDID fixed mode search
Date: Fri, 22 Mar 2019 10:32:40 +0200	[thread overview]
Message-ID: <87a7hncnrr.fsf@intel.com> (raw)
In-Reply-To: <20190321132446.22394-1-ville.syrjala@linux.intel.com>

On Thu, 21 Mar 2019, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Both LVDS and eDP have the same code to look up the preferred mode
> from the connector probed_modes list. Move the code to a common
> location.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

This series is something I've been meaning to do for ages. Thanks for
doing it. Others beat me to review, I only glanced through. On the
series,

Acked-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/i915/intel_dp.c    | 13 +++----------
>  drivers/gpu/drm/i915/intel_drv.h   |  2 ++
>  drivers/gpu/drm/i915/intel_lvds.c  | 14 +++-----------
>  drivers/gpu/drm/i915/intel_panel.c | 27 +++++++++++++++++++++++++++
>  4 files changed, 35 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 7c043e8f6298..5096e99ffaad 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -7057,7 +7057,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  	struct drm_display_mode *fixed_mode = NULL;
>  	struct drm_display_mode *downclock_mode = NULL;
>  	bool has_dpcd;
> -	struct drm_display_mode *scan;
>  	enum pipe pipe = INVALID_PIPE;
>  	intel_wakeref_t wakeref;
>  	struct edid *edid;
> @@ -7110,15 +7109,9 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  	}
>  	intel_connector->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);
> -			downclock_mode = intel_dp_drrs_init(
> -						intel_connector, fixed_mode);
> -			break;
> -		}
> -	}
> +	fixed_mode = intel_panel_edid_fixed_mode(intel_connector);
> +	if (fixed_mode)
> +		downclock_mode = intel_dp_drrs_init(intel_connector, fixed_mode);
>  
>  	/* fallback to VBT if available for eDP */
>  	if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) {
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 4d7ae579fc92..4d45ed6aa097 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -2158,6 +2158,8 @@ extern struct drm_display_mode *intel_find_panel_downclock(
>  				struct drm_i915_private *dev_priv,
>  				struct drm_display_mode *fixed_mode,
>  				struct drm_connector *connector);
> +struct drm_display_mode *
> +intel_panel_edid_fixed_mode(struct intel_connector *connector);
>  
>  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
>  int intel_backlight_device_register(struct intel_connector *connector);
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 845792aa0abe..0686ad1f12df 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -810,7 +810,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>  	struct intel_connector *intel_connector;
>  	struct drm_connector *connector;
>  	struct drm_encoder *encoder;
> -	struct drm_display_mode *scan; /* *modes, *bios_mode; */
>  	struct drm_display_mode *fixed_mode = NULL;
>  	struct drm_display_mode *downclock_mode = NULL;
>  	struct edid *edid;
> @@ -949,16 +948,9 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>  	}
>  	intel_connector->edid = edid;
>  
> -	list_for_each_entry(scan, &connector->probed_modes, head) {
> -		if (scan->type & DRM_MODE_TYPE_PREFERRED) {
> -			DRM_DEBUG_KMS("using preferred mode from EDID: ");
> -			drm_mode_debug_printmodeline(scan);
> -
> -			fixed_mode = drm_mode_duplicate(dev, scan);
> -			if (fixed_mode)
> -				goto out;
> -		}
> -	}
> +	fixed_mode = intel_panel_edid_fixed_mode(intel_connector);
> +	if (fixed_mode)
> +		goto out;
>  
>  	/* Failed to get EDID, what about VBT? */
>  	if (dev_priv->vbt.lfp_lvds_vbt_mode) {
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index edd5540639b0..f42137512010 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -99,6 +99,33 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv,
>  		return NULL;
>  }
>  
> +struct drm_display_mode *
> +intel_panel_edid_fixed_mode(struct intel_connector *connector)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> +	const struct drm_display_mode *scan;
> +
> +	/* prefer fixed mode from EDID if available */
> +	list_for_each_entry(scan, &connector->base.probed_modes, head) {
> +		struct drm_display_mode *fixed_mode;
> +
> +		if ((scan->type & DRM_MODE_TYPE_PREFERRED) == 0)
> +			continue;
> +
> +		fixed_mode = drm_mode_duplicate(&dev_priv->drm, scan);
> +		if (!fixed_mode)
> +			return NULL;
> +
> +		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using preferred mode from EDID: ",
> +			      connector->base.base.id, connector->base.name);
> +		drm_mode_debug_printmodeline(fixed_mode);
> +
> +		return fixed_mode;
> +	}
> +
> +	return NULL;
> +}
> +
>  /* adjusted_mode has been preset to be the panel's fixed mode */
>  void
>  intel_pch_panel_fitting(struct intel_crtc *intel_crtc,

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-03-22  8:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
2019-03-21 13:24 ` [PATCH 2/6] drm/i915: Pick the first mode from EDID as the fixed mode when there is no preferred mode Ville Syrjala
2019-03-21 14:54   ` Adam Jackson
2019-03-21 13:24 ` [PATCH 3/6] drm/i915: Refactor VBT fixed mode handling Ville Syrjala
2019-03-21 17:14   ` Chris Wilson
2019-03-21 13:24 ` [PATCH 4/6] drm/i915: Adjust DSI " Ville Syrjala
2019-03-21 17:26   ` Chris Wilson
2019-03-21 13:24 ` [PATCH 5/6] drm/i915: Stop hand rolling drm_mode_match() Ville Syrjala
2019-03-21 17:23   ` Chris Wilson
2019-03-21 17:32     ` Ville Syrjälä
2019-03-21 13:24 ` [PATCH 6/6] drm/i915: Clean up EDID downclock mode lookup Ville Syrjala
2019-03-21 17:17   ` Chris Wilson
2019-03-21 15:39 ` ✓ Fi.CI.BAT: success for series starting with [1/6] drm/i915: Refactor EDID fixed mode search Patchwork
2019-03-21 17:12 ` [PATCH 1/6] " Chris Wilson
2019-03-22  7:10 ` ✓ Fi.CI.IGT: success for series starting with [1/6] " Patchwork
2019-03-22  8:32 ` Jani Nikula [this message]
2019-03-22 16:48   ` [PATCH 1/6] " Ville Syrjälä

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=87a7hncnrr.fsf@intel.com \
    --to=jani.nikula@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.