In the usual working scenarios, this property is "Good". If something fails during modeset, the DRM driver can set the link status to "Bad", prune the mode list based on the link rate/lane count fallback values and send hotplug uevent so that userspace that is aware of this property can take an appropriate action by reprobing connectors and re triggering a modeset to improve user experience and avoid black screens. In case of userspace that is not aware of this link status property, the user experience will be unchanged. 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. v2: * Update kernel doc, add lockdep_assert_held (Daniel Vetter) Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx> Cc: Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> Signed-off-by: Manasi Navare <manasi.d.navare@xxxxxxxxx> --- drivers/gpu/drm/drm_connector.c | 36 ++++++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index d4e852f..b942d67 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -968,6 +968,42 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, } EXPORT_SYMBOL(drm_mode_connector_update_edid_property); +/** + * drm_mode_connector_set_link_status_property - Set link status property of a connector + * @connector: drm connector + * @link_status: new value of link status property (0: Good, 1: Bad) + * + * In usual working scenario, this link status property will always be set to + * "GOOD". If something fails during or after a mode set, the kernel driver should + * prune the mode list based on new information, set this link status property to + * "BAD". The caller then needs to send a hotplug uevent for userspace to re-check + * the valid modes through GET_CONNECTOR_IOCTL and retry modeset. + * + * Note that a lot of existing userspace do not handle this property. + * If userspace is not aware of this 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 by handling link training failures, avoiding black + * screens. The DRM driver can chose to not modify property and keep link status + * as "GOOD" always to keep the user experience same as it currently is. + * + * The reason for adding this property is to handle link training failures, but + * it is not limited to DP or link training. For example, if we implement + * asynchronous setcrtc, this property can be used to report any failures in that. + */ +void drm_mode_connector_set_link_status_property(struct drm_connector *connector, + uint64_t link_status) +{ + struct drm_device *dev = connector->dev; + + /* Make sure the mutex is grabbed */ + lockdep_assert_held(&dev->mode_config.mutex); + connector->link_status = link_status; + drm_object_property_set_value(&connector->base, + dev->mode_config.link_status_property, + link_status); +} +EXPORT_SYMBOL(drm_mode_connector_set_link_status_property); + int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj, struct drm_property *property, uint64_t value) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index ad5c8b0..b7e2658 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -778,6 +778,8 @@ int drm_mode_connector_set_path_property(struct drm_connector *connector, int drm_mode_connector_set_tile_property(struct drm_connector *connector); int drm_mode_connector_update_edid_property(struct drm_connector *connector, const struct edid *edid); +void drm_mode_connector_set_link_status_property(struct drm_connector *connector, + uint64_t link_status); /** * drm_for_each_connector - iterate over all connectors -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx