Skip to contentSkip to conversation

Handle link training failure during modeset for DDI

PATCH Superseded Manasi Navare 3 participants 22 messages Oct 29, 2016 – Nov 9, 2016

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Handle link training failure during modeset for DDI

Link training failure is handled by lowering the link rate/lane count as per the Dp Spec 1.2 and sending a hotplug uevent to userspace to notify that it needs to redo a modeset. This is notified by setting connector link status property which should be tracked by userspace to take the action.

This behaviour complies with Dp spec as tested by DP compliance test suite.

Manasi Navare (4):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Find fallback link rate/lane count drm/i915: Implement Link Rate fallback on Link training failure

 drivers/gpu/drm/drm_atomic_helper.c           |   4 +
 drivers/gpu/drm/drm_connector.c               |  17 ++++
 drivers/gpu/drm/i915/intel_ddi.c              |  23 ++++-
 drivers/gpu/drm/i915/intel_dp.c               | 128 +++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_dp_link_training.c |  12 ++-
 drivers/gpu/drm/i915/intel_drv.h              |  13 ++-
 include/drm/drm_connector.h                   |   4 +-
 include/drm/drm_crtc.h                        |   5 +
 include/uapi/drm/drm_mode.h                   |   4 +
 9 files changed, 201 insertions(+), 9 deletions(-)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 1/4 drm: Add a new connector property for link status

A new default connector property is added for keeping
track of whether the link is good (link training passed) or link is bad (link training failed). If the link status property is not good, then userspace should fire off a new modeset at the current mode even if there have not been any changes in the mode list or connector status.
Also add link status connector member corersponding to the decoded value of link status property.

v3: Add link status member to store property value locally (Ville Syrjala)
v2:
* Make this a default connector property (Daniel Vetter)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/drm_connector.c | 17 +++++++++++++++++
 include/drm/drm_connector.h     |  4 +++-
 include/drm/drm_crtc.h          |  5 +++++
 include/uapi/drm/drm_mode.h     |  4 ++++
 4 files changed, 29 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_connector.c +17 -0
index 2db7fb5..d4e852f 100644
@@ -243,6 +243,10 @@ int drm_connector_init(struct drm_device *dev,
 	drm_object_attach_property(&connector->base,
 				      config->dpms_property, 0);
 
+	drm_object_attach_property(&connector->base,
+				   config->link_status_property,
+				   0);
+
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
 		drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
 	}
@@ -506,6 +510,12 @@ const char *drm_get_subpixel_order_name(enum subpixel_order order)
 };
 DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
 
+static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
+	{ DRM_MODE_LINK_STATUS_GOOD, "Good" },
+	{ DRM_MODE_LINK_STATUS_BAD, "Bad" },
+};
+DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
+
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -622,6 +632,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.tile_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "link-status",
+					drm_link_status_enum_list,
+					ARRAY_SIZE(drm_link_status_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.link_status_property = prop;
+
 	return 0;
 }
 
include/drm/drm_connector.h +3 -1
index ac9d7d8..90387a1 100644
@@ -682,6 +682,9 @@ struct drm_connector {
 	uint8_t num_h_tile, num_v_tile;
 	uint8_t tile_h_loc, tile_v_loc;
 	uint16_t tile_h_size, tile_v_size;
+
+	/* Connector Link status for link training */
+	bool link_status;
 };
 
 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
@@ -754,7 +757,6 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
-
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
 					 const char *path);
 int drm_mode_connector_set_tile_property(struct drm_connector *connector);
include/drm/drm_crtc.h +5 -0
index fa1aa21..b86ca19 100644
@@ -1151,6 +1151,11 @@ struct drm_mode_config {
 	 */
 	struct drm_property *tile_property;
 	/**
+	 * @link_status_property: Default connector property for link status
+	 * of a connector as a result of link training.
+	 */
+	struct drm_property *link_status_property;
+	/**
 	 * @plane_type_property: Default plane property to differentiate
 	 * CURSOR, PRIMARY and OVERLAY legacy uses of planes.
 	 */
include/uapi/drm/drm_mode.h +4 -0
index 084b50a..f1b0afd 100644
@@ -121,6 +121,10 @@
 #define DRM_MODE_DIRTY_ON       1
 #define DRM_MODE_DIRTY_ANNOTATE 2
 
+/* Link Status options */
+#define DRM_MODE_LINK_STATUS_GOOD	0
+#define DRM_MODE_LINK_STATUS_BAD	1
+
 struct drm_mode_modeinfo {
 	__u32 clock;
 	__u16 hdisplay;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#2 lore raw

Re: [PATCH v2 1/4] drm: Add a new connector property for link status

Quoted 8 lines · Manasi Navare

A new default connector property is added for keeping
track of whether the link is good (link training passed) or link is bad (link training failed). If the link status property is not good, then userspace should fire off a new modeset at the current mode even if there have not been any changes in the mode list or connector status.
Also add link status connector member corersponding to the decoded value of link status property.

I'm still a bit uneasy about the name "link status", because I want it to be evident that this is not just about display port link layer. However, I don't have a good counter proposal, and it's easy to change once we agree on everything else.

Quoted 66 lines

v3: Add link status member to store property value locally (Ville Syrjala)
v2:
* Make this a default connector property (Daniel Vetter)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/drm_connector.c | 17 +++++++++++++++++
 include/drm/drm_connector.h     |  4 +++-
 include/drm/drm_crtc.h          |  5 +++++
 include/uapi/drm/drm_mode.h     |  4 ++++
 4 files changed, 29 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_connector.c +17 -0
index 2db7fb5..d4e852f 100644
@@ -243,6 +243,10 @@ int drm_connector_init(struct drm_device *dev,
 	drm_object_attach_property(&connector->base,
 				      config->dpms_property, 0);
 
+	drm_object_attach_property(&connector->base,
+				   config->link_status_property,
+				   0);
+
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
 		drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
 	}
@@ -506,6 +510,12 @@ const char *drm_get_subpixel_order_name(enum subpixel_order order)
 };
 DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
 
+static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
+	{ DRM_MODE_LINK_STATUS_GOOD, "Good" },
+	{ DRM_MODE_LINK_STATUS_BAD, "Bad" },
+};
+DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
+
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -622,6 +632,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.tile_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "link-status",
+					drm_link_status_enum_list,
+					ARRAY_SIZE(drm_link_status_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.link_status_property = prop;
+
 	return 0;
 }
 
include/drm/drm_connector.h +0 -0
index ac9d7d8..90387a1 100644

include/drm/drm_connector.h struct drm_connector { · line 686

Quoted 5 lines
include/drm/drm_connector.h +2 -0
@@ -682,6 +682,9 @@ struct drm_connector {
 	uint8_t num_h_tile, num_v_tile;
 	uint8_t tile_h_loc, tile_v_loc;
 	uint16_t tile_h_size, tile_v_size;
+
+	/* Connector Link status for link training */

Drop the "link training" bit, this is not just about DP.

include/drm/drm_connector.h struct drm_connector { · line 687

Quoted 1 line
include/drm/drm_connector.h +1 -0
+	bool link_status;

What does it mean for link status to be true or false? Which one is good and which one is bad? Please either name this differently, or make this an int and expect it to have the same values as the property.

Quoted 16 lines
include/drm/drm_connector.h +0 -1
 };
 
 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
@@ -754,7 +757,6 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
-
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
 					 const char *path);
 int drm_mode_connector_set_tile_property(struct drm_connector *connector);
include/drm/drm_crtc.h +0 -0
index fa1aa21..b86ca19 100644

include/drm/drm_crtc.h struct drm_mode_config { · line 1155

Quoted 5 lines
include/drm/drm_crtc.h +2 -0
@@ -1151,6 +1151,11 @@ struct drm_mode_config {
 	 */
 	struct drm_property *tile_property;
 	/**
+	 * @link_status_property: Default connector property for link status
+	 * of a connector as a result of link training.

Same about "link training".

Quoted 21 lines
include/drm/drm_crtc.h +3 -0
+	 */
+	struct drm_property *link_status_property;
+	/**
 	 * @plane_type_property: Default plane property to differentiate
 	 * CURSOR, PRIMARY and OVERLAY legacy uses of planes.
 	 */
include/uapi/drm/drm_mode.h +4 -0
index 084b50a..f1b0afd 100644
@@ -121,6 +121,10 @@
 #define DRM_MODE_DIRTY_ON       1
 #define DRM_MODE_DIRTY_ANNOTATE 2
 
+/* Link Status options */
+#define DRM_MODE_LINK_STATUS_GOOD	0
+#define DRM_MODE_LINK_STATUS_BAD	1
+
 struct drm_mode_modeinfo {
 	__u32 clock;
 	__u16 hdisplay;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v3 1/4 drm: Add a new connector property for link status

In reply to Manasi Navare

A new default connector property is added for keeping
track of whether the link is good (link training passed) or link is bad (link training failed). If the link status property is not good, then userspace should fire off a new modeset at the current mode even if there have not been any changes in the mode list or connector status.
Also add link status connector member corersponding to the decoded value of link status property.

v3:
* Drop "link training" from description since this is not specific to DP (Jani Nikula)
* Add link status member to store property value locally (Ville Syrjala)
v2:
* Make this a default connector property (Daniel Vetter)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/drm_connector.c | 17 +++++++++++++++++
 include/drm/drm_connector.h     |  7 ++++++-
 include/drm/drm_crtc.h          |  5 +++++
 include/uapi/drm/drm_mode.h     |  4 ++++
 4 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_connector.c +17 -0
index 2db7fb5..d4e852f 100644
@@ -243,6 +243,10 @@ int drm_connector_init(struct drm_device *dev,
 	drm_object_attach_property(&connector->base,
 				      config->dpms_property, 0);
 
+	drm_object_attach_property(&connector->base,
+				   config->link_status_property,
+				   0);
+
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
 		drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
 	}
@@ -506,6 +510,12 @@ const char *drm_get_subpixel_order_name(enum subpixel_order order)
 };
 DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
 
+static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
+	{ DRM_MODE_LINK_STATUS_GOOD, "Good" },
+	{ DRM_MODE_LINK_STATUS_BAD, "Bad" },
+};
+DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
+
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -622,6 +632,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.tile_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "link-status",
+					drm_link_status_enum_list,
+					ARRAY_SIZE(drm_link_status_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.link_status_property = prop;
+
 	return 0;
 }
 
include/drm/drm_connector.h +6 -1
index ac9d7d8..5c335e8 100644
@@ -682,6 +682,12 @@ struct drm_connector {
 	uint8_t num_h_tile, num_v_tile;
 	uint8_t tile_h_loc, tile_v_loc;
 	uint16_t tile_h_size, tile_v_size;
+
+	/* Connector Link status
+	 * 0: If the link is Good
+	 * 1: If the link is Bad
+	 */
+	int link_status;
 };
 
 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
@@ -754,7 +760,6 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
-
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
 					 const char *path);
 int drm_mode_connector_set_tile_property(struct drm_connector *connector);
include/drm/drm_crtc.h +5 -0
index fa1aa21..737f4d3 100644
@@ -1151,6 +1151,11 @@ struct drm_mode_config {
 	 */
 	struct drm_property *tile_property;
 	/**
+	 * @link_status_property: Default connector property for link status
+	 * of a connector
+	 */
+	struct drm_property *link_status_property;
+	/**
 	 * @plane_type_property: Default plane property to differentiate
 	 * CURSOR, PRIMARY and OVERLAY legacy uses of planes.
 	 */
include/uapi/drm/drm_mode.h +4 -0
index 084b50a..f1b0afd 100644
@@ -121,6 +121,10 @@
 #define DRM_MODE_DIRTY_ON       1
 #define DRM_MODE_DIRTY_ANNOTATE 2
 
+/* Link Status options */
+#define DRM_MODE_LINK_STATUS_GOOD	0
+#define DRM_MODE_LINK_STATUS_BAD	1
+
 struct drm_mode_modeinfo {
 	__u32 clock;
 	__u16 hdisplay;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#4 lore raw

Re: [PATCH v3 1/4] drm: Add a new connector property for link status

Quoted 8 lines · Manasi Navare

A new default connector property is added for keeping
track of whether the link is good (link training passed) or link is bad (link training failed). If the link status property is not good, then userspace should fire off a new modeset at the current mode even if there have not been any changes in the mode list or connector status.
Also add link status connector member corersponding to the decoded value of link status property.

I think it would be good to expand on this, both in the commit message and documentation. This is UABI after all.

When is the property changed, who changes it, what is the userspace expected to do when the status goes from good to bad, how does userspace notice it's gone bad (uevents).

While we want this for handling DP link training failures during mode setting according to the DP spec, in a way that can pass the CTS, it's also needed for async mode sets.

BR,
Jani.

Quoted 120 lines

v3:
* Drop "link training" from description since this is not specific to DP (Jani Nikula)
* Add link status member to store property value locally (Ville Syrjala)
v2:
* Make this a default connector property (Daniel Vetter)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/drm_connector.c | 17 +++++++++++++++++
 include/drm/drm_connector.h     |  7 ++++++-
 include/drm/drm_crtc.h          |  5 +++++
 include/uapi/drm/drm_mode.h     |  4 ++++
 4 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_connector.c +17 -0
index 2db7fb5..d4e852f 100644
@@ -243,6 +243,10 @@ int drm_connector_init(struct drm_device *dev,
 	drm_object_attach_property(&connector->base,
 				      config->dpms_property, 0);
 
+	drm_object_attach_property(&connector->base,
+				   config->link_status_property,
+				   0);
+
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
 		drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
 	}
@@ -506,6 +510,12 @@ const char *drm_get_subpixel_order_name(enum subpixel_order order)
 };
 DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
 
+static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
+	{ DRM_MODE_LINK_STATUS_GOOD, "Good" },
+	{ DRM_MODE_LINK_STATUS_BAD, "Bad" },
+};
+DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
+
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -622,6 +632,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.tile_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "link-status",
+					drm_link_status_enum_list,
+					ARRAY_SIZE(drm_link_status_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.link_status_property = prop;
+
 	return 0;
 }
 
include/drm/drm_connector.h +6 -1
index ac9d7d8..5c335e8 100644
@@ -682,6 +682,12 @@ struct drm_connector {
 	uint8_t num_h_tile, num_v_tile;
 	uint8_t tile_h_loc, tile_v_loc;
 	uint16_t tile_h_size, tile_v_size;
+
+	/* Connector Link status
+	 * 0: If the link is Good
+	 * 1: If the link is Bad
+	 */
+	int link_status;
 };
 
 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
@@ -754,7 +760,6 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
-
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
 					 const char *path);
 int drm_mode_connector_set_tile_property(struct drm_connector *connector);
include/drm/drm_crtc.h +5 -0
index fa1aa21..737f4d3 100644
@@ -1151,6 +1151,11 @@ struct drm_mode_config {
 	 */
 	struct drm_property *tile_property;
 	/**
+	 * @link_status_property: Default connector property for link status
+	 * of a connector
+	 */
+	struct drm_property *link_status_property;
+	/**
 	 * @plane_type_property: Default plane property to differentiate
 	 * CURSOR, PRIMARY and OVERLAY legacy uses of planes.
 	 */
include/uapi/drm/drm_mode.h +4 -0
index 084b50a..f1b0afd 100644
@@ -121,6 +121,10 @@
 #define DRM_MODE_DIRTY_ON       1
 #define DRM_MODE_DIRTY_ANNOTATE 2
 
+/* Link Status options */
+#define DRM_MODE_LINK_STATUS_GOOD	0
+#define DRM_MODE_LINK_STATUS_BAD	1
+
 struct drm_mode_modeinfo {
 	__u32 clock;
 	__u16 hdisplay;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH v2 2/4 drm/i915: Set link status property for DP connector

In reply to Manasi Navare

This defines a helper function to set the property value. This will be used to set the link status to Bad in case of link training failures.

v2:
* Simplify the return value (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c  | 11 +++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 2 files changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +11 -0
index 1063afe..2b6f51c 100644
@@ -4640,6 +4640,17 @@ static int intel_dp_get_modes(struct drm_connector *connector)
 	return 0;
 }
 
+int
+intel_dp_set_link_status_property(struct drm_connector *connector,
+				  uint64_t val)
+{
+	struct drm_device *dev = connector->dev;
+
+	return drm_object_property_set_value(&connector->base,
+					     dev->mode_config.link_status_property,
+					     val);
+}
+
 static int
 intel_dp_connector_register(struct drm_connector *connector)
 {
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 2616d92..3cb7481 100644
@@ -1391,6 +1391,8 @@ u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
 bool intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
 bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			     struct intel_connector *intel_connector);
+int intel_dp_set_link_status_property(struct drm_connector *connector,
+				      uint64_t val);
 void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      int link_rate, uint8_t lane_count,
 			      bool link_mst);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v2 2/4
#6 lore raw

Re: [PATCH v2 2/4] drm/i915: Set link status property for DP connector

Quoted 7 lines · Manasi Navare

This defines a helper function to set the property value. This will be used to set the link status to Bad in case of link training failures.

v2:
* Simplify the return value (Jani Nikula)

Quoted 6 lines
Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Chris Wilson <[email protected]>
Quoted 40 lines
---
 drivers/gpu/drm/i915/intel_dp.c  | 11 +++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 2 files changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +11 -0
index 1063afe..2b6f51c 100644
@@ -4640,6 +4640,17 @@ static int intel_dp_get_modes(struct drm_connector *connector)
 	return 0;
 }
 
+int
+intel_dp_set_link_status_property(struct drm_connector *connector,
+				  uint64_t val)
+{
+	struct drm_device *dev = connector->dev;
+
+	return drm_object_property_set_value(&connector->base,
+					     dev->mode_config.link_status_property,
+					     val);
+}
+
 static int
 intel_dp_connector_register(struct drm_connector *connector)
 {
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 2616d92..3cb7481 100644
@@ -1391,6 +1391,8 @@ u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
 bool intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
 bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			     struct intel_connector *intel_connector);
+int intel_dp_set_link_status_property(struct drm_connector *connector,
+				      uint64_t val);
 void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      int link_rate, uint8_t lane_count,
 			      bool link_mst);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH v2 3/4 drm/i915: Find fallback link rate/lane count

In reply to Manasi Navare

If link training fails, then we need to fallback to lower link rate first and if link training fails at RBR, then fallback to lower lane count.
This function finds the next lower link rate/lane count value after link training failure.

v2:
Squash the patch that returns the link rate index (Jani Nikula)

Cc Ville Syrjala <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c  | 43 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  6 ++++++
 2 files changed, 49 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +43 -0
index 2b6f51c..fb4fcdd 100644
@@ -288,6 +288,49 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp,
 			       common_rates);
 }
 
+static int intel_dp_link_rate_index(struct intel_dp *intel_dp,
+				    int *common_rates, int link_rate)
+{
+	int common_len;
+	int index;
+
+	common_len = intel_dp_common_rates(intel_dp, common_rates);
+	for (index = 0; index < common_len; index++) {
+		if (link_rate == common_rates[common_len - index - 1])
+			return common_len - index - 1;
+	}
+
+	return -1;
+}
+
+void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
+					     int link_rate, uint8_t lane_count)
+{
+	int common_rates[DP_MAX_SUPPORTED_RATES] = {};
+	int common_len;
+	int link_rate_index = -1;
+
+	if (!intel_dp->link_train_failed)
+		return;
+
+	common_len = intel_dp_common_rates(intel_dp, common_rates);
+	link_rate_index = intel_dp_link_rate_index(intel_dp,
+						   common_rates,
+						   link_rate);
+	if (link_rate_index > 0) {
+		intel_dp->fallback_link_rate_index = link_rate_index - 1;
+		intel_dp->fallback_link_rate = common_rates[intel_dp->fallback_link_rate_index];
+		intel_dp->fallback_lane_count = intel_dp_max_lane_count(intel_dp);
+	} else if (lane_count > 1) {
+		intel_dp->fallback_link_rate_index = common_len - 1;
+		intel_dp->fallback_link_rate = common_rates[intel_dp->fallback_link_rate_index];
+		intel_dp->fallback_lane_count = lane_count >> 1;
+	} else {
+		DRM_ERROR("Link Training Unsuccessful\n");
+		intel_dp->link_train_failed = false;
+	}
+}
+
 static enum drm_mode_status
 intel_dp_mode_valid(struct drm_connector *connector,
 		    struct drm_display_mode *mode)
drivers/gpu/drm/i915/intel_drv.h +6 -0
index 3cb7481..bc25b2b 100644
@@ -897,6 +897,10 @@ struct intel_dp {
 	uint32_t DP;
 	int link_rate;
 	uint8_t lane_count;
+	int fallback_link_rate;
+	uint8_t fallback_lane_count;
+	int fallback_link_rate_index;
+	bool link_train_failed;
 	uint8_t sink_count;
 	bool link_mst;
 	bool has_audio;
@@ -1396,6 +1400,8 @@ int intel_dp_set_link_status_property(struct drm_connector *connector,
 void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      int link_rate, uint8_t lane_count,
 			      bool link_mst);
+void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
+					     int link_rate, uint8_t lane_count);
 void intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH v2 4/4 drm/i915: Implement Link Rate fallback on Link training failure

In reply to Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  4 ++
 drivers/gpu/drm/i915/intel_ddi.c              | 23 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 74 +++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  5 +-
 5 files changed, 110 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 75ad01d..a3df3a4 100644
@@ -519,6 +519,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
+		if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+			crtc_state->connectors_changed = true;
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +22 -1
index 938ac4d..319eeca 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,26 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = true;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +71 -3

111 lines not on this page · raw message

drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +4 -1
index bc25b2b..a54e9b7 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -1402,7 +1405,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#9 lore raw

Re: [PATCH v2 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Quoted 58 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  4 ++
 drivers/gpu/drm/i915/intel_ddi.c              | 23 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 74 +++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  5 +-
 5 files changed, 110 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 75ad01d..a3df3a4 100644
@@ -519,6 +519,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
+		if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+			crtc_state->connectors_changed = true;
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 938ac4d..319eeca 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,26 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1706

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +8 -1
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = true;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);

This is not just about DDI. Need to do this for the other cases too.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1716

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);

Looks like you never actually read connector->link_status... Why do you need both connector->link_status and intel_dp->link_train_failed? Do you think you have 4 states? What are they? Can't this all be in sync with the property?

Quoted 27 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +8 -2
index fb4fcdd..d1f0e2c 100644
@@ -354,8 +354,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (intel_dp->link_train_failed) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);

drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1654

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -1640,6 +1646,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (intel_dp->link_train_failed) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+

My general feeling is that there's starting to be a bit too much special casing around the fallback values. I'm not decided we need to fix this right away in this series, or whether it can be follow-up work.

One idea is to compute the common rates and lanes once when they're first needed, and all of the helpers would use that info. The fallback code would just trim those, and the conditional fallback stuff could be removed from all over the place.

Quoted 60 lines
drivers/gpu/drm/i915/intel_dp.c +37 -1
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],
@@ -4423,6 +4435,13 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
 
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,8 +4533,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected && intel_dp->link_train_failed)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
-	if (!intel_dp->detect_done)
+	if (!intel_dp->detect_done && !intel_dp->link_train_failed)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
 
 	intel_dp->detect_done = false;
@@ -5692,6 +5715,47 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+	bool reprobe = false;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+		if (mode->status != MODE_OK)
+			reprobe = true;
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+

drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5752

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	/* Set connector link status to BAD only if modeset required
+	 * for the current mode, if mode list changed then just send uevent
+	 * so that it can reprobe the connectors and validate modes and do
+	 * a modeset on a different valid mode.
+	 */
+	if (!reprobe) {
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_BAD);
+	}

I think the link status property should be set to bad unconditionally here. If the current link is bad, it is bad right now independent of modes fitting into the fallback link parameters.

Which makes me think, unless I'm missing something, that you might be able to prune the invalid modes and set the property right away when link training fails, and only use the work to do drm_kms_helper_hotplug_event.

Quoted 66 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5768,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +4 -1
index bc25b2b..a54e9b7 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -1402,7 +1405,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH v2 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Quoted 63 lines · Jani Nikula
Quoted 62 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  4 ++
 drivers/gpu/drm/i915/intel_ddi.c              | 23 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 74 +++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  5 +-
 5 files changed, 110 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 75ad01d..a3df3a4 100644
@@ -519,6 +519,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
+		if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+			crtc_state->connectors_changed = true;
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +4 -1
index 938ac4d..319eeca 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,26 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1706

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -0
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = true;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);

This is not just about DDI. Need to do this for the other cases too.

Yes, first series will g out for adding this support for DDI, then more patches to expand it to non DDI platforms.

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1716

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);

Looks like you never actually read connector->link_status... Why do you need both connector->link_status and intel_dp->link_train_failed? Do you think you have 4 states? What are they? Can't this all be in sync with the property?

This connector->link_status member of drm_Connector gets read in drm_atomic_helper_check_modeset() in the driver where it reads this
and sets crtc_state->connector_Changed to true if this link_status
has changed.
This is required so that the driver does a complete modeset.
This connector->link_status was in sync with the property. But reading the drm_object property in drm_atomic_helper_Check_modeset was causing the system to not boot.
intel_dp->link_train_failed also just indicates if the link failed, I will have to see if i can just use connector->link_status for this purpose.

Quoted 41 lines
Quoted 27 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +8 -2
index fb4fcdd..d1f0e2c 100644
@@ -354,8 +354,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (intel_dp->link_train_failed) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);

drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1654

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -1640,6 +1646,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (intel_dp->link_train_failed) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+

My general feeling is that there's starting to be a bit too much special casing around the fallback values. I'm not decided we need to fix this right away in this series, or whether it can be follow-up work.

Quoted 5 lines

One idea is to compute the common rates and lanes once when they're first needed, and all of the helpers would use that info. The fallback code would just trim those, and the conditional fallback stuff could be removed from all over the place.

These fallback values get computed in a separate helper function that I have added intel_dp_get_link_train_fallback_values. It is the previous patch.
I store the fallback values in intel_dp one at a time because for that
iteration of modeset we only need to try the fallback_link_rate
and fallback_lane_count so we dont need an array here.
Are you suggesting just changing the common_rates array itself to get trimmed to use the trimmed fallback values after link training fails? Could you please elaborate your thought?

Quoted 76 lines
Quoted 60 lines
drivers/gpu/drm/i915/intel_dp.c +37 -1
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],
@@ -4423,6 +4435,13 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
 
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,8 +4533,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected && intel_dp->link_train_failed)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
-	if (!intel_dp->detect_done)
+	if (!intel_dp->detect_done && !intel_dp->link_train_failed)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
 
 	intel_dp->detect_done = false;
@@ -5692,6 +5715,47 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+	bool reprobe = false;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+		if (mode->status != MODE_OK)
+			reprobe = true;
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+

drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5752

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	/* Set connector link status to BAD only if modeset required
+	 * for the current mode, if mode list changed then just send uevent
+	 * so that it can reprobe the connectors and validate modes and do
+	 * a modeset on a different valid mode.
+	 */
+	if (!reprobe) {
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_BAD);
+	}

I think the link status property should be set to bad unconditionally here. If the current link is bad, it is bad right now independent of modes fitting into the fallback link parameters.

Quoted 5 lines

Which makes me think, unless I'm missing something, that you might be able to prune the invalid modes and set the property right away when link training fails, and only use the work to do drm_kms_helper_hotplug_event.

The problem with setting the link_status property BAD irrespective of the
mode pruning is that, if the modes gets pruned and we set the link_sttaus to BAD Chris Wilson's driver checks that the link status is BAD and he first tries to attempt the modeset at the current mode without calling mode_valid, and that results in a failure in enocder->compute_config since now the mode does not fit and the pipe cannot be configured. This creates a lot of warnings/errors/kernel crash eventually.
So the best way is to set the link status as bad only when we want to force the modeset at the current mode, if the modes get pruned then in any case userspace will do another modeset at the next lower mode.

Manasi

Quoted 56 lines
Quoted 56 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5768,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +3 -0
index bc25b2b..a54e9b7 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
Quoted 13 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +1 -1
 struct dpll {
@@ -1402,7 +1405,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#11 lore raw

Re: [PATCH v2 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Quoted 95 lines · Manasi Navare
Quoted 63 lines · Jani Nikula
Quoted 62 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  4 ++
 drivers/gpu/drm/i915/intel_ddi.c              | 23 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 74 +++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  5 +-
 5 files changed, 110 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 75ad01d..a3df3a4 100644
@@ -519,6 +519,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
+		if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+			crtc_state->connectors_changed = true;
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +4 -1
index 938ac4d..319eeca 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,26 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1706

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -0
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = true;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);

This is not just about DDI. Need to do this for the other cases too.

Yes, first series will g out for adding this support for DDI, then more patches to expand it to non DDI platforms.

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1716

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);

Looks like you never actually read connector->link_status... Why do you need both connector->link_status and intel_dp->link_train_failed? Do you think you have 4 states? What are they? Can't this all be in sync with the property?

Quoted 10 lines

This connector->link_status member of drm_Connector gets read in drm_atomic_helper_check_modeset() in the driver where it reads this
and sets crtc_state->connector_Changed to true if this link_status
has changed.
This is required so that the driver does a complete modeset.
This connector->link_status was in sync with the property. But reading the drm_object property in drm_atomic_helper_Check_modeset was causing the system to not boot.
intel_dp->link_train_failed also just indicates if the link failed, I will have to see if i can just use connector->link_status for this purpose.

Please do. Usually if you add more than one variable for essentially the same thing, you'll end up having combinations of the variables (states) that you should not be in. At least you should have a clear idea what the states are where link_train_failed and link_status disagree.

Quoted 48 lines
Quoted 42 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +8 -2
index fb4fcdd..d1f0e2c 100644
@@ -354,8 +354,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (intel_dp->link_train_failed) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);

drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1654

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -1640,6 +1646,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (intel_dp->link_train_failed) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+

My general feeling is that there's starting to be a bit too much special casing around the fallback values. I'm not decided we need to fix this right away in this series, or whether it can be follow-up work.

Quoted 5 lines

One idea is to compute the common rates and lanes once when they're first needed, and all of the helpers would use that info. The fallback code would just trim those, and the conditional fallback stuff could be removed from all over the place.

Quoted 6 lines

These fallback values get computed in a separate helper function that I have added intel_dp_get_link_train_fallback_values. It is the previous patch. I store the fallback values in intel_dp one at a time because for that iteration of modeset we only need to try the fallback_link_rate and fallback_lane_count so we dont need an array here.

Sure. I'm *not* referring to my earlier suggestion of storing failing link rate, lane count pairs (although I think we'll need that eventually).

Quoted 3 lines

Are you suggesting just changing the common_rates array itself to get trimmed to use the trimmed fallback values after link training fails? Could you please elaborate your thought?

I'm not saying you should change this now. But having a lot of code check some fallback stuff is ugly and error prone. I'm just documenting the ideas to make this better.

I think this could be fixed by storing the common rates array and max lanes in intel_dp, instead of having them locally in a few functions, and then making the link rate and lane counting functions aware of the fallback stuff. Either the functions would check for the fallbacks, centralizing the checks in one place, and/or the fallback code would modify the common values stored in intel_dp, so that the link rate and lane counting functions would just work with the fallbacks. Code would be simpler overall.

Quoted 83 lines
Quoted 77 lines
Quoted 61 lines
drivers/gpu/drm/i915/intel_dp.c +37 -1
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],
@@ -4423,6 +4435,13 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
 
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,8 +4533,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected && intel_dp->link_train_failed)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
-	if (!intel_dp->detect_done)
+	if (!intel_dp->detect_done && !intel_dp->link_train_failed)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
 
 	intel_dp->detect_done = false;
@@ -5692,6 +5715,47 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+	bool reprobe = false;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+		if (mode->status != MODE_OK)
+			reprobe = true;
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+

drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5752

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	/* Set connector link status to BAD only if modeset required
+	 * for the current mode, if mode list changed then just send uevent
+	 * so that it can reprobe the connectors and validate modes and do
+	 * a modeset on a different valid mode.
+	 */
+	if (!reprobe) {
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_BAD);
+	}

I think the link status property should be set to bad unconditionally here. If the current link is bad, it is bad right now independent of modes fitting into the fallback link parameters.

Quoted 5 lines

Which makes me think, unless I'm missing something, that you might be able to prune the invalid modes and set the property right away when link training fails, and only use the work to do drm_kms_helper_hotplug_event.

Quoted 11 lines

The problem with setting the link_status property BAD irrespective of the mode pruning is that, if the modes gets pruned and we set the link_sttaus to BAD Chris Wilson's driver checks that the link status is BAD and he first tries to attempt the modeset at the current mode without calling mode_valid, and that results in a failure in enocder->compute_config since now the mode does not fit and the pipe cannot be configured. This creates a lot of warnings/errors/kernel crash eventually. So the best way is to set the link status as bad only when we want to force the modeset at the current mode, if the modes get pruned then in any case userspace will do another modeset at the next lower mode.

Why would the userspace driver retry the same mode without refreshing the mode list first if link status is bad?

If the link is bad, the link is *bad*, regardless of whether the current mode might eventually work or not. An interface that reports good on some values of bad is inconsistent (related reading [1]). IMO the userspace should first figure out if the current mode is valid or not, and then decide what to do.

Chris, any comments?

Side note, the kernel must not crash depending on what the userspace does.

BR,
Jani.

[1] http://sweng.the-davies.net/Home/rustys-api-design-manifesto

Quoted 71 lines

Manasi

Quoted 69 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5768,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +4 -1
index bc25b2b..a54e9b7 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -1402,7 +1405,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [PATCH v2 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Quoted 107 lines · Jani Nikula
Quoted 95 lines · Manasi Navare
Quoted 63 lines · Jani Nikula
Quoted 62 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  4 ++
 drivers/gpu/drm/i915/intel_ddi.c              | 23 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 74 +++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  5 +-
 5 files changed, 110 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 75ad01d..a3df3a4 100644
@@ -519,6 +519,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
+		if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+			crtc_state->connectors_changed = true;
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +4 -1
index 938ac4d..319eeca 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,26 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1706

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -0
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = true;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);

This is not just about DDI. Need to do this for the other cases too.

Yes, first series will g out for adding this support for DDI, then more patches to expand it to non DDI platforms.

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1716

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);

Looks like you never actually read connector->link_status... Why do you need both connector->link_status and intel_dp->link_train_failed? Do you think you have 4 states? What are they? Can't this all be in sync with the property?

Quoted 10 lines

This connector->link_status member of drm_Connector gets read in drm_atomic_helper_check_modeset() in the driver where it reads this
and sets crtc_state->connector_Changed to true if this link_status
has changed.
This is required so that the driver does a complete modeset.
This connector->link_status was in sync with the property. But reading the drm_object property in drm_atomic_helper_Check_modeset was causing the system to not boot.
intel_dp->link_train_failed also just indicates if the link failed, I will have to see if i can just use connector->link_status for this purpose.

Quoted 5 lines

Please do. Usually if you add more than one variable for essentially the same thing, you'll end up having combinations of the variables (states) that you should not be in. At least you should have a clear idea what the states are where link_train_failed and link_status disagree.

I will try to converge these.
How do we handle the case where it has tried all possible fallback values, lowest link rate and lowest lane count, now the link is still bad, DPR expects driver to stop link training with ERROR that link training is unsuccessful even after trying fallback. In this case we should not try to retrain again and in that case I was just setting link_train_failed to false again. Do you have any suggestions on how to handle this case, do we send the uevent in this case as well? But then we dont have fallback values since we have exhausted all fallback values.

Quoted 67 lines
Quoted 48 lines
Quoted 42 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +8 -2
index fb4fcdd..d1f0e2c 100644
@@ -354,8 +354,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (intel_dp->link_train_failed) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);

drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1654

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -1640,6 +1646,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (intel_dp->link_train_failed) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+

My general feeling is that there's starting to be a bit too much special casing around the fallback values. I'm not decided we need to fix this right away in this series, or whether it can be follow-up work.

Quoted 5 lines

One idea is to compute the common rates and lanes once when they're first needed, and all of the helpers would use that info. The fallback code would just trim those, and the conditional fallback stuff could be removed from all over the place.

Quoted 6 lines

These fallback values get computed in a separate helper function that I have added intel_dp_get_link_train_fallback_values. It is the previous patch. I store the fallback values in intel_dp one at a time because for that iteration of modeset we only need to try the fallback_link_rate and fallback_lane_count so we dont need an array here.

Sure. I'm *not* referring to my earlier suggestion of storing failing link rate, lane count pairs (although I think we'll need that eventually).

Quoted 3 lines

Are you suggesting just changing the common_rates array itself to get trimmed to use the trimmed fallback values after link training fails? Could you please elaborate your thought?

I'm not saying you should change this now. But having a lot of code check some fallback stuff is ugly and error prone. I'm just documenting the ideas to make this better.

Quoted 9 lines

I think this could be fixed by storing the common rates array and max lanes in intel_dp, instead of having them locally in a few functions, and then making the link rate and lane counting functions aware of the fallback stuff. Either the functions would check for the fallbacks, centralizing the checks in one place, and/or the fallback code would modify the common values stored in intel_dp, so that the link rate and lane counting functions would just work with the fallbacks. Code would be simpler overall.

Again this might involve a lot more changes since we would have to change all the helper functions that curerntly calculate max lanes and common_rates but this can definitely be done in the next round of clean up after these patches land. But nevertheless I will see if I can update the common_rates array now with fallback values instead of storing fallbck values separately in the intel_dp structure.

Manasi

Quoted 104 lines
Quoted 83 lines
Quoted 77 lines
Quoted 61 lines
drivers/gpu/drm/i915/intel_dp.c +37 -1
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],
@@ -4423,6 +4435,13 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
 
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,8 +4533,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected && intel_dp->link_train_failed)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
-	if (!intel_dp->detect_done)
+	if (!intel_dp->detect_done && !intel_dp->link_train_failed)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
 
 	intel_dp->detect_done = false;
@@ -5692,6 +5715,47 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+	bool reprobe = false;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+		if (mode->status != MODE_OK)
+			reprobe = true;
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+

drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5752

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	/* Set connector link status to BAD only if modeset required
+	 * for the current mode, if mode list changed then just send uevent
+	 * so that it can reprobe the connectors and validate modes and do
+	 * a modeset on a different valid mode.
+	 */
+	if (!reprobe) {
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_BAD);
+	}

I think the link status property should be set to bad unconditionally here. If the current link is bad, it is bad right now independent of modes fitting into the fallback link parameters.

Quoted 5 lines

Which makes me think, unless I'm missing something, that you might be able to prune the invalid modes and set the property right away when link training fails, and only use the work to do drm_kms_helper_hotplug_event.

Quoted 11 lines

The problem with setting the link_status property BAD irrespective of the mode pruning is that, if the modes gets pruned and we set the link_sttaus to BAD Chris Wilson's driver checks that the link status is BAD and he first tries to attempt the modeset at the current mode without calling mode_valid, and that results in a failure in enocder->compute_config since now the mode does not fit and the pipe cannot be configured. This creates a lot of warnings/errors/kernel crash eventually. So the best way is to set the link status as bad only when we want to force the modeset at the current mode, if the modes get pruned then in any case userspace will do another modeset at the next lower mode.

Why would the userspace driver retry the same mode without refreshing the mode list first if link status is bad?

If the link is bad, the link is *bad*, regardless of whether the current mode might eventually work or not. An interface that reports good on some values of bad is inconsistent (related reading [1]). IMO the userspace should first figure out if the current mode is valid or not, and then decide what to do.

Quoted 8 lines

Chris, any comments?

Side note, the kernel must not crash depending on what the userspace does.

BR,
Jani.

Chris, yes I think it is a good idea to always call mode_valid first on recieveing link_status as BAD and then calling setcrtc to set the current mode or whatever valid mode is. Then I would not need to set link status BAD conditionally in the driver. Could you make this change in your link_status patch and resend it to me?

Manasi

Quoted 61 lines

[1] http://sweng.the-davies.net/Home/rustys-api-design-manifesto

Quoted 58 lines

Manasi

Quoted 56 lines
Quoted 56 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5768,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +3 -0
index bc25b2b..a54e9b7 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
Quoted 16 lines
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +1 -1
 struct dpll {
@@ -1402,7 +1405,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

Re: [PATCH v2 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Quoted 323 lines · Manasi Navare
Quoted 107 lines · Jani Nikula
Quoted 95 lines · Manasi Navare
Quoted 63 lines · Jani Nikula
Quoted 62 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  4 ++
 drivers/gpu/drm/i915/intel_ddi.c              | 23 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 74 +++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  5 +-
 5 files changed, 110 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 75ad01d..a3df3a4 100644
@@ -519,6 +519,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
+		if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+			crtc_state->connectors_changed = true;
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +4 -1
index 938ac4d..319eeca 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,26 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1706

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -0
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = true;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);

This is not just about DDI. Need to do this for the other cases too.

Yes, first series will g out for adding this support for DDI, then more patches to expand it to non DDI platforms.

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
Quoted 9 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1716

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);

Looks like you never actually read connector->link_status... Why do you need both connector->link_status and intel_dp->link_train_failed? Do you think you have 4 states? What are they? Can't this all be in sync with the property?

Quoted 10 lines

This connector->link_status member of drm_Connector gets read in drm_atomic_helper_check_modeset() in the driver where it reads this
and sets crtc_state->connector_Changed to true if this link_status
has changed.
This is required so that the driver does a complete modeset.
This connector->link_status was in sync with the property. But reading the drm_object property in drm_atomic_helper_Check_modeset was causing the system to not boot.
intel_dp->link_train_failed also just indicates if the link failed, I will have to see if i can just use connector->link_status for this purpose.

Quoted 5 lines

Please do. Usually if you add more than one variable for essentially the same thing, you'll end up having combinations of the variables (states) that you should not be in. At least you should have a clear idea what the states are where link_train_failed and link_status disagree.

I will try to converge these.
How do we handle the case where it has tried all possible fallback values, lowest link rate and lowest lane count, now the link is still bad, DPR expects driver to stop link training with ERROR that link training is unsuccessful even after trying fallback. In this case we should not try to retrain again and in that case I was just setting link_train_failed to false again. Do you have any suggestions on how to handle this case, do we send the uevent in this case as well? But then we dont have fallback values since we have exhausted all fallback values.

Quoted 67 lines
Quoted 48 lines
Quoted 42 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +8 -2
index fb4fcdd..d1f0e2c 100644
@@ -354,8 +354,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (intel_dp->link_train_failed) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);

drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1654

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -1640,6 +1646,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (intel_dp->link_train_failed) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+

My general feeling is that there's starting to be a bit too much special casing around the fallback values. I'm not decided we need to fix this right away in this series, or whether it can be follow-up work.

Quoted 5 lines

One idea is to compute the common rates and lanes once when they're first needed, and all of the helpers would use that info. The fallback code would just trim those, and the conditional fallback stuff could be removed from all over the place.

Quoted 6 lines

These fallback values get computed in a separate helper function that I have added intel_dp_get_link_train_fallback_values. It is the previous patch. I store the fallback values in intel_dp one at a time because for that iteration of modeset we only need to try the fallback_link_rate and fallback_lane_count so we dont need an array here.

Sure. I'm *not* referring to my earlier suggestion of storing failing link rate, lane count pairs (although I think we'll need that eventually).

Quoted 3 lines

Are you suggesting just changing the common_rates array itself to get trimmed to use the trimmed fallback values after link training fails? Could you please elaborate your thought?

I'm not saying you should change this now. But having a lot of code check some fallback stuff is ugly and error prone. I'm just documenting the ideas to make this better.

Quoted 9 lines

I think this could be fixed by storing the common rates array and max lanes in intel_dp, instead of having them locally in a few functions, and then making the link rate and lane counting functions aware of the fallback stuff. Either the functions would check for the fallbacks, centralizing the checks in one place, and/or the fallback code would modify the common values stored in intel_dp, so that the link rate and lane counting functions would just work with the fallbacks. Code would be simpler overall.

Again this might involve a lot more changes since we would have to change all the helper functions that curerntly calculate max lanes and common_rates but this can definitely be done in the next round of clean up after these patches land. But nevertheless I will see if I can update the common_rates array now with fallback values instead of storing fallbck values separately in the intel_dp structure.

Manasi

Quoted 104 lines
Quoted 83 lines
Quoted 77 lines
Quoted 61 lines
drivers/gpu/drm/i915/intel_dp.c +37 -1
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],
@@ -4423,6 +4435,13 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->link_train_failed = false;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
 
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,8 +4533,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected && intel_dp->link_train_failed)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
-	if (!intel_dp->detect_done)
+	if (!intel_dp->detect_done && !intel_dp->link_train_failed)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
 
 	intel_dp->detect_done = false;
@@ -5692,6 +5715,47 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+	bool reprobe = false;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+		if (mode->status != MODE_OK)
+			reprobe = true;
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+

drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5752

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	/* Set connector link status to BAD only if modeset required
+	 * for the current mode, if mode list changed then just send uevent
+	 * so that it can reprobe the connectors and validate modes and do
+	 * a modeset on a different valid mode.
+	 */
+	if (!reprobe) {
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_BAD);
+	}

I think the link status property should be set to bad unconditionally here. If the current link is bad, it is bad right now independent of modes fitting into the fallback link parameters.

Quoted 5 lines

Which makes me think, unless I'm missing something, that you might be able to prune the invalid modes and set the property right away when link training fails, and only use the work to do drm_kms_helper_hotplug_event.

Quoted 11 lines

The problem with setting the link_status property BAD irrespective of the mode pruning is that, if the modes gets pruned and we set the link_sttaus to BAD Chris Wilson's driver checks that the link status is BAD and he first tries to attempt the modeset at the current mode without calling mode_valid, and that results in a failure in enocder->compute_config since now the mode does not fit and the pipe cannot be configured. This creates a lot of warnings/errors/kernel crash eventually. So the best way is to set the link status as bad only when we want to force the modeset at the current mode, if the modes get pruned then in any case userspace will do another modeset at the next lower mode.

Why would the userspace driver retry the same mode without refreshing the mode list first if link status is bad?

If the link is bad, the link is *bad*, regardless of whether the current mode might eventually work or not. An interface that reports good on some values of bad is inconsistent (related reading [1]). IMO the userspace should first figure out if the current mode is valid or not, and then decide what to do.

Quoted 8 lines

Chris, any comments?

Side note, the kernel must not crash depending on what the userspace does.

BR,
Jani.

Quoted 6 lines

Chris, yes I think it is a good idea to always call mode_valid first on recieveing link_status as BAD and then calling setcrtc to set the current mode or whatever valid mode is. Then I would not need to set link status BAD conditionally in the driver. Could you make this change in your link_status patch and resend it to me?

Manasi

Chris,
I was able to further investigate this and I found the problem in my code, where I had to add a check that only if crtc is present, it will try to configure the pipe else it will return EINVAL to userspace at much earlier stage and that fixed the kernel errors (NULL dereferencing) that I was seeing. So Jani, now I can set the link_status to bad unconditionally and send a hotplug uevent. I will make these changes and submit the new revision of patches.

Chris, your link_status patch is good to go!

Manasi

Quoted 76 lines
Quoted 76 lines

[1] http://sweng.the-davies.net/Home/rustys-api-design-manifesto

Quoted 71 lines

Manasi

Quoted 69 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5768,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +4 -1
index bc25b2b..a54e9b7 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -1402,7 +1405,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

PATCH v3 4/4 drm/i915: Implement Link Rate fallback on Link training failure

In reply to Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v3:
* Set link status property to BAd unconditionally (Jani Nikula)
* Dont use two separate variables link_train_failed and link_status to indicate same thing (Jani Nikula)
v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  7 +++
 drivers/gpu/drm/i915/intel_ddi.c              | 22 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 70 ++++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  6 ++-
 5 files changed, 105 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +7 -0
index 75ad01d..94b0b3a 100644
@@ -519,6 +519,13 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		if (connector->state->crtc) {
+			crtc_state = drm_atomic_get_existing_crtc_state(state,
+									connector->state->crtc);
+			if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+				crtc_state->connectors_changed = true;
+		}
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +21 -1
index 938ac4d..a59f8d2 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,25 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
+			      link_rate, lane_count);
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +64 -6

124 lines not on this page · raw message

drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +4 -2
index bc25b2b..c0378a9 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -900,7 +903,6 @@ struct intel_dp {
 	int fallback_link_rate;
 	uint8_t fallback_lane_count;
 	int fallback_link_rate_index;
-	bool link_train_failed;
 	uint8_t sink_count;
 	bool link_mst;
 	bool has_audio;
@@ -1402,7 +1404,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

Re: [PATCH v3 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Jani, could you please take a look at this patch?
I have addressed your comments on the previous revision. The common_rates array can be moved into Intel dp structure in a follow up patch since that would require changes in a lot of places other than the link rate fallback implementation.

Regards
Manasi

Quoted 283 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v3:
* Set link status property to BAd unconditionally (Jani Nikula)
* Dont use two separate variables link_train_failed and link_status to indicate same thing (Jani Nikula)
v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  7 +++
 drivers/gpu/drm/i915/intel_ddi.c              | 22 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 70 ++++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  6 ++-
 5 files changed, 105 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +7 -0
index 75ad01d..94b0b3a 100644
@@ -519,6 +519,13 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		if (connector->state->crtc) {
+			crtc_state = drm_atomic_get_existing_crtc_state(state,
+									connector->state->crtc);
+			if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+				crtc_state->connectors_changed = true;
+		}
 	}
 
 	/*
drivers/gpu/drm/i915/intel_ddi.c +21 -1
index 938ac4d..a59f8d2 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,25 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
+			      link_rate, lane_count);
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +64 -6
index fb4fcdd..659b17f 100644
@@ -310,9 +310,6 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 	int common_len;
 	int link_rate_index = -1;
 
-	if (!intel_dp->link_train_failed)
-		return;
-
 	common_len = intel_dp_common_rates(intel_dp, common_rates);
 	link_rate_index = intel_dp_link_rate_index(intel_dp,
 						   common_rates,
@@ -327,7 +324,6 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		intel_dp->fallback_lane_count = lane_count >> 1;
 	} else {
 		DRM_ERROR("Link Training Unsuccessful\n");
-		intel_dp->link_train_failed = false;
 	}
 }
 
@@ -354,8 +350,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (connector->link_status == DRM_MODE_LINK_STATUS_BAD) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);
@@ -1593,6 +1595,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	enum port port = dp_to_dig_port(intel_dp)->port;
 	struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 	int lane_count, clock;
 	int min_lane_count = 1;
 	int max_lane_count = intel_dp_max_lane_count(intel_dp);
@@ -1640,6 +1643,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (connector->link_status == DRM_MODE_LINK_STATUS_BAD) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],
@@ -4423,6 +4432,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
 
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,6 +4529,11 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected &&
+	    connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
 	if (!intel_dp->detect_done)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
@@ -5692,6 +5712,40 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+
+	/* Set connector link status to BAD and send a Uevent to notify
+	 * userspace to do a modeset.
+	 */
+	connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+	intel_dp_set_link_status_property(connector,
+					  DRM_MODE_LINK_STATUS_BAD);
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5758,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +4 -2
index bc25b2b..c0378a9 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -900,7 +903,6 @@ struct intel_dp {
 	int fallback_link_rate;
 	uint8_t fallback_lane_count;
 	int fallback_link_rate_index;
-	bool link_train_failed;
 	uint8_t sink_count;
 	bool link_mst;
 	bool has_audio;
@@ -1402,7 +1404,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#16 lore raw

Re: [PATCH v3 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Quoted 5 lines · Manasi Navare

Jani, could you please take a look at this patch?
I have addressed your comments on the previous revision. The common_rates array can be moved into Intel dp structure in a follow up patch since that would require changes in a lot of places other than the link rate fallback implementation.

I think this is looking good. I think you need to put this together in a series that doesn't add something first, and then remove it, i.e. build a coherent story from the start. It's not that many patches. Then you need to post all patches on both intel-gfx and dri-devel, preferrably in a fresh thread, not replying to previous versions. The thread is too confusing now with so many versions.

Then we need to get r-b and acks for the drm changes. Daniel, can you help with the last part?

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#17 lore raw

Re: [PATCH v3 4/4] drm/i915: Implement Link Rate fallback on Link training failure

In reply to Manasi Navare
Quoted 37 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v3:
* Set link status property to BAd unconditionally (Jani Nikula)
* Dont use two separate variables link_train_failed and link_status to indicate same thing (Jani Nikula)
v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  7 +++
 drivers/gpu/drm/i915/intel_ddi.c              | 22 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 70 ++++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  6 ++-
 5 files changed, 105 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +0 -0
index 75ad01d..94b0b3a 100644
@@ -519,6 +519,13 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);

drivers/gpu/drm/drm_atomic_helper.c static int handle_conflicting_encoders(struct drm_atomic_state *state, · line 529

Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +7 -0
 		if (ret)
 			return ret;
+
+		if (connector->state->crtc) {
+			crtc_state = drm_atomic_get_existing_crtc_state(state,
+									connector->state->crtc);
+			if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+				crtc_state->connectors_changed = true;
+		}
 	}

Could this be a separate patch? Anyway needs to be posted on dri-devel.

Quoted 16 lines
drivers/gpu/drm/drm_atomic_helper.c +0 -0
 	/*
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 938ac4d..a59f8d2 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1702

Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -1
@@ -1694,7 +1696,25 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
+			      link_rate, lane_count);
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;

Why does this not use intel_dp_set_link_status_property()?

Quoted 23 lines
drivers/gpu/drm/i915/intel_ddi.c +15 -0
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +0 -0
index fb4fcdd..659b17f 100644

drivers/gpu/drm/i915/intel_dp.c void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, · line 315

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +0 -3
@@ -310,9 +310,6 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 	int common_len;
 	int link_rate_index = -1;
 
-	if (!intel_dp->link_train_failed)
-		return;
-

You add this in an earlier patch and now remove it?

Quoted 50 lines
drivers/gpu/drm/i915/intel_dp.c +15 -3
 	common_len = intel_dp_common_rates(intel_dp, common_rates);
 	link_rate_index = intel_dp_link_rate_index(intel_dp,
 						   common_rates,
@@ -327,7 +324,6 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		intel_dp->fallback_lane_count = lane_count >> 1;
 	} else {
 		DRM_ERROR("Link Training Unsuccessful\n");
-		intel_dp->link_train_failed = false;
 	}
 }
 
@@ -354,8 +350,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (connector->link_status == DRM_MODE_LINK_STATUS_BAD) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);
@@ -1593,6 +1595,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	enum port port = dp_to_dig_port(intel_dp)->port;
 	struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 	int lane_count, clock;
 	int min_lane_count = 1;
 	int max_lane_count = intel_dp_max_lane_count(intel_dp);
@@ -1640,6 +1643,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (connector->link_status == DRM_MODE_LINK_STATUS_BAD) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],

drivers/gpu/drm/i915/intel_dp.c static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, · line 4440

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -4423,6 +4432,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);

Seems like it would be a good idea to have this intel_dp_set_link_status_property() helper set connector->link_status too.

Quoted 121 lines
drivers/gpu/drm/i915/intel_dp.c +43 -0
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,6 +4529,11 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected &&
+	    connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
 	if (!intel_dp->detect_done)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
@@ -5692,6 +5712,40 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+
+	/* Set connector link status to BAD and send a Uevent to notify
+	 * userspace to do a modeset.
+	 */
+	connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+	intel_dp_set_link_status_property(connector,
+					  DRM_MODE_LINK_STATUS_BAD);
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5758,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +4 -2
index bc25b2b..c0378a9 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -900,7 +903,6 @@ struct intel_dp {
 	int fallback_link_rate;
 	uint8_t fallback_lane_count;
 	int fallback_link_rate_index;
-	bool link_train_failed;
 	uint8_t sink_count;
 	bool link_mst;
 	bool has_audio;
@@ -1402,7 +1404,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH v3 4/4] drm/i915: Implement Link Rate fallback on Link training failure

Quoted 42 lines · Jani Nikula
Quoted 41 lines · Manasi Navare

If link training at a link rate optimal for a particular mode fails during modeset's atomic commit phase, then we let the modeset complete and then retry. We save the link rate value at which link training failed, update the link status property to "BAD" and use a lower link rate to prune the modes. It will redo the modeset on the current mode at lower link rate or if the current mode gets pruned due to lower link constraints then, it will send a hotplug uevent for userspace to handle it.

This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4, 4.3.1.6.

v3:
* Set link status property to BAd unconditionally (Jani Nikula)
* Dont use two separate variables link_train_failed and link_status to indicate same thing (Jani Nikula)
v2:
* Squashed a few patches (Jani Nikula)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c           |  7 +++
 drivers/gpu/drm/i915/intel_ddi.c              | 22 ++++++++-
 drivers/gpu/drm/i915/intel_dp.c               | 70 ++++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 12 +++--
 drivers/gpu/drm/i915/intel_drv.h              |  6 ++-
 5 files changed, 105 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -0
index 75ad01d..94b0b3a 100644
@@ -519,6 +519,13 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					       connector_state);
 		if (ret)
 			return ret;
+
+		if (connector->state->crtc) {
Quoted 9 lines

drivers/gpu/drm/drm_atomic_helper.c static int handle_conflicting_encoders(struct drm_atomic_state *state, · line 529

Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c +5 -0
+			crtc_state = drm_atomic_get_existing_crtc_state(state,
+									connector->state->crtc);
+			if (connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+				crtc_state->connectors_changed = true;
+		}
 	}

Could this be a separate patch? Anyway needs to be posted on dri-devel.

Yes I agree, I will move this into a separate patch right after the patch where I declare the connector link status.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_atomic_helper.c +0 -0
 	/*
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 938ac4d..a59f8d2 100644
@@ -1684,6 +1684,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 
Quoted 14 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · line 1702

Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -1
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
@@ -1694,7 +1696,25 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_prepare_dp_ddi_buffers(encoder);
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	intel_dp_start_link_train(intel_dp);
+	if (!intel_dp_start_link_train(intel_dp)) {
+		DRM_DEBUG_KMS("Link Training failed at link rate = %d, lane count = %d",
+			      link_rate, lane_count);
+		connector->link_status = DRM_MODE_LINK_STATUS_BAD;

Why does this not use intel_dp_set_link_status_property()?

I will move this connector->link_status setting inside the set_link_status function.

Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/i915/intel_ddi.c +15 -0
+		intel_dp_get_link_train_fallback_values(intel_dp, link_rate,
+							lane_count);
+		/* Schedule a Hotplug Uevent to userspace to start modeset */
+		schedule_work(&intel_connector->modeset_retry_work);
+	} else {
+		DRM_DEBUG_KMS("Link Training Passed at Link Rate = %d, Lane count = %d",
+			      link_rate, lane_count);
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);
+	}
+
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
 }
drivers/gpu/drm/i915/intel_dp.c +0 -0
index fb4fcdd..659b17f 100644
@@ -310,9 +310,6 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 	int common_len;
 	int link_rate_index = -1;
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_dp.c void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, · line 315

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0 -3
-	if (!intel_dp->link_train_failed)
-		return;
-

You add this in an earlier patch and now remove it?

I removed it to address the comment about not using link_train_failed and link_status to indicate the same thing. But this will be cleaned up when I submit a clean patch series so that it does not appear as added in previous patch and removed here.

Quoted 55 lines
Quoted 55 lines
drivers/gpu/drm/i915/intel_dp.c +17 -3
 	common_len = intel_dp_common_rates(intel_dp, common_rates);
 	link_rate_index = intel_dp_link_rate_index(intel_dp,
 						   common_rates,
@@ -327,7 +324,6 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		intel_dp->fallback_lane_count = lane_count >> 1;
 	} else {
 		DRM_ERROR("Link Training Unsuccessful\n");
-		intel_dp->link_train_failed = false;
 	}
 }
 
@@ -354,8 +350,14 @@ void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 		target_clock = fixed_mode->clock;
 	}
 
-	max_link_clock = intel_dp_max_link_rate(intel_dp);
-	max_lanes = intel_dp_max_lane_count(intel_dp);
+	/* Prune the modes using the fallback link rate/lane count */
+	if (connector->link_status == DRM_MODE_LINK_STATUS_BAD) {
+		max_link_clock = intel_dp->fallback_link_rate;
+		max_lanes = intel_dp->fallback_lane_count;
+	} else {
+		max_link_clock = intel_dp_max_link_rate(intel_dp);
+		max_lanes = intel_dp_max_lane_count(intel_dp);
+	}
 
 	max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
 	mode_rate = intel_dp_link_required(target_clock, 18);
@@ -1593,6 +1595,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	enum port port = dp_to_dig_port(intel_dp)->port;
 	struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct drm_connector *connector = &intel_connector->base;
 	int lane_count, clock;
 	int min_lane_count = 1;
 	int max_lane_count = intel_dp_max_lane_count(intel_dp);
@@ -1640,6 +1643,12 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
+	/* Fall back to lower link rate in case of failure in previous modeset */
+	if (connector->link_status == DRM_MODE_LINK_STATUS_BAD) {
+		min_lane_count = max_lane_count = intel_dp->fallback_lane_count;
+		min_clock = max_clock = intel_dp->fallback_link_rate_index;
+	}
+
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "
 		      "max bw %d pixel clock %iKHz\n",
 		      max_lane_count, common_rates[max_clock],
@@ -4423,6 +4432,12 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 		intel_dp->compliance_test_active = 0;
 		intel_dp->compliance_test_type = 0;
 		intel_dp->compliance_test_data = 0;
+		intel_dp->fallback_link_rate_index = -1;
+		intel_dp->fallback_link_rate = 0;
Quoted 9 lines

drivers/gpu/drm/i915/intel_dp.c static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, · line 4440

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +4 -0
+		intel_dp->fallback_lane_count = 0;
+		connector->link_status = DRM_MODE_LINK_STATUS_GOOD;
+		intel_dp_set_link_status_property(connector,
+						  DRM_MODE_LINK_STATUS_GOOD);

Seems like it would be a good idea to have this intel_dp_set_link_status_property() helper set connector->link_status too.

Yup, will do this change.

Regards
Manasi

Quoted 113 lines
Quoted 113 lines
drivers/gpu/drm/i915/intel_dp.c +43 -0
 		if (intel_dp->is_mst) {
 			DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
@@ -4514,6 +4529,11 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	/* If this is a retry due to link trianing failure */
+	if (status == connector_status_connected &&
+	    connector->link_status == DRM_MODE_LINK_STATUS_BAD)
+		return status;
+
 	/* If full detect is not performed yet, do a full detect */
 	if (!intel_dp->detect_done)
 		status = intel_dp_long_pulse(intel_dp->attached_connector);
@@ -5692,6 +5712,40 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	return false;
 }
 
+static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
+{
+	struct intel_connector *intel_connector;
+	struct drm_connector *connector;
+	struct drm_display_mode *mode;
+	bool verbose_prune = true;
+
+	intel_connector = container_of(work, typeof(*intel_connector),
+				       modeset_retry_work);
+	connector = &intel_connector->base;
+
+	/* Grab the locks before changing connector property*/
+	mutex_lock(&connector->dev->mode_config.mutex);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
+		      connector->name);
+	list_for_each_entry(mode, &connector->modes, head) {
+		mode->status = intel_dp_mode_valid(connector,
+						   mode);
+	}
+	drm_mode_prune_invalid(connector->dev, &connector->modes,
+			       verbose_prune);
+
+	/* Set connector link status to BAD and send a Uevent to notify
+	 * userspace to do a modeset.
+	 */
+	connector->link_status = DRM_MODE_LINK_STATUS_BAD;
+	intel_dp_set_link_status_property(connector,
+					  DRM_MODE_LINK_STATUS_BAD);
+	mutex_unlock(&connector->dev->mode_config.mutex);
+
+	/* Send Hotplug uevent so userspace can reprobe */
+	drm_kms_helper_hotplug_event(connector->dev);
+}
+
 bool
 intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			struct intel_connector *intel_connector)
@@ -5704,6 +5758,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	enum port port = intel_dig_port->port;
 	int type;
 
+	/* Initialize the work for modeset in case of link train failure */
+	INIT_WORK(&intel_connector->modeset_retry_work,
+		  intel_dp_modeset_retry_work_fn);
+
 	if (WARN(intel_dig_port->max_lanes < 1,
 		 "Not enough lanes (%d) for DP on port %c\n",
 		 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
index 0048b52..10f81ab 100644
@@ -310,9 +310,15 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp)
 				DP_TRAINING_PATTERN_DISABLE);
 }
 
-void
+bool
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
-	intel_dp_link_training_clock_recovery(intel_dp);
-	intel_dp_link_training_channel_equalization(intel_dp);
+	bool ret;
+
+	if (intel_dp_link_training_clock_recovery(intel_dp)) {
+		ret = intel_dp_link_training_channel_equalization(intel_dp);
+		if (ret)
+			return true;
+	}
+	return false;
 }
drivers/gpu/drm/i915/intel_drv.h +3 -1
index bc25b2b..c0378a9 100644
@@ -312,6 +312,9 @@ struct intel_connector {
 	void *port; /* store this opaque as its illegal to dereference it */
 
 	struct intel_dp *mst_port;
+
+	/* Work struct to schedule a uevent on link train failure */
+	struct work_struct modeset_retry_work;
 };
 
 struct dpll {
@@ -900,7 +903,6 @@ struct intel_dp {
 	int fallback_link_rate;
 	uint8_t fallback_lane_count;
 	int fallback_link_rate_index;
-	bool link_train_failed;
 	uint8_t sink_count;
 	bool link_mst;
 	bool has_audio;
@@ -1402,7 +1404,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
Quoted 11 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +1 -1
 			      bool link_mst);
 void intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					     int link_rate, uint8_t lane_count);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
+bool intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_reset(struct drm_encoder *encoder);
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

✗ Fi.CI.BAT: failure for Handle link training failure during modeset for DDI

In reply to Manasi Navare
== Series Details ==

== Series Details ==

Series: Handle link training failure during modeset for DDI
URL : https://patchwork.freedesktop.org/series/14556/
State : failure

== Summary ==

Series 14556v1 Handle link training failure during modeset for DDI
https://patchwork.freedesktop.org/api/1.0/series/14556/revisions/1/mbox/

Test drv_module_reload_basic:

                pass       -> INCOMPLETE (fi-skl-6770hq)
                dmesg-warn -> PASS       (fi-hsw-4770)
Test kms_force_connector_basic:
        Subgroup force-edid:
                dmesg-warn -> PASS       (fi-snb-2520m)
Test kms_pipe_crc_basic:
        Subgroup bad-pipe:
                dmesg-warn -> PASS       (fi-ilk-650)
fi-bdw-5557u     total:241  pass:226  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:241  pass:201  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:241  pass:213  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:241  pass:213  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:241  pass:209  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:241  pass:221  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-ilk-650       total:241  pass:187  dwarn:0   dfail:0   fail:0   skip:54 
fi-ivb-3520m     total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-ivb-3770      total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-kbl-7200u     total:241  pass:219  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:241  pass:227  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:6    pass:5    dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2520m     total:241  pass:208  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:241  pass:207  dwarn:0   dfail:0   fail:0   skip:34 

f3968d51ade8c02e8868c2608ea4adb5a4afe301 drm-intel-nightly: 2016y-10m-28d-19h-57m-33s UTC integration manifest eac571a drm/i915: Implement Link Rate fallback on Link training failure
ff275dd drm/i915: Find fallback link rate/lane count
fd42134 drm/i915: Set link status property for DP connector
7a0359a drm: Add a new connector property for link status

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_2854/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw

✗ Fi.CI.BAT: failure for Handle link training failure during modeset for DDI (rev2)

In reply to Manasi Navare
== Series Details ==

== Series Details ==

Series: Handle link training failure during modeset for DDI (rev2)
URL : https://patchwork.freedesktop.org/series/14556/
State : failure

== Summary ==

Series 14556v2 Handle link training failure during modeset for DDI
https://patchwork.freedesktop.org/api/1.0/series/14556/revisions/2/mbox/

Test drv_module_reload_basic:

                dmesg-warn -> PASS       (fi-ilk-650)
                dmesg-warn -> PASS       (fi-bdw-5557u)
                pass       -> INCOMPLETE (fi-skl-6770hq)
                dmesg-warn -> INCOMPLETE (fi-skl-6700k)
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-legacy:
                pass       -> DMESG-WARN (fi-ilk-650)
        Subgroup basic-flip-before-cursor-varying-size:
                pass       -> DMESG-WARN (fi-ilk-650)
Test kms_force_connector_basic:
        Subgroup force-edid:
                dmesg-warn -> PASS       (fi-snb-2520m)
Test kms_pipe_crc_basic:
        Subgroup bad-nb-words-1:
                pass       -> DMESG-WARN (fi-ilk-650)
        Subgroup bad-nb-words-3:
                dmesg-warn -> PASS       (fi-ilk-650)
        Subgroup nonblocking-crc-pipe-a-frame-sequence:
                pass       -> DMESG-WARN (fi-ilk-650)
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (fi-ilk-650)
fi-bdw-5557u     total:241  pass:226  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:241  pass:201  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:241  pass:213  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:241  pass:213  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:241  pass:209  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:241  pass:221  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-ilk-650       total:241  pass:180  dwarn:7   dfail:0   fail:0   skip:54 
fi-ivb-3520m     total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-ivb-3770      total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-kbl-7200u     total:241  pass:219  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:241  pass:227  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:6    pass:5    dwarn:0   dfail:0   fail:0   skip:0  
fi-skl-6770hq    total:6    pass:5    dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2520m     total:241  pass:208  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:241  pass:207  dwarn:0   dfail:0   fail:0   skip:34 

6a1197bcb5cc18a56ad4ae8e6d706a212bc3db7d drm-intel-nightly: 2016y-10m-31d-14h-58m-16s UTC integration manifest d3c54ba drm/i915: Implement Link Rate fallback on Link training failure
14102d8 drm/i915: Find fallback link rate/lane count
8705bee drm/i915: Set link status property for DP connector
cd53886 drm: Add a new connector property for link status

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_2867/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw

✗ Fi.CI.BAT: failure for Handle link training failure during modeset for DDI (rev3)

In reply to Manasi Navare
== Series Details ==

== Series Details ==

Series: Handle link training failure during modeset for DDI (rev3)
URL : https://patchwork.freedesktop.org/series/14556/
State : failure

== Summary ==

Series 14556v3 Handle link training failure during modeset for DDI
https://patchwork.freedesktop.org/api/1.0/series/14556/revisions/3/mbox/

Test drv_module_reload_basic:

                pass       -> INCOMPLETE (fi-skl-6770hq)
                dmesg-warn -> INCOMPLETE (fi-skl-6700k)
fi-bdw-5557u     total:241  pass:226  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:241  pass:201  dwarn:0   dfail:0   fail:0   skip:40 
fi-byt-j1900     total:241  pass:213  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:241  pass:209  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:241  pass:221  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-ilk-650       total:241  pass:187  dwarn:0   dfail:0   fail:0   skip:54 
fi-ivb-3520m     total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-ivb-3770      total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-kbl-7200u     total:241  pass:219  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:241  pass:227  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:6    pass:5    dwarn:0   dfail:0   fail:0   skip:0  
fi-skl-6770hq    total:6    pass:5    dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2520m     total:241  pass:208  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:241  pass:207  dwarn:0   dfail:0   fail:0   skip:34 

bf6b989af8b0fde56a352d9005c97b2d8e3bbbe3 drm-intel-nightly: 2016y-11m-02d-15h-44m-03s UTC integration manifest 06564f1 drm/i915: Implement Link Rate fallback on Link training failure
3e2e35f drm/i915: Find fallback link rate/lane count
a4fc113 drm/i915: Set link status property for DP connector
0abe534 drm: Add a new connector property for link status

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_2896/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx