All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] drm/i915: Refactor EDID fixed mode search
@ 2019-03-21 13:24 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
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Ville Syrjala @ 2019-03-21 13:24 UTC (permalink / raw)
  To: intel-gfx

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>
---
 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,
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/6] drm/i915: Pick the first mode from EDID as the fixed mode when there is no preferred mode
  2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
@ 2019-03-21 13:24 ` 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
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjala @ 2019-03-21 13:24 UTC (permalink / raw)
  To: intel-gfx; +Cc: Roberto Viola, Adam Jackson

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Some monitors apparently forget to mark any mode as preferred in the
EDID. In this particular case we have a very generic looking ID
"PNP Model 0 Serial Number 4" / "LVDS 800x600" so a specific quirk
doesn't seem particularly wise. Also the quirk we have
(EDID_QUIRK_FIRST_DETAILED_PREFERRED) is actually defunct so we'd
have to fix it first.

When there is no preferred mode we currently fall back to the VBT.
That approach fails us here as the VBT mode is 1024x768 whereas
the panel resolution is 800x600. So instead of falling back to the
VBT when there is no preferred mode let's just pick the first
probed mode. Only if the EDID provided no modes we fall back to
the VBT.

For this machine the VBIOS would appear to select the 800x600
60Hz EST mode rather than the first detailed mode (which is
the new fallback will pick). The two modes differ only by
having opposite sync polarities, which does not seem to matter
to the panel in question.

v2: Make sure the probed_modes list is not empty

Cc: Adam Jackson <ajax@redhat.com>
Cc: Roberto Viola <cagnulein@gmail.com>
Tested-by: Roberto Viola <cagnulein@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109780
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_panel.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index f42137512010..b9ee18c2dff5 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -104,11 +104,13 @@ 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;
+	struct drm_display_mode *fixed_mode;
+
+	if (list_empty(&connector->base.probed_modes))
+		return NULL;
 
 	/* 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;
 
@@ -123,7 +125,20 @@ intel_panel_edid_fixed_mode(struct intel_connector *connector)
 		return fixed_mode;
 	}
 
-	return NULL;
+	scan = list_first_entry(&connector->base.probed_modes,
+				typeof(*scan), head);
+
+	fixed_mode = drm_mode_duplicate(&dev_priv->drm, scan);
+	if (!fixed_mode)
+		return NULL;
+
+	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
+
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using first mode from EDID: ",
+		      connector->base.base.id, connector->base.name);
+	drm_mode_debug_printmodeline(fixed_mode);
+
+	return fixed_mode;
 }
 
 /* adjusted_mode has been preset to be the panel's fixed mode */
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/6] drm/i915: Refactor VBT fixed mode handling
  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 13:24 ` Ville Syrjala
  2019-03-21 17:14   ` Chris Wilson
  2019-03-21 13:24 ` [PATCH 4/6] drm/i915: Adjust DSI " Ville Syrjala
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjala @ 2019-03-21 13:24 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

LVDS and eDP have essentially the same code for grabbing the
fixed mode from VBT. Pull that code to a common location.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c    | 11 ++---------
 drivers/gpu/drm/i915/intel_drv.h   |  2 ++
 drivers/gpu/drm/i915/intel_lvds.c  | 15 +++------------
 drivers/gpu/drm/i915/intel_panel.c | 27 +++++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 5096e99ffaad..57d769bca3b8 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -7114,15 +7114,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 		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) {
-		fixed_mode = drm_mode_duplicate(dev,
-					dev_priv->vbt.lfp_lvds_vbt_mode);
-		if (fixed_mode) {
-			fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
-			connector->display_info.width_mm = fixed_mode->width_mm;
-			connector->display_info.height_mm = fixed_mode->height_mm;
-		}
-	}
+	if (!fixed_mode)
+		fixed_mode = intel_panel_vbt_fixed_mode(intel_connector);
 	mutex_unlock(&dev->mode_config.mutex);
 
 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 4d45ed6aa097..3b17d35fc381 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -2160,6 +2160,8 @@ extern struct drm_display_mode *intel_find_panel_downclock(
 				struct drm_connector *connector);
 struct drm_display_mode *
 intel_panel_edid_fixed_mode(struct intel_connector *connector);
+struct drm_display_mode *
+intel_panel_vbt_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 0686ad1f12df..ccd5ac6d3fcd 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -953,18 +953,9 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 		goto out;
 
 	/* Failed to get EDID, what about VBT? */
-	if (dev_priv->vbt.lfp_lvds_vbt_mode) {
-		DRM_DEBUG_KMS("using mode from VBT: ");
-		drm_mode_debug_printmodeline(dev_priv->vbt.lfp_lvds_vbt_mode);
-
-		fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
-		if (fixed_mode) {
-			fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
-			connector->display_info.width_mm = fixed_mode->width_mm;
-			connector->display_info.height_mm = fixed_mode->height_mm;
-			goto out;
-		}
-	}
+	fixed_mode = intel_panel_vbt_fixed_mode(intel_connector);
+	if (fixed_mode)
+		goto out;
 
 	/*
 	 * If we didn't get EDID, try checking if the panel is already turned
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index b9ee18c2dff5..cf111eba1a93 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -141,6 +141,33 @@ intel_panel_edid_fixed_mode(struct intel_connector *connector)
 	return fixed_mode;
 }
 
+struct drm_display_mode *
+intel_panel_vbt_fixed_mode(struct intel_connector *connector)
+{
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+	struct drm_display_info *info = &connector->base.display_info;
+	struct drm_display_mode *fixed_mode;
+
+	if (!dev_priv->vbt.lfp_lvds_vbt_mode)
+		return NULL;
+
+	fixed_mode = drm_mode_duplicate(&dev_priv->drm,
+					dev_priv->vbt.lfp_lvds_vbt_mode);
+	if (!fixed_mode)
+		return NULL;
+
+	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
+
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using mode from VBT: ",
+		      connector->base.base.id, connector->base.name);
+	drm_mode_debug_printmodeline(fixed_mode);
+
+	info->width_mm = fixed_mode->width_mm;
+	info->height_mm = fixed_mode->height_mm;
+
+	return fixed_mode;
+}
+
 /* adjusted_mode has been preset to be the panel's fixed mode */
 void
 intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/6] drm/i915: Adjust DSI fixed mode handling
  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 13:24 ` [PATCH 3/6] drm/i915: Refactor VBT fixed mode handling Ville Syrjala
@ 2019-03-21 13:24 ` 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
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjala @ 2019-03-21 13:24 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

DSI has its own convoluted way of grabbing the fixed mode from
the VBT. Change it to follow the path laid out by LVDS/eDP.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/icl_dsi.c       | 14 ++------------
 drivers/gpu/drm/i915/intel_dsi.h     |  1 -
 drivers/gpu/drm/i915/intel_dsi_vbt.c | 18 ------------------
 drivers/gpu/drm/i915/vlv_dsi.c       | 13 ++-----------
 4 files changed, 4 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
index beb30d9a855c..92440ff48f93 100644
--- a/drivers/gpu/drm/i915/icl_dsi.c
+++ b/drivers/gpu/drm/i915/icl_dsi.c
@@ -1361,7 +1361,7 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
 	struct intel_encoder *encoder;
 	struct intel_connector *intel_connector;
 	struct drm_connector *connector;
-	struct drm_display_mode *scan, *fixed_mode = NULL;
+	struct drm_display_mode *fixed_mode;
 	enum port port;
 
 	if (!intel_bios_is_dsi_present(dev_priv, &port))
@@ -1411,15 +1411,8 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
 	/* attach connector to encoder */
 	intel_connector_attach_encoder(intel_connector, encoder);
 
-	/* fill mode info from VBT */
 	mutex_lock(&dev->mode_config.mutex);
-	intel_dsi_vbt_get_modes(intel_dsi);
-	list_for_each_entry(scan, &connector->probed_modes, head) {
-		if (scan->type & DRM_MODE_TYPE_PREFERRED) {
-			fixed_mode = drm_mode_duplicate(dev, scan);
-			break;
-		}
-	}
+	fixed_mode = intel_panel_vbt_fixed_mode(intel_connector);
 	mutex_unlock(&dev->mode_config.mutex);
 
 	if (!fixed_mode) {
@@ -1427,12 +1420,9 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
 		goto err;
 	}
 
-	connector->display_info.width_mm = fixed_mode->width_mm;
-	connector->display_info.height_mm = fixed_mode->height_mm;
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
 	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
-
 	if (dev_priv->vbt.dsi.config->dual_link)
 		intel_dsi->ports = BIT(PORT_A) | BIT(PORT_B);
 	else
diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index a9a19778dc7f..705a609050c0 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -189,7 +189,6 @@ void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
 
 /* intel_dsi_vbt.c */
 bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id);
-int intel_dsi_vbt_get_modes(struct intel_dsi *intel_dsi);
 void intel_dsi_vbt_exec_sequence(struct intel_dsi *intel_dsi,
 				 enum mipi_seq seq_id);
 void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec);
diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c
index d1e00e4c7726..3074448446bc 100644
--- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
@@ -532,24 +532,6 @@ void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec)
 	msleep(msec);
 }
 
-int intel_dsi_vbt_get_modes(struct intel_dsi *intel_dsi)
-{
-	struct intel_connector *connector = intel_dsi->attached_connector;
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct drm_display_mode *mode;
-
-	mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
-	if (!mode)
-		return 0;
-
-	mode->type |= DRM_MODE_TYPE_PREFERRED;
-
-	drm_mode_probed_add(&connector->base, mode);
-
-	return 1;
-}
-
 #define ICL_PREPARE_CNT_MAX	0x7
 #define ICL_CLK_ZERO_CNT_MAX	0xf
 #define ICL_TRAIL_CNT_MAX	0x7
diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
index 6403728fe778..01278b2e257c 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -1658,7 +1658,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 	struct drm_encoder *encoder;
 	struct intel_connector *intel_connector;
 	struct drm_connector *connector;
-	struct drm_display_mode *scan, *fixed_mode = NULL;
+	struct drm_display_mode *fixed_mode;
 	enum port port;
 
 	DRM_DEBUG_KMS("\n");
@@ -1769,13 +1769,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 	intel_connector_attach_encoder(intel_connector, intel_encoder);
 
 	mutex_lock(&dev->mode_config.mutex);
-	intel_dsi_vbt_get_modes(intel_dsi);
-	list_for_each_entry(scan, &connector->probed_modes, head) {
-		if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
-			fixed_mode = drm_mode_duplicate(dev, scan);
-			break;
-		}
-	}
+	fixed_mode = intel_panel_vbt_fixed_mode(intel_connector);
 	mutex_unlock(&dev->mode_config.mutex);
 
 	if (!fixed_mode) {
@@ -1783,9 +1777,6 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 		goto err;
 	}
 
-	connector->display_info.width_mm = fixed_mode->width_mm;
-	connector->display_info.height_mm = fixed_mode->height_mm;
-
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
 	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/6] drm/i915: Stop hand rolling drm_mode_match()
  2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
                   ` (2 preceding siblings ...)
  2019-03-21 13:24 ` [PATCH 4/6] drm/i915: Adjust DSI " Ville Syrjala
@ 2019-03-21 13:24 ` Ville Syrjala
  2019-03-21 17:23   ` Chris Wilson
  2019-03-21 13:24 ` [PATCH 6/6] drm/i915: Clean up EDID downclock mode lookup Ville Syrjala
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjala @ 2019-03-21 13:24 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Utilize drm_mode_match() instead of hand rolling it when
looking for the DRRS downclock mode.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_panel.c | 49 +++++++++++++++---------------
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index cf111eba1a93..4727e74f7437 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -46,6 +46,16 @@ intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
 	drm_mode_set_crtcinfo(adjusted_mode, 0);
 }
 
+static bool is_downclock_mode(const struct drm_display_mode *downclock_mode,
+			      const struct drm_display_mode *fixed_mode)
+{
+	return drm_mode_match(downclock_mode, fixed_mode,
+			      DRM_MODE_MATCH_TIMINGS |
+			      DRM_MODE_MATCH_FLAGS |
+			      DRM_MODE_MATCH_3D_FLAGS) &&
+		downclock_mode->clock < fixed_mode->clock;
+}
+
 /**
  * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
  * @dev_priv: i915 device instance
@@ -60,11 +70,8 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv,
 			struct drm_display_mode *fixed_mode,
 			struct drm_connector *connector)
 {
-	struct drm_display_mode *scan, *tmp_mode;
-	int temp_downclock;
-
-	temp_downclock = fixed_mode->clock;
-	tmp_mode = NULL;
+	const struct drm_display_mode *scan, *best_mode = NULL;
+	int best_clock = fixed_mode->clock;
 
 	list_for_each_entry(scan, &connector->probed_modes, head) {
 		/*
@@ -74,29 +81,21 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv,
 		 * case we can set the different FPx0/1 to dynamically select
 		 * between low and high frequency.
 		 */
-		if (scan->hdisplay == fixed_mode->hdisplay &&
-		    scan->hsync_start == fixed_mode->hsync_start &&
-		    scan->hsync_end == fixed_mode->hsync_end &&
-		    scan->htotal == fixed_mode->htotal &&
-		    scan->vdisplay == fixed_mode->vdisplay &&
-		    scan->vsync_start == fixed_mode->vsync_start &&
-		    scan->vsync_end == fixed_mode->vsync_end &&
-		    scan->vtotal == fixed_mode->vtotal) {
-			if (scan->clock < temp_downclock) {
-				/*
-				 * The downclock is already found. But we
-				 * expect to find the lower downclock.
-				 */
-				temp_downclock = scan->clock;
-				tmp_mode = scan;
-			}
+		if (is_downclock_mode(scan, fixed_mode) &&
+		    scan->clock < best_clock) {
+			/*
+			 * The downclock is already found. But we
+			 * expect to find the lower downclock.
+			 */
+			best_clock = scan->clock;
+			best_mode = scan;
 		}
 	}
 
-	if (temp_downclock < fixed_mode->clock)
-		return drm_mode_duplicate(&dev_priv->drm, tmp_mode);
-	else
-		return NULL;
+	if (best_mode)
+		return drm_mode_duplicate(&dev_priv->drm, best_mode);
+
+	return NULL;
 }
 
 struct drm_display_mode *
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/6] drm/i915: Clean up EDID downclock mode lookup
  2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
                   ` (3 preceding siblings ...)
  2019-03-21 13:24 ` [PATCH 5/6] drm/i915: Stop hand rolling drm_mode_match() Ville Syrjala
@ 2019-03-21 13:24 ` 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
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjala @ 2019-03-21 13:24 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rename intel_find_panel_downclock() to intel_panel_edid_downclock_mode()
to make it clear it's looking for the downclock mode in the EDID.
And while at it polish the implementation a bit as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c    |  4 +---
 drivers/gpu/drm/i915/intel_drv.h   |  7 +++----
 drivers/gpu/drm/i915/intel_panel.c | 32 +++++++++++++++---------------
 3 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 57d769bca3b8..326de12c3f44 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -7033,9 +7033,7 @@ intel_dp_drrs_init(struct intel_connector *connector,
 		return NULL;
 	}
 
-	downclock_mode = intel_find_panel_downclock(dev_priv, fixed_mode,
-						    &connector->base);
-
+	downclock_mode = intel_panel_edid_downclock_mode(connector, fixed_mode);
 	if (!downclock_mode) {
 		DRM_DEBUG_KMS("Downclock mode is not found. DRRS not supported\n");
 		return NULL;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3b17d35fc381..88295253990e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -2154,10 +2154,9 @@ void intel_panel_update_backlight(struct intel_encoder *encoder,
 				  const struct intel_crtc_state *crtc_state,
 				  const struct drm_connector_state *conn_state);
 void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state);
-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_downclock_mode(struct intel_connector *connector,
+				const struct drm_display_mode *fixed_mode);
 struct drm_display_mode *
 intel_panel_edid_fixed_mode(struct intel_connector *connector);
 struct drm_display_mode *
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 4727e74f7437..47cd4a338db6 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -56,24 +56,16 @@ static bool is_downclock_mode(const struct drm_display_mode *downclock_mode,
 		downclock_mode->clock < fixed_mode->clock;
 }
 
-/**
- * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
- * @dev_priv: i915 device instance
- * @fixed_mode : panel native mode
- * @connector: LVDS/eDP connector
- *
- * Return downclock_avail
- * Find the reduced downclock for LVDS/eDP in EDID.
- */
 struct drm_display_mode *
-intel_find_panel_downclock(struct drm_i915_private *dev_priv,
-			struct drm_display_mode *fixed_mode,
-			struct drm_connector *connector)
+intel_panel_edid_downclock_mode(struct intel_connector *connector,
+				const struct drm_display_mode *fixed_mode)
 {
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	const struct drm_display_mode *scan, *best_mode = NULL;
+	struct drm_display_mode *downclock_mode;
 	int best_clock = fixed_mode->clock;
 
-	list_for_each_entry(scan, &connector->probed_modes, head) {
+	list_for_each_entry(scan, &connector->base.probed_modes, head) {
 		/*
 		 * If one mode has the same resolution with the fixed_panel
 		 * mode while they have the different refresh rate, it means
@@ -92,10 +84,18 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv,
 		}
 	}
 
-	if (best_mode)
-		return drm_mode_duplicate(&dev_priv->drm, best_mode);
+	if (!best_mode)
+		return NULL;
+
+	downclock_mode = drm_mode_duplicate(&dev_priv->drm, best_mode);
+	if (!downclock_mode)
+		return NULL;
+
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using downclock mode from EDID: ",
+		      connector->base.base.id, connector->base.name);
+	drm_mode_debug_printmodeline(downclock_mode);
 
-	return NULL;
+	return downclock_mode;
 }
 
 struct drm_display_mode *
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/6] drm/i915: Pick the first mode from EDID as the fixed mode when there is no preferred mode
  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
  0 siblings, 0 replies; 17+ messages in thread
From: Adam Jackson @ 2019-03-21 14:54 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx; +Cc: Roberto Viola

On Thu, 2019-03-21 at 15:24 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Some monitors apparently forget to mark any mode as preferred in the
> EDID. In this particular case we have a very generic looking ID
> "PNP Model 0 Serial Number 4" / "LVDS 800x600" so a specific quirk
> doesn't seem particularly wise. Also the quirk we have
> (EDID_QUIRK_FIRST_DETAILED_PREFERRED) is actually defunct so we'd
> have to fix it first.
> 
> When there is no preferred mode we currently fall back to the VBT.
> That approach fails us here as the VBT mode is 1024x768 whereas
> the panel resolution is 800x600. So instead of falling back to the
> VBT when there is no preferred mode let's just pick the first
> probed mode. Only if the EDID provided no modes we fall back to
> the VBT.
> 
> For this machine the VBIOS would appear to select the 800x600
> 60Hz EST mode rather than the first detailed mode (which is
> the new fallback will pick). The two modes differ only by
> having opposite sync polarities, which does not seem to matter
> to the panel in question.

Took me a moment to realize this was only about panels on i915, and not
any monitor/connector with no preferred modes. Looks sane to me though.

Reviewed-by: Adam Jackson <ajax@redhat.com>

- ajax

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [1/6] drm/i915: Refactor EDID fixed mode search
  2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
                   ` (4 preceding siblings ...)
  2019-03-21 13:24 ` [PATCH 6/6] drm/i915: Clean up EDID downclock mode lookup Ville Syrjala
@ 2019-03-21 15:39 ` Patchwork
  2019-03-21 17:12 ` [PATCH 1/6] " Chris Wilson
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2019-03-21 15:39 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/6] drm/i915: Refactor EDID fixed mode search
URL   : https://patchwork.freedesktop.org/series/58356/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5788 -> Patchwork_12549
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/58356/revisions/1/mbox/

Known issues
------------

  Here are the changes found in Patchwork_12549 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@query-info:
    - fi-bsw-kefka:       NOTRUN -> SKIP [fdo#109271] +55

  * igt@amdgpu/amd_basic@userptr:
    - fi-whl-u:           NOTRUN -> SKIP [fdo#109271] +17
    - fi-kbl-8809g:       PASS -> DMESG-WARN [fdo#108965]

  * igt@gem_exec_basic@gtt-bsd2:
    - fi-byt-clapper:     NOTRUN -> SKIP [fdo#109271] +57

  * igt@gem_exec_basic@readonly-bsd1:
    - fi-snb-2520m:       NOTRUN -> SKIP [fdo#109271] +57

  * igt@gem_exec_suspend@basic-s3:
    - fi-icl-u3:          PASS -> FAIL [fdo#103375]

  * igt@i915_selftest@live_evict:
    - fi-bsw-kefka:       NOTRUN -> DMESG-WARN [fdo#107709]

  * igt@kms_busy@basic-flip-c:
    - fi-byt-clapper:     NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
    - fi-bsw-kefka:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
    - fi-snb-2520m:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
    - fi-byt-clapper:     NOTRUN -> FAIL [fdo#103191] / [fdo#107362]

  * igt@runner@aborted:
    - fi-bsw-kefka:       NOTRUN -> FAIL [fdo#107709]

  
#### Possible fixes ####

  * igt@i915_pm_rpm@module-reload:
    - fi-whl-u:           DMESG-WARN [fdo#109513] -> PASS
    - fi-skl-6770hq:      FAIL [fdo#108511] -> PASS

  * igt@kms_busy@basic-flip-a:
    - fi-gdg-551:         FAIL [fdo#103182] -> PASS

  
  [fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
  [fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
  [fdo#108511]: https://bugs.freedesktop.org/show_bug.cgi?id=108511
  [fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109513]: https://bugs.freedesktop.org/show_bug.cgi?id=109513


Participating hosts (41 -> 39)
------------------------------

  Additional (3): fi-bsw-kefka fi-byt-clapper fi-snb-2520m 
  Missing    (5): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-ctg-p8600 fi-bdw-samus 


Build changes
-------------

    * Linux: CI_DRM_5788 -> Patchwork_12549

  CI_DRM_5788: befbe4e0469e0dc93889f470e816eb31498db6ba @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4896: 0f9c061247fb7aba21c9459f19f437927a28f32c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12549: 2fc341a3937bb74f2cf714b6370e3cbb1deec7d6 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

2fc341a3937b drm/i915: Clean up EDID downclock mode lookup
509f98550fcb drm/i915: Stop hand rolling drm_mode_match()
3878ef202faf drm/i915: Adjust DSI fixed mode handling
d0b6088d5f5e drm/i915: Refactor VBT fixed mode handling
73b453180b37 drm/i915: Pick the first mode from EDID as the fixed mode when there is no preferred mode
7335a9e0eba0 drm/i915: Refactor EDID fixed mode search

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12549/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/6] drm/i915: Refactor EDID fixed mode search
  2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
                   ` (5 preceding siblings ...)
  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 ` Chris Wilson
  2019-03-22  7:10 ` ✓ Fi.CI.IGT: success for series starting with [1/6] " Patchwork
  2019-03-22  8:32 ` [PATCH 1/6] " Jani Nikula
  8 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2019-03-21 17:12 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2019-03-21 13:24:41)
> 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>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/6] drm/i915: Refactor VBT fixed mode handling
  2019-03-21 13:24 ` [PATCH 3/6] drm/i915: Refactor VBT fixed mode handling Ville Syrjala
@ 2019-03-21 17:14   ` Chris Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2019-03-21 17:14 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2019-03-21 13:24:43)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> LVDS and eDP have essentially the same code for grabbing the
> fixed mode from VBT. Pull that code to a common location.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/6] drm/i915: Clean up EDID downclock mode lookup
  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
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2019-03-21 17:17 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2019-03-21 13:24:46)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Rename intel_find_panel_downclock() to intel_panel_edid_downclock_mode()
> to make it clear it's looking for the downclock mode in the EDID.
> And while at it polish the implementation a bit as well.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/6] drm/i915: Stop hand rolling drm_mode_match()
  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ä
  0 siblings, 1 reply; 17+ messages in thread
From: Chris Wilson @ 2019-03-21 17:23 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2019-03-21 13:24:45)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Utilize drm_mode_match() instead of hand rolling it when
> looking for the DRRS downclock mode.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_panel.c | 49 +++++++++++++++---------------
>  1 file changed, 24 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index cf111eba1a93..4727e74f7437 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -46,6 +46,16 @@ intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
>         drm_mode_set_crtcinfo(adjusted_mode, 0);
>  }
>  
> +static bool is_downclock_mode(const struct drm_display_mode *downclock_mode,
> +                             const struct drm_display_mode *fixed_mode)
> +{
> +       return drm_mode_match(downclock_mode, fixed_mode,
> +                             DRM_MODE_MATCH_TIMINGS |

Adds m1->vscan == m2->vscan

Makes sense.

> +                             DRM_MODE_MATCH_FLAGS |
> +                             DRM_MODE_MATCH_3D_FLAGS) &&

Together adds m1->flags == m2->flags

And also makes sense.

The other available flag is DRM_MODE_MATCH_ASPECT_RATIO, which is
redundant given the timings match.

> +               downclock_mode->clock < fixed_mode->clock;
> +}
> +
>  /**
>   * intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
>   * @dev_priv: i915 device instance
> @@ -60,11 +70,8 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv,
>                         struct drm_display_mode *fixed_mode,
>                         struct drm_connector *connector)
>  {
> -       struct drm_display_mode *scan, *tmp_mode;
> -       int temp_downclock;
> -
> -       temp_downclock = fixed_mode->clock;
> -       tmp_mode = NULL;
> +       const struct drm_display_mode *scan, *best_mode = NULL;
> +       int best_clock = fixed_mode->clock;
>  
>         list_for_each_entry(scan, &connector->probed_modes, head) {
>                 /*
> @@ -74,29 +81,21 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv,
>                  * case we can set the different FPx0/1 to dynamically select
>                  * between low and high frequency.
>                  */
> -               if (scan->hdisplay == fixed_mode->hdisplay &&
> -                   scan->hsync_start == fixed_mode->hsync_start &&
> -                   scan->hsync_end == fixed_mode->hsync_end &&
> -                   scan->htotal == fixed_mode->htotal &&
> -                   scan->vdisplay == fixed_mode->vdisplay &&
> -                   scan->vsync_start == fixed_mode->vsync_start &&
> -                   scan->vsync_end == fixed_mode->vsync_end &&
> -                   scan->vtotal == fixed_mode->vtotal) {
> -                       if (scan->clock < temp_downclock) {
> -                               /*
> -                                * The downclock is already found. But we
> -                                * expect to find the lower downclock.
> -                                */
> -                               temp_downclock = scan->clock;
> -                               tmp_mode = scan;
> -                       }
> +               if (is_downclock_mode(scan, fixed_mode) &&
> +                   scan->clock < best_clock) {
> +                       /*
> +                        * The downclock is already found. But we
> +                        * expect to find the lower downclock.
> +                        */
> +                       best_clock = scan->clock;
> +                       best_mode = scan;
>                 }
>         }
>  
> -       if (temp_downclock < fixed_mode->clock)
> -               return drm_mode_duplicate(&dev_priv->drm, tmp_mode);
> -       else
> -               return NULL;
> +       if (best_mode)
> +               return drm_mode_duplicate(&dev_priv->drm, best_mode);
> +
> +       return NULL;
>  }

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 4/6] drm/i915: Adjust DSI fixed mode handling
  2019-03-21 13:24 ` [PATCH 4/6] drm/i915: Adjust DSI " Ville Syrjala
@ 2019-03-21 17:26   ` Chris Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2019-03-21 17:26 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2019-03-21 13:24:44)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> DSI has its own convoluted way of grabbing the fixed mode from
> the VBT. Change it to follow the path laid out by LVDS/eDP.

That was scarier than the actual code changes.
 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/6] drm/i915: Stop hand rolling drm_mode_match()
  2019-03-21 17:23   ` Chris Wilson
@ 2019-03-21 17:32     ` Ville Syrjälä
  0 siblings, 0 replies; 17+ messages in thread
From: Ville Syrjälä @ 2019-03-21 17:32 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Thu, Mar 21, 2019 at 05:23:30PM +0000, Chris Wilson wrote:
> Quoting Ville Syrjala (2019-03-21 13:24:45)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Utilize drm_mode_match() instead of hand rolling it when
> > looking for the DRRS downclock mode.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_panel.c | 49 +++++++++++++++---------------
> >  1 file changed, 24 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > index cf111eba1a93..4727e74f7437 100644
> > --- a/drivers/gpu/drm/i915/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > @@ -46,6 +46,16 @@ intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
> >         drm_mode_set_crtcinfo(adjusted_mode, 0);
> >  }
> >  
> > +static bool is_downclock_mode(const struct drm_display_mode *downclock_mode,
> > +                             const struct drm_display_mode *fixed_mode)
> > +{
> > +       return drm_mode_match(downclock_mode, fixed_mode,
> > +                             DRM_MODE_MATCH_TIMINGS |
> 
> Adds m1->vscan == m2->vscan
> 
> Makes sense.
> 
> > +                             DRM_MODE_MATCH_FLAGS |
> > +                             DRM_MODE_MATCH_3D_FLAGS) &&
> 
> Together adds m1->flags == m2->flags
> 
> And also makes sense.

Somehow I didn't even notice it wasn't checking the flags.
But yeah, seems appropriate to make it check this.

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* ✓ Fi.CI.IGT: success for series starting with [1/6] drm/i915: Refactor EDID fixed mode search
  2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
                   ` (6 preceding siblings ...)
  2019-03-21 17:12 ` [PATCH 1/6] " Chris Wilson
@ 2019-03-22  7:10 ` Patchwork
  2019-03-22  8:32 ` [PATCH 1/6] " Jani Nikula
  8 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2019-03-22  7:10 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/6] drm/i915: Refactor EDID fixed mode search
URL   : https://patchwork.freedesktop.org/series/58356/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5788_full -> Patchwork_12549_full
====================================================

Summary
-------

  **WARNING**

  Minor unknown changes coming with Patchwork_12549_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_12549_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_12549_full:

### IGT changes ###

#### Warnings ####

  * igt@kms_frontbuffer_tracking@psr-2p-primscrn-spr-indfb-draw-pwrite:
    - shard-iclb:         SKIP [fdo#109280] -> INCOMPLETE

  
Known issues
------------

  Here are the changes found in Patchwork_12549_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ppgtt@blt-vs-render-ctx0:
    - shard-iclb:         PASS -> INCOMPLETE [fdo#109766] / [fdo#109801]

  * igt@gem_tiled_swapping@non-threaded:
    - shard-iclb:         PASS -> FAIL [fdo#108686]
    - shard-hsw:          PASS -> FAIL [fdo#108686]

  * igt@i915_pm_rpm@dpms-mode-unset-lpsp:
    - shard-skl:          PASS -> INCOMPLETE [fdo#107807] +1

  * igt@kms_busy@extended-modeset-hang-newfb-render-a:
    - shard-hsw:          PASS -> DMESG-WARN [fdo#107956]

  * igt@kms_busy@extended-modeset-hang-oldfb-render-d:
    - shard-skl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +4

  * igt@kms_chv_cursor_fail@pipe-c-256x256-bottom-edge:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +2

  * igt@kms_cursor_crc@cursor-128x128-suspend:
    - shard-skl:          PASS -> INCOMPLETE [fdo#104108]

  * igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions-varying-size:
    - shard-iclb:         PASS -> FAIL [fdo#103355]

  * igt@kms_fbcon_fbt@fbc:
    - shard-iclb:         PASS -> DMESG-WARN [fdo#109593]

  * igt@kms_flip@busy-flip:
    - shard-skl:          PASS -> FAIL [fdo#103257]

  * igt@kms_flip_tiling@flip-to-x-tiled:
    - shard-iclb:         PASS -> FAIL [fdo#108134]

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-fullscreen:
    - shard-skl:          NOTRUN -> SKIP [fdo#109271] +66

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-blt:
    - shard-iclb:         PASS -> FAIL [fdo#109247] +25

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw:
    - shard-iclb:         PASS -> FAIL [fdo#103167] +4

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-shrfb-msflip-blt:
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] +33

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-indfb-plflip-blt:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] +37

  * igt@kms_frontbuffer_tracking@fbcpsr-rgb101010-draw-render:
    - shard-iclb:         PASS -> FAIL [fdo#105682] / [fdo#109247] +1

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
    - shard-skl:          PASS -> INCOMPLETE [fdo#104108] / [fdo#107773]

  * igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
    - shard-skl:          PASS -> FAIL [fdo#107815]

  * igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
    - shard-skl:          NOTRUN -> FAIL [fdo#107815] / [fdo#108145]

  * igt@kms_plane_alpha_blend@pipe-c-alpha-transparant-fb:
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +2
    - shard-skl:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_scaling@pipe-c-scaler-with-rotation:
    - shard-glk:          PASS -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_psr@cursor_mmap_gtt:
    - shard-iclb:         PASS -> FAIL [fdo#107383] / [fdo#110215] +2

  * igt@kms_psr@psr2_primary_page_flip:
    - shard-iclb:         PASS -> SKIP [fdo#109441] +3

  * igt@kms_vblank@pipe-b-ts-continuation-suspend:
    - shard-iclb:         PASS -> FAIL [fdo#104894]

  * igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
    - shard-apl:          PASS -> FAIL [fdo#104894] +1

  * igt@perf@oa-exponents:
    - shard-glk:          PASS -> FAIL [fdo#105483]

  * igt@perf_pmu@rc6-runtime-pm-long:
    - shard-kbl:          PASS -> FAIL [fdo#105010]

  * igt@runner@aborted:
    - shard-iclb:         NOTRUN -> FAIL [fdo#109593]

  
#### Possible fixes ####

  * igt@i915_pm_rpm@legacy-planes:
    - shard-skl:          INCOMPLETE [fdo#107807] -> PASS

  * igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
    - shard-apl:          DMESG-WARN [fdo#107956] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-suspend:
    - shard-snb:          INCOMPLETE [fdo#105411] -> PASS

  * igt@kms_cursor_crc@cursor-256x256-suspend:
    - shard-skl:          INCOMPLETE [fdo#104108] -> PASS

  * igt@kms_flip@flip-vs-suspend:
    - shard-skl:          INCOMPLETE [fdo#109507] -> PASS +1

  * igt@kms_flip@flip-vs-suspend-interruptible:
    - shard-hsw:          INCOMPLETE [fdo#103540] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
    - shard-iclb:         FAIL [fdo#103167] -> PASS +7

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-gtt:
    - shard-iclb:         FAIL [fdo#109247] -> PASS +15

  * {igt@kms_plane@pixel-format-pipe-b-planes-source-clamping}:
    - shard-glk:          SKIP [fdo#109271] -> PASS

  * igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
    - shard-apl:          FAIL [fdo#108145] -> PASS

  * igt@kms_plane_scaling@pipe-a-scaler-with-clipping-clamping:
    - shard-glk:          SKIP [fdo#109271] / [fdo#109278] -> PASS

  * igt@kms_psr@psr2_sprite_plane_move:
    - shard-iclb:         SKIP [fdo#109441] -> PASS +3

  * igt@kms_setmode@basic:
    - shard-apl:          FAIL [fdo#99912] -> PASS

  
#### Warnings ####

  * igt@i915_selftest@live_contexts:
    - shard-iclb:         INCOMPLETE [fdo#108569] -> DMESG-FAIL [fdo#108569]

  * igt@kms_frontbuffer_tracking@psr-2p-primscrn-spr-indfb-draw-pwrite:
    - shard-hsw:          SKIP [fdo#109271] -> INCOMPLETE [fdo#103540]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103257]: https://bugs.freedesktop.org/show_bug.cgi?id=103257
  [fdo#103355]: https://bugs.freedesktop.org/show_bug.cgi?id=103355
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
  [fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
  [fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#105483]: https://bugs.freedesktop.org/show_bug.cgi?id=105483
  [fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
  [fdo#107383]: https://bugs.freedesktop.org/show_bug.cgi?id=107383
  [fdo#107773]: https://bugs.freedesktop.org/show_bug.cgi?id=107773
  [fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
  [fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
  [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
  [fdo#108134]: https://bugs.freedesktop.org/show_bug.cgi?id=108134
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
  [fdo#109247]: https://bugs.freedesktop.org/show_bug.cgi?id=109247
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
  [fdo#109593]: https://bugs.freedesktop.org/show_bug.cgi?id=109593
  [fdo#109766]: https://bugs.freedesktop.org/show_bug.cgi?id=109766
  [fdo#109801]: https://bugs.freedesktop.org/show_bug.cgi?id=109801
  [fdo#110215]: https://bugs.freedesktop.org/show_bug.cgi?id=110215
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (10 -> 10)
------------------------------

  No changes in participating hosts


Build changes
-------------

    * Linux: CI_DRM_5788 -> Patchwork_12549

  CI_DRM_5788: befbe4e0469e0dc93889f470e816eb31498db6ba @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4896: 0f9c061247fb7aba21c9459f19f437927a28f32c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12549: 2fc341a3937bb74f2cf714b6370e3cbb1deec7d6 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12549/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/6] drm/i915: Refactor EDID fixed mode search
  2019-03-21 13:24 [PATCH 1/6] drm/i915: Refactor EDID fixed mode search Ville Syrjala
                   ` (7 preceding siblings ...)
  2019-03-22  7:10 ` ✓ Fi.CI.IGT: success for series starting with [1/6] " Patchwork
@ 2019-03-22  8:32 ` Jani Nikula
  2019-03-22 16:48   ` Ville Syrjälä
  8 siblings, 1 reply; 17+ messages in thread
From: Jani Nikula @ 2019-03-22  8:32 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/6] drm/i915: Refactor EDID fixed mode search
  2019-03-22  8:32 ` [PATCH 1/6] " Jani Nikula
@ 2019-03-22 16:48   ` Ville Syrjälä
  0 siblings, 0 replies; 17+ messages in thread
From: Ville Syrjälä @ 2019-03-22 16:48 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Fri, Mar 22, 2019 at 10:32:40AM +0200, Jani Nikula wrote:
> 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.

I think I had these more or less typed up for a few years now.
Finally got an excuse (the bug) to finish them ;)

Series pushed to dinq. Thanks for the reviews/acks everyone.

> 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

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-03-22 16:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/6] " Jani Nikula
2019-03-22 16:48   ` Ville Syrjälä

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.