All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Manasi Navare <manasi.d.navare@intel.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH 2/5] drm: Set DRM connector link status property
Date: Thu, 17 Nov 2016 23:13:17 -0800	[thread overview]
Message-ID: <1479453200-27705-3-git-send-email-manasi.d.navare@intel.com> (raw)
In-Reply-To: <1479453200-27705-1-git-send-email-manasi.d.navare@intel.com>

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.

v3:
* Updated kernel doc even more (Daniel Vetter)
v2:
* Update kernel doc, add lockdep_assert_held (Daniel Vetter)
Cc: dri-devel@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/drm_connector.c | 37 +++++++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h     |  2 ++
 2 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 2b6ee0e..f3f09b8 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -968,6 +968,43 @@ 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.
+ * Drivers can therefore not rely on userspace to fix up everything and
+ * should try to handle issues (like just re-training a link) without
+ * userspace's intervention. This should only be used when the current mode
+ * fails and userspace must select a different display mode.
+ * 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 ab564e6..f47b345 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);
 
 /**
  * struct drm_tile_group - Tile group metadata
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-11-18  7:13 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18  7:13 [PATCH 0/5] Link Training failure handling during modeset Manasi Navare
2016-11-18  7:13 ` [PATCH 1/5] drm: Add a new connector property for link status Manasi Navare
2016-11-19  2:50   ` [PATCH v5 " Manasi Navare
2016-11-21  9:33     ` Daniel Vetter
2016-11-18  7:13 ` Manasi Navare [this message]
2016-11-19  2:50   ` [PATCH v3 2/5] drm: Set DRM connector link status property Manasi Navare
2016-11-18  7:13 ` [PATCH 3/5] drm/i915: Update CRTC state if connector link status property changed Manasi Navare
2016-11-18 13:50   ` Maarten Lankhorst
2016-11-18 14:11     ` Ville Syrjälä
2016-11-18 14:18       ` Maarten Lankhorst
2016-11-18 15:28         ` Ville Syrjälä
2016-11-18 15:35           ` [Intel-gfx] " Daniel Vetter
2016-11-18 16:21             ` Ville Syrjälä
2016-11-18 17:44               ` [Intel-gfx] " Manasi Navare
2016-11-21  9:38                 ` Daniel Vetter
2016-11-21  9:42                   ` Chris Wilson
2016-11-21 10:10                     ` [Intel-gfx] " Daniel Vetter
2016-11-21 15:48                       ` Daniel Vetter
2016-11-21 19:00                         ` Manasi Navare
2016-11-21 20:46                           ` Chris Wilson
2016-11-21 21:07                             ` [Intel-gfx] " Manasi Navare
2016-11-23  1:15                         ` Manasi Navare
2016-11-23  7:44                           ` Daniel Vetter
2016-11-18 18:13             ` [Intel-gfx] " Manasi Navare
2016-11-18 15:23       ` Manasi Navare
2016-11-18  7:13 ` [PATCH 4/5] drm/i915: Find fallback link rate/lane count Manasi Navare
2016-11-18  7:29   ` Manasi Navare
2016-11-18 13:22     ` Jani Nikula
2016-11-18 15:39       ` Manasi Navare
2016-11-19  2:09         ` Manasi Navare
2016-11-19  2:50   ` [PATCH v6 4/56 4/56 4/56 4/56 4/56 " Manasi Navare
2016-11-18  7:13 ` [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure Manasi Navare
2016-11-18  7:29   ` Manasi Navare
2016-11-18 13:31     ` Jani Nikula
2016-11-18 15:29       ` Manasi Navare
2016-11-19  2:50   ` [PATCH v8 " Manasi Navare
2016-11-18  8:31 ` ✗ Fi.CI.BAT: failure for Link Training failure handling during modeset (rev3) Patchwork
2016-11-19  4:01 ` ✗ Fi.CI.BAT: failure for Link Training failure handling during modeset (rev4) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2016-11-19  2:58 [PATCH 0/5] Clean series for Link training failure handling Manasi Navare
2016-11-19  2:58 ` [PATCH 2/5] drm: Set DRM connector link status property Manasi Navare
2016-11-19  8:25   ` Chris Wilson
2016-11-15  3:13 [PATCH 0/5] Handle link training failure during modeset Manasi Navare
2016-11-15  3:13 ` [PATCH 2/5] drm: Set DRM connector link status property Manasi Navare
2016-11-15  3:23   ` Manasi Navare
2016-11-15  7:50     ` Daniel Vetter
2016-11-15  7:49   ` [Intel-gfx] " Daniel Vetter
2016-11-15 23:56     ` Manasi Navare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479453200-27705-3-git-send-email-manasi.d.navare@intel.com \
    --to=manasi.d.navare@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.