Handle Link Training Failure during modeset
Subsystems (3)
cover Handle Link Training Failure during modeset
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values.
This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property changed 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 | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138 +++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 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:
* 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)
--- 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
@@ -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
@@ -695,6 +695,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)
@@ -767,7 +773,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
@@ -1164,6 +1164,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
@@ -129,6 +129,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
PATCH 2/5 drm/i915: Set link status property for DP connector
In reply to Manasi NavareThis 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.
v3:
* Set connector->link_status in this function (Jani Nikula)
v2:
* Simplify the return value (Jani Nikula)
--- drivers/gpu/drm/i915/intel_dp.c | 12 ++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +12 -0
@@ -4640,6 +4640,18 @@ 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; + + connector->link_status = val; +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
@@ -1381,6 +1381,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
PATCH 3/5 drm/i915: Update CRTC state if connector link status property changed
In reply to Manasi NavareCRTC state connector_changed needs to be set to true
if connector link status property has changed. This will tell the driver to do a complete modeset due to change in connector property.
--- drivers/gpu/drm/drm_atomic_helper.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +7 -0
@@ -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; + } }/*
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Find fallback link rate/lane count
In reply to Manasi NavareIf 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)
--- drivers/gpu/drm/i915/intel_dp.c | 42 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 6 ++++++ 2 files changed, 48 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +42 -0
@@ -288,6 +288,48 @@ 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 ; +} + +int 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 ; + + 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" ); +return -1 ; + } + +return 0 ; +} +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
@@ -888,6 +888,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;
@@ -1386,6 +1390,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); +int 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
PATCH 5/5 drm/i915: Implement Link Rate fallback on Link training failure
In reply to Manasi NavareIf 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.
v4:
* Add fallback support for non DDI platforms too
* Set connector->link status inside set_link_status function (Jani Nikula)
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)
--- drivers/gpu/drm/i915/intel_ddi.c | 21 +++++- drivers/gpu/drm/i915/intel_dp.c | 104 +++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 6 +- 4 files changed, 133 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +20 -1
@@ -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,24 @@ 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); +if (!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 ; +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 +100 -4
170 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dp_link_training.c +9 -3
@@ -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
@@ -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 {
@@ -891,7 +894,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;
@@ -1392,7 +1394,7 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp, bool link_mst);int 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
Re: [Intel-gfx] [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure
Quoted 25 lines · Manasi Navare
drivers/gpu/drm/i915/intel_dp.c +21
-0@@ -5692,6 +5751,39 @@ 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);
drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5784
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+ +/* Set connector link status to BAD and send a Uevent to notify +* userspace to do a modeset. +*/ +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);
One downside of keeping all the signalling logic here in i915 is that we don't have a good spot to put the kerneldoc for this new link status property within drm_connector.c for others to easily spot. My suggestion would be to extract function with the following rough pseudo-code:
drm_connector_set_link_status(connector, status)
{
mutex_lock(mode_config.mutex);
/* what intel_dp_set_link_status_property() does */
mutex_unlock(mode_config.mutex);
drm_kms_helper_hotplug_event()
}Within intel_dp_modeset_retry_work_fn we'd then first need to drop the lock, and then call this function. The lock drop&reacquire is a bit ugly, but:
- it doesn't matter from a performance pov, this is a slow, asynchronous work.
- it doesn't matter for correctnes, the only thing we need is to drop the lock before calling drm_kms_helper_hotplug_event, and that we update the link status and the mode list before that too.
- long term I expect that properties will get separate locks to protect their values, and restrict mode_config.mutex to just mode probing. Which means drm_connnector_set_link_status will use a different lock anyway.
- it nicely encapsulates stuff imo.
Kerneldoc for drm_connector_set_link_status should mention that this needs to be run from some async work item, and ofc have the full explanation (maybe even quote some pseudo-code, see e.g. drm_modeset_lock.c comments) of how this should be used.
Since this is late-stage polish definitely wait for more feedback and for the design to fully settle first.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure
Quoted 33 lines · Daniel Vetter
Quoted 32 lines · Manasi Navare
drivers/gpu/drm/i915/intel_dp.c +28
-0@@ -5692,6 +5751,39 @@ 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. +*/ +intel_dp_set_link_status_property (connector, +DRM_MODE_LINK_STATUS_BAD ); +mutex_unlock (&connector->dev->mode_config.mutex);
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5784
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ +/* Send Hotplug uevent so userspace can reprobe */ +drm_kms_helper_hotplug_event (connector->dev);One downside of keeping all the signalling logic here in i915 is that we don't have a good spot to put the kerneldoc for this new link status property within
drm_connector.cfor others to easily spot. My suggestion would be to extract function with the following rough pseudo-code:
Thanks for this. I wanted Manasi to keep the work struct and function within i915, but I fell short of coming up with this division.
BR,
Jani.
Quoted 32 lines
drm_connector_set_link_status(connector, status){ mutex_lock(mode_config.mutex); /* what intel_dp_set_link_status_property() does */ mutex_unlock(mode_config.mutex); drm_kms_helper_hotplug_event() }Within
intel_dp_modeset_retry_work_fnwe'd then first need to drop the lock, and then call this function. The lock drop&reacquire is a bit ugly, but:
- it doesn't matter from a performance pov, this is a slow, asynchronous work.
- it doesn't matter for correctnes, the only thing we need is to drop the lock before callingdrm_kms_helper_hotplug_event, and that we update the link status and the mode list before that too.
- long term I expect that properties will get separate locks to protect their values, and restrict mode_config.mutex to just mode probing. Which meansdrm_connnector_set_link_statuswill use a different lock anyway.
- it nicely encapsulates stuff imo.Kerneldoc for
drm_connector_set_link_statusshould mention that this needs to be run from some async work item, and ofc have the full explanation (maybe even quote some pseudo-code, see e.g.drm_modeset_lock.ccomments) of how this should be used.Since this is late-stage polish definitely wait for more feedback and for the design to fully settle first.
-Daniel
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure
Quoted 43 lines · Jani Nikula
Quoted 33 lines · Daniel Vetter
Quoted 32 lines · Manasi Navare
drivers/gpu/drm/i915/intel_dp.c +28
-0@@ -5692,6 +5751,39 @@ 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. +*/ +intel_dp_set_link_status_property (connector, +DRM_MODE_LINK_STATUS_BAD ); +mutex_unlock (&connector->dev->mode_config.mutex);Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5784
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ +/* Send Hotplug uevent so userspace can reprobe */ +drm_kms_helper_hotplug_event (connector->dev);One downside of keeping all the signalling logic here in i915 is that we don't have a good spot to put the kerneldoc for this new link status property within
drm_connector.cfor others to easily spot. My suggestion would be to extract function with the following rough pseudo-code:
Quoted 7 lines
Thanks for this. I wanted Manasi to keep the work struct and function within i915, but I fell short of coming up with this division.
BR,
Jani.
Jani, so we ar elooking at two functions going in core,
1. that does mode validation and pruning
2. set link status property
These should be in a separate patch right after declaring the drm connector property, what do you think?
Regards
Manasi
Quoted 25 lines
Quoted 25 lines
drm_connector_set_link_status(connector, status){ mutex_lock(mode_config.mutex); /* what intel_dp_set_link_status_property() does */ mutex_unlock(mode_config.mutex); drm_kms_helper_hotplug_event() }Within
intel_dp_modeset_retry_work_fnwe'd then first need to drop the lock, and then call this function. The lock drop&reacquire is a bit ugly, but:
- it doesn't matter from a performance pov, this is a slow, asynchronous work.
- it doesn't matter for correctnes, the only thing we need is to drop the lock before callingdrm_kms_helper_hotplug_event, and that we update the link status and the mode list before that too.
- long term I expect that properties will get separate locks to protect their values, and restrict mode_config.mutex to just mode probing. Which meansdrm_connnector_set_link_statuswill use a different lock anyway.
- it nicely encapsulates stuff imo.
Quoted 15 lines
Quoted 8 lines
Kerneldoc for
drm_connector_set_link_statusshould mention that this needs to be run from some async work item, and ofc have the full explanation (maybe even quote some pseudo-code, see e.g.drm_modeset_lock.ccomments) of how this should be used.Since this is late-stage polish definitely wait for more feedback and for the design to fully settle first.
-DanielSignature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure
In reply to Daniel VetterQuoted 52 lines · Daniel Vetter
Quoted 25 lines · Manasi Navare
drivers/gpu/drm/i915/intel_dp.c +21
-0@@ -5692,6 +5751,39 @@ 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);drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5784
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+ +/* Set connector link status to BAD and send a Uevent to notify +* userspace to do a modeset. +*/ +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);One downside of keeping all the signalling logic here in i915 is that we don't have a good spot to put the kerneldoc for this new link status property within
drm_connector.cfor others to easily spot. My suggestion would be to extract function with the following rough pseudo-code:
drm_connector_set_link_status(connector, status){ mutex_lock(mode_config.mutex); /* what intel_dp_set_link_status_property() does */ mutex_unlock(mode_config.mutex); drm_kms_helper_hotplug_event() }
Quoted 3 lines
Within
intel_dp_modeset_retry_work_fnwe'd then first need to drop the lock, and then call this function. The lock drop&reacquire is a bit ugly, but:
The mode re-validation should be done in the core as well. Not sure if we could just stuff it all into one place, and then there would be no need for any lock dropping.
Quoted 26 lines
- it doesn't matter from a performance pov, this is a slow, asynchronous work.
- it doesn't matter for correctnes, the only thing we need is to drop the lock before callingdrm_kms_helper_hotplug_event, and that we update the link status and the mode list before that too.
- long term I expect that properties will get separate locks to protect their values, and restrict mode_config.mutex to just mode probing. Which meansdrm_connnector_set_link_statuswill use a different lock anyway.
- it nicely encapsulates stuff imo.Kerneldoc for
drm_connector_set_link_statusshould mention that this needs to be run from some async work item, and ofc have the full explanation (maybe even quote some pseudo-code, see e.g.drm_modeset_lock.ccomments) of how this should be used.Since this is late-stage polish definitely wait for more feedback and for the design to fully settle first.
-DanielSignature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure
Quoted 53 lines · Ville Syrjälä
Quoted 52 lines · Daniel Vetter
Quoted 25 lines · Manasi Navare
drivers/gpu/drm/i915/intel_dp.c +21
-0@@ -5692,6 +5751,39 @@ 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);drivers/gpu/drm/i915/intel_dp.c static bool intel_edp_init_connector(struct intel_dp *intel_dp, · line 5784
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+ +/* Set connector link status to BAD and send a Uevent to notify +* userspace to do a modeset. +*/ +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);One downside of keeping all the signalling logic here in i915 is that we don't have a good spot to put the kerneldoc for this new link status property within
drm_connector.cfor others to easily spot. My suggestion would be to extract function with the following rough pseudo-code:
drm_connector_set_link_status(connector, status){ mutex_lock(mode_config.mutex); /* what intel_dp_set_link_status_property() does */ mutex_unlock(mode_config.mutex); drm_kms_helper_hotplug_event() }
Quoted 8 lines
Quoted 3 lines
Within
intel_dp_modeset_retry_work_fnwe'd then first need to drop the lock, and then call this function. The lock drop&reacquire is a bit ugly, but:The mode re-validation should be done in the core as well. Not sure if we could just stuff it all into one place, and then there would be no need for any lock dropping.
I can move the moderevalidation to the core as well, but then the function name has to be something else than just drm_set_link_status_property(),cant think of a name that combines mode revalidation and setting link sttaus property, any suggestions?
Manasi
Quoted 15 lines
Quoted 15 lines
- it doesn't matter from a performance pov, this is a slow, asynchronous work.
- it doesn't matter for correctnes, the only thing we need is to drop the lock before callingdrm_kms_helper_hotplug_event, and that we update the link status and the mode list before that too.
- long term I expect that properties will get separate locks to protect their values, and restrict mode_config.mutex to just mode probing. Which meansdrm_connnector_set_link_statuswill use a different lock anyway.
- it nicely encapsulates stuff imo.Kerneldoc for
drm_connector_set_link_statusshould mention that this needs to be run from some async work item, and ofc have the full explanation (maybe even quote some pseudo-code, see e.g.drm_modeset_lock.ccomments) of how this should be used.
Quoted 15 lines
Quoted 11 lines
Since this is late-stage polish definitely wait for more feedback and for the design to fully settle first.
-DanielSignature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for Handle Link Training Failure during modeset
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: Handle Link Training Failure during modeset
URL : https://patchwork.freedesktop.org/series/15080/
State : failure
== Summary ==
Series 15080v1 Handle Link Training Failure during modeset
https://patchwork.freedesktop.org/api/1.0/series/15080/revisions/1/mbox/
Test drv_module_reload_basic:
dmesg-warn -> INCOMPLETE (fi-skl-6700k)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
fail -> PASS (fi-ivb-3520m)
Subgroup suspend-read-crc-pipe-b:
fail -> PASS (fi-ivb-3520m)
Subgroup suspend-read-crc-pipe-c:
fail -> PASS (fi-ivb-3520m)fi-bdw-5557u total:244 pass:229 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:244 pass:204 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:244 pass:191 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7200u total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:244 pass:223 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:6 pass:5 dwarn:0 dfail:0 fail:0 skip:0 fi-snb-2520m total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:244 pass:211 dwarn:0 dfail:0 fail:0 skip:33
1afd351596b6deaead14d5812f0d6850379e30ad drm-intel-nightly: 2016y-11m-09d-21h-03m-31s UTC integration manifest 13ab659 drm/i915: Implement Link Rate fallback on Link training failure
2793b26 drm/i915: Find fallback link rate/lane count37a0b049 drm/i915: Update CRTC state if connector link status property changed
81cc918 drm/i915: Set link status property for DP connector
5837520 drm: Add a new connector property for link status
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_2949/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values.
This is repeated until the link is successfully trained.This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of *why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.
Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the mode would work. The promise is based on the theoretical capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.
One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that a) changes the current happy day scenario as little as possible, to avoid regressions, b) can be implemented the same way by all drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.
The solution is to add a "link status" connector property. In the usual happy day scenario, this is always "good". If something fails during or after a mode set, the kernel driver can set the link status to "bad", prune the mode list based on new information as necessary, and send a hotplug uevent for userspace to have it re-check the valid modes through getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.
If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.
Quoted 5 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property changed
^^^^^^^^
This is really drm, not i915.
Quoted 13 lines
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 | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138 +++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Adding Harry and Tony from our display team to review.
Quoted 119 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values.
This is repeated until the link is successfully trained.This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of *why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.
Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the mode would work. The promise is based on the theoretical capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.
One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that a) changes the current happy day scenario as little as possible, to avoid regressions, b) can be implemented the same way by all drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.
The solution is to add a "link status" connector property. In the usual happy day scenario, this is always "good". If something fails during or after a mode set, the kernel driver can set the link status to "bad", prune the mode list based on new information as necessary, and send a hotplug uevent for userspace to have it re-check the valid modes through getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.
If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 5 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property changed^^^^^^^^This is really drm, not i915.
Quoted 7 lines
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 | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)
Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modeset
Adding Harry and Tony from our display team to review.
Quoted 121 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the mode would work. The promise is based on the theoretical capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.
One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that a) changes the current happy day scenario as little as possible, to avoid regressions, b) can be implemented the same way by all drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.
The solution is to add a "link status" connector property. In the usual happy day scenario, this is always "good". If something fails during or after a mode set, the kernel driver can set the link status to "bad", prune the mode list based on new information as necessary, and send a hotplug uevent for userspace to have it re-check the valid modes through getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.
If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property
changed^^^^^^^^This is really drm, not i915.
Quoted 7 lines
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 | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)
Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 139 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 121 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the mode would work. The promise is based on the theoretical capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.
One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that a) changes the current happy day scenario as little as possible, to avoid regressions, b) can be implemented the same way by all drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.
The solution is to add a "link status" connector property. In the usual happy day scenario, this is always "good". If something fails during or after a mode set, the kernel driver can set the link status to "bad", prune the mode list based on new information as necessary, and send a hotplug uevent for userspace to have it re-check the valid modes through getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.
If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property
changed^^^^^^^^This is really drm, not i915.
Quoted 7 lines
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 | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modeset
Quoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 138 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 121 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the mode would work. The promise is based on the theoretical capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.
One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that
a) changes the current happy day scenario as little as possible, to avoid regressions, b) can be implemented the same way by all drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property. In the
usual happy day scenario, this is always "good". If something fails
during or after a mode set, the kernel driver can set the link
status to "bad", prune the mode list based on new information as
necessary, and send a hotplug uevent for userspace to have it
re-check the valid modes through getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property
changed^^^^^^^^This is really drm, not i915.
Quoted 7 lines
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 | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)
Quoted 6 lines
Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Tony
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
The link should get retrained as the driver should check the link state on HPD and retrain if it's not good. At least that's what we do in i915. Of course if it's not the same display that got plugged back, the retraining might fail. The new property can help with that case as userspace would then attempt a full modeset after the failed link training.
Quoted 4 lines
Quoted 2 lines
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
If the user visible state doesn't change in any way, then the kernel could try to manage it all internally.
Quoted 165 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 138 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 121 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the mode would work. The promise is based on the theoretical capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.
One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that
a) changes the current happy day scenario as little as possible, to avoid regressions, b) can be implemented the same way by all drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property. In the
usual happy day scenario, this is always "good". If something fails
during or after a mode set, the kernel driver can set the link
status to "bad", prune the mode list based on new information as
necessary, and send a hotplug uevent for userspace to have it
re-check the valid modes through getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property
changed^^^^^^^^This is really drm, not i915.
Quoted 7 lines
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 | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)Quoted 6 lines
Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel OTC
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
In case of link training failure and requiring user space to set a lower mode, would full mode set address it? How do we make user mode select lower resolution?
For example 4k@60Hz monitor, and link training at 4 lane HBR2 fails and fallback to 4 lanes HBR, 4k@60 is no longer doable. I would think preventing user mode from seeing 4K@60Hz from the start is a easier and more robust solution and requiring user mode to have logic to decide how to fallback.
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 11:44 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modeset
Quoted 3 lines · Tony
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
The link should get retrained as the driver should check the link state on HPD and retrain if it's not good. At least that's what we do in i915. Of course if it's not the same display that got plugged back, the retraining might fail. The new property can help with that case as userspace would then attempt a full modeset after the failed link training.
Quoted 4 lines
Quoted 2 lines
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
If the user visible state doesn't change in any way, then the kernel could try to manage it all internally.
Quoted 163 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 141 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 124 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the
mode would work. The promise is based on the theoretical
capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced,
but we can't reduce the link below the requirements of the mode. Black screen follows.One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that
a) changes the current happy day scenario as little as possible,
to avoid regressions, b) can be implemented the same way by all
drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property. In the
usual happy day scenario, this is always "good". If something
fails during or after a mode set, the kernel driver can set the
link status to "bad", prune the mode list based on new information
as necessary, and send a hotplug uevent for userspace to have it
re-check the valid modes through getconnector, and try again. If
the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property
changed^^^^^^^^This is really drm, not i915.
Quoted 8 lines
drm/i915: Find fallback link rate/lane count drm/i915: Implement Link Rate fallback on Link training
failuredrivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)--
Jani Nikula, Intel Open Source Technology Center
Quoted 8 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel OTC
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines · Tony
In case of link training failure and requiring user space to set a lower mode, would full mode set address it? How do we make user mode select lower resolution?
For example 4k@60Hz monitor, and link training at 4 lane HBR2 fails and fallback to 4 lanes HBR, 4k@60 is no longer doable. I would think preventing user mode from seeing 4K@60Hz from the start is a easier and more robust solution and requiring user mode to have logic to decide how to fallback.
Hi Tony,
So in case of link training failure, we first call mode_valid that will use the lower link rate/lane count values based on the link training fallback to validate the modes and prune the modes that are higher than the available link. After this is done, then we send the uevent to userspace indicating that link status is BAD and it will redo a probe and trigger a modeset for next possible lower resolution.
Manasi
Quoted 189 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 11:44 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
The link should get retrained as the driver should check the link state on HPD and retrain if it's not good. At least that's what we do in i915. Of course if it's not the same display that got plugged back, the retraining might fail. The new property can help with that case as userspace would then attempt a full modeset after the failed link training.
Quoted 4 lines
Quoted 2 lines
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
If the user visible state doesn't change in any way, then the kernel could try to manage it all internally.
Quoted 168 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 145 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 122 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the
mode would work. The promise is based on the theoretical
capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced,
but we can't reduce the link below the requirements of the mode. Black screen follows.One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that
a) changes the current happy day scenario as little as possible,
to avoid regressions, b) can be implemented the same way by all
drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property. In the
usual happy day scenario, this is always "good". If something
fails during or after a mode set, the kernel driver can set the
link status to "bad", prune the mode list based on new information
as necessary, and send a hotplug uevent for userspace to have it
re-check the valid modes through getconnector, and try again. If
the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property
changed^^^^^^^^This is really drm, not i915.
Quoted 8 lines
drm/i915: Find fallback link rate/lane count drm/i915: Implement Link Rate fallback on Link training
failuredrivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines
Quoted 3 lines
--
Ville Syrjälä
Intel OTC--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Manasi Navare
Quoted 4 lines · Tony
In case of link training failure and requiring user space to set a lower mode, would full mode set address it? How do we make user mode select lower resolution?
For example 4k@60Hz monitor, and link training at 4 lane HBR2 fails and fallback to 4 lanes HBR, 4k@60 is no longer doable. I would think preventing user mode from seeing 4K@60Hz from the start is a easier and more robust solution and requiring user mode to have logic to decide how to fallback.
Quoted 6 lines
Hi Tony,
So in case of link training failure, we first call
mode_validthat will use the lower link rate/lane count values based on the link training fallback to validate the modes and prune the modes that are higher than the available link. After this is done, then we send the uevent to userspace indicating that link status is BAD and it will redo a probe and trigger a modeset for next possible lower resolution.
Just in case it's not clear: This entire discussion here is only about the userspace-visible abi changes. And I think for the worst-case we need something like this (and Harry at least said on irc that on other os you do something similar already). It of course does not preclude at all that you do additional link-training/probe on initial hotplug. That part is entirely up to drivers (and we might get there on some platforms, but on others it's a real pain to get a link up&running unfortunately for training, since we need to steal a crtc and do a full modeset). -Daniel
Quoted 204 lines
Manasi
Quoted 189 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 11:44 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
The link should get retrained as the driver should check the link state on HPD and retrain if it's not good. At least that's what we do in i915. Of course if it's not the same display that got plugged back, the retraining might fail. The new property can help with that case as userspace would then attempt a full modeset after the failed link training.
Quoted 4 lines
Quoted 2 lines
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
If the user visible state doesn't change in any way, then the kernel could try to manage it all internally.
Quoted 168 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 145 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 122 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.
This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the
mode would work. The promise is based on the theoretical
capabilities of the link, but it's possible we can't reach this in practice. The DP spec describes how the link should be reduced,
but we can't reduce the link below the requirements of the mode. Black screen follows.One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time, before pruning the mode list, so that we can do the pruning based on practical not theoretical capabilities. However, the changes for link training are pretty drastic, all for the sake of error handling and DP compliance, when the most common happy day scenario is the current approach of link training at mode setting time, using the optimal parameters for the mode. It is also not certain all hardware could do this without the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.
Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way that
a) changes the current happy day scenario as little as possible,
to avoid regressions, b) can be implemented the same way by all
drm drivers, c) is still opt-in for the drivers and userspace, and opting out doesn't regress the user experience, d) doesn't prevent drivers from implementing better or alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property. In the
usual happy day scenario, this is always "good". If something
fails during or after a mode set, the kernel driver can set the
link status to "bad", prune the mode list based on new information
as necessary, and send a hotplug uevent for userspace to have it
re-check the valid modes through getconnector, and try again. If
the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user experience is the same as it currently is. If the userspace is aware of the property, it has a chance to improve user experience. If a drm driver does not modify the property (it stays "good"), the user experience is the same as it currently is. A drm driver can also choose to try to handle more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.
The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is great, and could be made to work similarly for all drm drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.
BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property
changed^^^^^^^^This is really drm, not i915.
Quoted 8 lines
drm/i915: Find fallback link rate/lane count drm/i915: Implement Link Rate fallback on Link training
failuredrivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfxQuoted 7 lines
Quoted 3 lines
--
Ville Syrjälä
Intel OTC--
Ville Syrjälä
Intel OTC_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
I see. As long as amd can still just have kernel hiding unsupported mode by doing a pre-train I am okay with the proposal. Just to caution you the link training fallback we implemented on windows in old dal architecture is very painful to get right. Windows 7, 8.1 and 10 all behave differently. Not all apps handles mode change failure gracefully and worse case we get stuck in infinite mode set. This is why for future generations asic on windows we are also going to just hide unsupported mode by doing pre-train.
-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Monday, November 14, 2016 3:04 AM
To: Manasi Navare <[email protected]>
Cc: Cheng, Tony <[email protected]>; [email protected]; Peres, Martin <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modeset
Quoted 6 lines · Manasi Navare
Quoted 4 lines · Tony
In case of link training failure and requiring user space to set a lower mode, would full mode set address it? How do we make user mode select lower resolution?
For example 4k@60Hz monitor, and link training at 4 lane HBR2 fails and fallback to 4 lanes HBR, 4k@60 is no longer doable. I would think preventing user mode from seeing 4K@60Hz from the start is a easier and more robust solution and requiring user mode to have logic to decide how to fallback.
Quoted 6 lines
Hi Tony,
So in case of link training failure, we first call
mode_validthat
will use the lower link rate/lane count values based on the link
training fallback to validate the modes and prune the modes that are
higher than the available link. After this is done, then we send the uevent to userspace indicating that link status is BAD and it will redo a probe and trigger a modeset for next possible lower resolution.
Just in case it's not clear: This entire discussion here is only about the userspace-visible abi changes. And I think for the worst-case we need something like this (and Harry at least said on irc that on other os you do something similar already). It of course does not preclude at all that you do additional link-training/probe on initial hotplug. That part is entirely up to drivers (and we might get there on some platforms, but on others it's a real pain to get a link up&running unfortunately for training, since we need to steal a crtc and do a full modeset). -Daniel
Quoted 203 lines
Manasi
Quoted 199 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 11:44 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
The link should get retrained as the driver should check the link state on HPD and retrain if it's not good. At least that's what we do in i915. Of course if it's not the same display that got plugged back, the retraining might fail. The new property can help with that case as userspace would then attempt a full modeset after the failed link training.
Quoted 4 lines
Quoted 2 lines
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
If the user visible state doesn't change in any way, then the kernel could try to manage it all internally.
Quoted 172 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 140 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 123 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate
first until it reaches the minimum and keeping the lane
count maximum and then lowering the lane count until it
reaches minimim. These fallback values are saved and hotplug
uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if
link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the
mode would work. The promise is based on the theoretical
capabilities of the link, but it's possible we can't reach
this in practice. The DP spec describes how the link should be
reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time,
before pruning the mode list, so that we can do the pruning
based on practical not theoretical capabilities. However, the
changes for link training are pretty drastic, all for the sake
of error handling and DP compliance, when the most common
happy day scenario is the current approach of link training at
mode setting time, using the optimal parameters for the mode.
It is also not certain all hardware could do this without the
pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way
that
a) changes the current happy day scenario as little as
possible, to avoid regressions, b) can be implemented the same
way by all drm drivers, c) is still opt-in for the drivers and
userspace, and opting out doesn't regress the user experience,
d) doesn't prevent drivers from implementing better or
alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property. In
the usual happy day scenario, this is always "good". If
something fails during or after a mode set, the kernel driver
can set the link status to "bad", prune the mode list based on
new information as necessary, and send a hotplug uevent for
userspace to have it re-check the valid modes through
getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user
experience is the same as it currently is. If the userspace is
aware of the property, it has a chance to improve user
experience. If a drm driver does not modify the property (it
stays "good"), the user experience is the same as it currently
is. A drm driver can also choose to try to handle more of the
failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is
great, and could be made to work similarly for all drm
drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status
property changed^^^^^^^^This is really drm, not i915.
Quoted 8 lines
drm/i915: Find fallback link rate/lane count drm/i915: Implement Link Rate fallback on Link training
failuredrivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)Quoted 6 lines
Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel OTC
Quoted 7 lines
Quoted 3 lines
--
Ville Syrjälä
Intel OTC_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Yes driver can chose to have the pre train for kernel hiding unsupported mode, that is completely still possible for the amd driver and it would never use the link_status connector property and no interaction with userspace. Could you please give your ACKs for the patches if you are okay with this porposal?
Regards
Manasi
Quoted 237 lines · Tony
I see. As long as amd can still just have kernel hiding unsupported mode by doing a pre-train I am okay with the proposal. Just to caution you the link training fallback we implemented on windows in old dal architecture is very painful to get right. Windows 7, 8.1 and 10 all behave differently. Not all apps handles mode change failure gracefully and worse case we get stuck in infinite mode set. This is why for future generations asic on windows we are also going to just hide unsupported mode by doing pre-train.
-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Monday, November 14, 2016 3:04 AM
To: Manasi Navare <[email protected]>
Cc: Cheng, Tony <[email protected]>; [email protected]; Peres, Martin <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 6 lines · Manasi Navare
Quoted 4 lines · Tony
In case of link training failure and requiring user space to set a lower mode, would full mode set address it? How do we make user mode select lower resolution?
For example 4k@60Hz monitor, and link training at 4 lane HBR2 fails and fallback to 4 lanes HBR, 4k@60 is no longer doable. I would think preventing user mode from seeing 4K@60Hz from the start is a easier and more robust solution and requiring user mode to have logic to decide how to fallback.
Quoted 6 lines
Hi Tony,
So in case of link training failure, we first call
mode_validthat
will use the lower link rate/lane count values based on the link
training fallback to validate the modes and prune the modes that are
higher than the available link. After this is done, then we send the uevent to userspace indicating that link status is BAD and it will redo a probe and trigger a modeset for next possible lower resolution.Just in case it's not clear: This entire discussion here is only about the userspace-visible abi changes. And I think for the worst-case we need something like this (and Harry at least said on irc that on other os you do something similar already). It of course does not preclude at all that you do additional link-training/probe on initial hotplug. That part is entirely up to drivers (and we might get there on some platforms, but on others it's a real pain to get a link up&running unfortunately for training, since we need to steal a crtc and do a full modeset). -Daniel
Quoted 203 lines
Manasi
Quoted 199 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 11:44 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
The link should get retrained as the driver should check the link state on HPD and retrain if it's not good. At least that's what we do in i915. Of course if it's not the same display that got plugged back, the retraining might fail. The new property can help with that case as userspace would then attempt a full modeset after the failed link training.
Quoted 4 lines
Quoted 2 lines
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
If the user visible state doesn't change in any way, then the kernel could try to manage it all internally.
Quoted 172 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 140 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 123 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate
first until it reaches the minimum and keeping the lane
count maximum and then lowering the lane count until it
reaches minimim. These fallback values are saved and hotplug
uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if
link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised the
mode would work. The promise is based on the theoretical
capabilities of the link, but it's possible we can't reach
this in practice. The DP spec describes how the link should be
reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as the atomic checks have passed [citation needed]. It would also conflict with the idea of making setcrtc asynchronous in the future, returning before the actual mode setting and link training.
Another idea is to train the link "upfront" at hotplug time,
before pruning the mode list, so that we can do the pruning
based on practical not theoretical capabilities. However, the
changes for link training are pretty drastic, all for the sake
of error handling and DP compliance, when the most common
happy day scenario is the current approach of link training at
mode setting time, using the optimal parameters for the mode.
It is also not certain all hardware could do this without the
pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.Both of the above ideas also fail to address link degradation *during* operation.
So the idea presented in these patches is to do this in a way
that
a) changes the current happy day scenario as little as
possible, to avoid regressions, b) can be implemented the same
way by all drm drivers, c) is still opt-in for the drivers and
userspace, and opting out doesn't regress the user experience,
d) doesn't prevent drivers from implementing better or
alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property. In
the usual happy day scenario, this is always "good". If
something fails during or after a mode set, the kernel driver
can set the link status to "bad", prune the mode list based on
new information as necessary, and send a hotplug uevent for
userspace to have it re-check the valid modes through
getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user
experience is the same as it currently is. If the userspace is
aware of the property, it has a chance to improve user
experience. If a drm driver does not modify the property (it
stays "good"), the user experience is the same as it currently
is. A drm driver can also choose to try to handle more of the
failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is
great, and could be made to work similarly for all drm
drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status
property changed^^^^^^^^This is really drm, not i915.
Quoted 8 lines
drm/i915: Find fallback link rate/lane count drm/i915: Implement Link Rate fallback on Link training
failuredrivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)Quoted 6 lines
Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel OTCQuoted 7 lines
Quoted 3 lines
--
Ville Syrjälä
Intel OTC_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Cheng, Tony
Acked-by-----Original Message-----
From: Manasi Navare [mailto:[email protected]]
Sent: Monday, November 14, 2016 12:52 PM
To: Cheng, Tony <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; Peres, Martin <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modeset
Yes driver can chose to have the pre train for kernel hiding unsupported mode, that is completely still possible for the amd driver and it would never use the link_status connector property and no interaction with userspace. Could you please give your ACKs for the patches if you are okay with this porposal?
Regards
Manasi
Quoted 244 lines · Tony
I see. As long as amd can still just have kernel hiding unsupported mode by doing a pre-train I am okay with the proposal. Just to caution you the link training fallback we implemented on windows in old dal architecture is very painful to get right. Windows 7, 8.1 and 10 all behave differently. Not all apps handles mode change failure gracefully and worse case we get stuck in infinite mode set. This is why for future generations asic on windows we are also going to just hide unsupported mode by doing pre-train.
-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Monday, November 14, 2016 3:04 AM
To: Manasi Navare <[email protected]>
Cc: Cheng, Tony <[email protected]>; [email protected]; Peres, Martin <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 6 lines · Manasi Navare
Quoted 4 lines · Tony
In case of link training failure and requiring user space to set a lower mode, would full mode set address it? How do we make user mode select lower resolution?
For example 4k@60Hz monitor, and link training at 4 lane HBR2 fails and fallback to 4 lanes HBR, 4k@60 is no longer doable. I would think preventing user mode from seeing 4K@60Hz from the start is a easier and more robust solution and requiring user mode to have logic to decide how to fallback.
Quoted 6 lines
Hi Tony,
So in case of link training failure, we first call
mode_validthat
will use the lower link rate/lane count values based on the link
training fallback to validate the modes and prune the modes that are
higher than the available link. After this is done, then we send the uevent to userspace indicating that link status is BAD and it will redo a probe and trigger a modeset for next possible lower resolution.Just in case it's not clear: This entire discussion here is only about the userspace-visible abi changes. And I think for the worst-case we need something like this (and Harry at least said on irc that on other os you do something similar already). It of course does not preclude at all that you do additional link-training/probe on initial hotplug. That part is entirely up to drivers (and we might get there on some platforms, but on others it's a real pain to get a link up&running unfortunately for training, since we need to steal a crtc and do a full modeset). -Daniel
Quoted 205 lines
Manasi
Quoted 201 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 11:44 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
For HDMI, you can yank the cable, plug back in, HDMI will light up without user mode or kernel mode doing anything.
For DP this is not possible, someone will have to retrain the link when plugging back in or DP will not light up. We see that on Ubuntu if someone unplug display and plug it back into same connector, we do not get KMS so in this case. It appears there is some optimizations somewhere in user mode stack which I am not familiar with yet. dal added workaround to retrain the link to light it back up (after the test training at end of detection).
The link should get retrained as the driver should check the link state on HPD and retrain if it's not good. At least that's what we do in i915. Of course if it's not the same display that got plugged back, the retraining might fail. The new property can help with that case as userspace would then attempt a full modeset after the failed link training.
Quoted 4 lines
Quoted 2 lines
From user mode perspective I think it make sense to keep CRTC running, so vblank is still going so UMD isn't impacted. As regard to connector and encoder does it matter if kernel mode change state without user mode knowing? It seems to me those are more informational to UMD as UMD doesn't act on them.
windows does not know link state and all link management is hidden behind kernel driver.
If the user visible state doesn't change in any way, then the kernel could try to manage it all internally.
Quoted 174 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, November 11, 2016 9:05 AM
To: Cheng, Tony <[email protected]>
Cc: Deucher, Alexander <[email protected]>; 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Peres, Martin <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 3 lines · Tony
Amdgpu dal implementation will do a test link training at end of detection to verify we can achieve the capability reported in DPCD. We then report mode base on result of test training.
AMD hardware (at least the generations supported by amdgpu) is able to link train without timing being setup (DP encoder and CRTC is decoupled). Do we have limitation from other vendors where you need timing to be there before you can link train?
I can't recall the specifics for all of our supported platforms, but at least I have the recollection that it would be the case yes.
The other problem wiyh this apporach is that even if you don't need the crtc, you still need the link itself. What happens if the link is still active since userspace just didn't bother to shut it down when the cable was yanked? Can you keep the crtc going but stop it from feeding the link in a way that userspace won't be able to notice? The kms design has always been pretty much that policy is in userspace, and thus the kernel shouldn't shut down crtcs unless explicitly asked to do so.
Quoted 142 lines
We can also past DP1.2 link layer compliance with this approach.
-----Original Message-----
From: Deucher, Alexander
Sent: Thursday, November 10, 2016 1:43 PM
To: 'Jani Nikula' <[email protected]>; Manasi Navare <[email protected]>; [email protected]; [email protected]; Wentland, Harry <[email protected]>; Cheng, Tony <[email protected]>
Cc: Dave Airlie <[email protected]>; Peres, Martin <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetAdding Harry and Tony from our display team to review.
Quoted 125 lines
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, November 10, 2016 1:20 PM
To: Manasi Navare; [email protected]; intel- [email protected]
Cc: Dave Airlie; Peres, Martin; Deucher, Alexander
Subject: Re: [Intel-gfx] [PATCH 0/5] Handle Link Training Failure during modesetQuoted 10 lines · Manasi Navare
Link training failure is handled by lowering the link rate
first until it reaches the minimum and keeping the lane
count maximum and then lowering the lane count until it
reaches minimim. These fallback values are saved and
hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and
if link status property is BAD. This will retrain the link at fallback values. This is repeated until the link is successfully trained.This has been validated to pass DP compliance.
This cover letter and the commit messages do a good job of explaining what the patches do. However, you're lacking the crucial information of
*why* we need userspace cooperation to handle link training failures on DP mode setting, and *why* a new connector property is a good solution for this.Here goes, including some alternative approaches we've considered (and even tried):
At the time userspace does setcrtc, we've already promised
the mode would work. The promise is based on the theoretical
capabilities of the link, but it's possible we can't reach
this in practice. The DP spec describes how the link should
be reduced, but we can't reduce the link below the requirements of the mode. Black screen follows.One idea would be to have setcrtc return a failure. However, it is my understanding that it already should not fail as
the atomic checks have passed [citation needed]. It would
also conflict with the idea of making setcrtc asynchronous
in the future, returning before the actual mode setting and link training.Another idea is to train the link "upfront" at hotplug time,
before pruning the mode list, so that we can do the pruning
based on practical not theoretical capabilities. However,
the changes for link training are pretty drastic, all for
the sake of error handling and DP compliance, when the most
common happy day scenario is the current approach of link
training at mode setting time, using the optimal parameters for the mode.
It is also not certain all hardware could do this without
the pipe on; not even all our hardware can do this. Some of this can be solved, but not trivially.Both of the above ideas also fail to address link degradation
*during* operation.So the idea presented in these patches is to do this in a
way that
a) changes the current happy day scenario as little as
possible, to avoid regressions, b) can be implemented the
same way by all drm drivers, c) is still opt-in for the
drivers and userspace, and opting out doesn't regress the
user experience,
d) doesn't prevent drivers from implementing better or
alternate approaches, possibly without userspace involvement. And, of course, handles all the issues presented.The solution is to add a "link status" connector property.
In the usual happy day scenario, this is always "good". If
something fails during or after a mode set, the kernel
driver can set the link status to "bad", prune the mode list
based on new information as necessary, and send a hotplug
uevent for userspace to have it re-check the valid modes
through getconnector, and try again. If the theoretical capabilities of the link can't be reached, the mode list is trimmed based on that.If the userspace is not aware of the property, the user
experience is the same as it currently is. If the userspace
is aware of the property, it has a chance to improve user
experience. If a drm driver does not modify the property (it
stays "good"), the user experience is the same as it
currently is. A drm driver can also choose to try to handle
more of the failures in kernel, hardware not limiting, or it can choose to involve userspace more. Up to the drivers.The reason for adding the property is to handle link training failures, but it is not limited to DP or link training. For example, if we implement asynchronous setcrtc, we can use this to report any failures in that.
Finally, while DP CTS compliance is advertized (which is
great, and could be made to work similarly for all drm
drivers), this can be used for the more important goal of improving user experience on link training failures, by avoiding black screens.BR,
Jani.Quoted 6 lines
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status
property changed^^^^^^^^This is really drm, not i915.
Quoted 8 lines
drm/i915: Find fallback link rate/lane count drm/i915: Implement Link Rate fallback on Link training
failuredrivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138+++++++++++++++++++++++++-
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)Quoted 6 lines
Quoted 2 lines
--
Jani Nikula, Intel Open Source Technology Center_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel OTCQuoted 7 lines
Quoted 3 lines
--
Ville Syrjälä
Intel OTC_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Overall this patch set makes sense but I think it would be good to move some stuff to common code instead of leaving it in i915. I'm thinking about patch 2 (setting the link status property) in particular but also tend to agree with Ville and Daniel about their comments for patch 5.
That said, should another driver need it it shouldn't be hard to pull that out.
Patch 1: Reviewed-by: Harry Wentland <[email protected]>
Patch 2-5: Acked-by: Harry Wentland <[email protected]>
Harry
Quoted 18 lines · Manasi Navare
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values.
This is repeated until the link is successfully trained.This has been validated to pass DP compliance.
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property changed drm/i915: Find fallback link rate/lane count
drm/i915: Implement Link Rate fallback on Link training failure
Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138 +++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Harry Wentland
Overall this patch set makes sense but I think it would be good to move some stuff to common code instead of leaving it in i915. I'm thinking about patch 2 (setting the link status property) in particular but also tend to agree with Ville and Daniel about their comments for patch 5.
Quoted 10 lines
That said, should another driver need it it shouldn't be hard to pull that out.
Patch 1: Reviewed-by: Harry Wentland <[email protected]>
Patch 2-5: Acked-by: Harry Wentland <[email protected]>
Harry
Thanks for the review.
I am already moving Patch 2 set_link_status to the drm core as per Daniel and Ville's suggestion. I will make those changes and submit the new patches by EOD today.
Regards
Manasi
Quoted 19 lines · Manasi Navare
Quoted 18 lines
Link training failure is handled by lowering the link rate first until it reaches the minimum and keeping the lane count maximum and then lowering the lane count until it reaches minimim. These fallback values are saved and hotplug uevent is sent to the userspace after setting the connector link status property to BAD. Userspace should triiger another modeset on a uevent and if link status property is BAD. This will retrain the link at fallback values.
This is repeated until the link is successfully trained.This has been validated to pass DP compliance.
Manasi Navare (5):
drm: Add a new connector property for link status drm/i915: Set link status property for DP connector drm/i915: Update CRTC state if connector link status property changed drm/i915: Find fallback link rate/lane count
drm/i915: Implement Link Rate fallback on Link training failure
Quoted 12 lines
Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c | 7 ++ drivers/gpu/drm/drm_connector.c | 17 ++++ drivers/gpu/drm/i915/intel_ddi.c | 21 +++- drivers/gpu/drm/i915/intel_dp.c | 138 +++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++- include/drm/drm_connector.h | 7 +- include/drm/drm_crtc.h | 5 + include/uapi/drm/drm_mode.h | 4 + 9 files changed, 214 insertions(+), 9 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel