diff mbox series

[v4,6/6] drm/i915/dp_link_training: Emit a link-status=Bad uevent with trigger property

Message ID 20230824205335.500163-7-gildekel@chromium.org (mailing list archive)
State New, archived
Headers show
Series drm/i915/dp_link_training: Define a final failure state when link training fails | expand

Commit Message

Gil Dekel Aug. 24, 2023, 8:50 p.m. UTC
When a link-training attempt fails, emit a uevent to user space that
includes the trigger property, which in this case will be
link-statue=Bad.

This will allow userspace to parse the uevent property and better
understand the reason for the previous modeset failure.

Signed-off-by: Gil Dekel <gildekel@chromium.org>

V2:
  - init link_status_property inline.
---
 drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--
Gil Dekel, Software Engineer, Google / ChromeOS Display and Graphics

Comments

Manasi Navare Sept. 1, 2023, 11:22 p.m. UTC | #1
Thanks Gil for completing the logic here by emitting link status = BAD
even for final link failure state.

On Thu, Aug 24, 2023 at 1:54 PM Gil Dekel <gildekel@chromium.org> wrote:
>
> When a link-training attempt fails, emit a uevent to user space that
> includes the trigger property, which in this case will be
> link-statue=Bad.

Fix the typo above for link-status

>
> This will allow userspace to parse the uevent property and better
> understand the reason for the previous modeset failure.

I think we need to add more explanation in the commit message as to
current problem of no link status = BAD for final failure wrongly reflects link
is good in userspace even when there could have been a failure and black screen.

But that this patch in conjunction with proper handling in userspace fixes it.

Also here we should mention that this patch also now uses:
drm_sysfs_connector_property_event
instead of the earlier generic drm_kms_helper_connector_hotplug_event.

This will need some changes in other userspaces that parse this else it will
cause failures for other userspace once this lands.

With all the above changes,

Acked-by: Manasi Navare <navaremanasi@chromium.org>


Regards
Manasi

>
> Signed-off-by: Gil Dekel <gildekel@chromium.org>
>
> V2:
>   - init link_status_property inline.
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index e8b10f59e141..328e9f030033 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -42,6 +42,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_edid.h>
>  #include <drm/drm_probe_helper.h>
> +#include <drm/drm_sysfs.h>
>
>  #include "g4x_dp.h"
>  #include "i915_drv.h"
> @@ -5995,6 +5996,8 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
>         struct intel_dp *intel_dp =
>                 container_of(work, typeof(*intel_dp), modeset_retry_work);
>         struct drm_connector *connector = &intel_dp->attached_connector->base;
> +       struct drm_property *link_status_property =
> +               connector->dev->mode_config.link_status_property;
>
>         /* Set the connector's (and possibly all its downstream MST ports') link
>          * status to BAD.
> @@ -6011,7 +6014,7 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
>         }
>         mutex_unlock(&connector->dev->mode_config.mutex);
>         /* Send Hotplug uevent so userspace can reprobe */
> -       drm_kms_helper_connector_hotplug_event(connector);
> +       drm_sysfs_connector_property_event(connector, link_status_property);
>  }
>
>  bool
> --
> Gil Dekel, Software Engineer, Google / ChromeOS Display and Graphics
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index e8b10f59e141..328e9f030033 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -42,6 +42,7 @@ 
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_sysfs.h>

 #include "g4x_dp.h"
 #include "i915_drv.h"
@@ -5995,6 +5996,8 @@  static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
 	struct intel_dp *intel_dp =
 		container_of(work, typeof(*intel_dp), modeset_retry_work);
 	struct drm_connector *connector = &intel_dp->attached_connector->base;
+	struct drm_property *link_status_property =
+		connector->dev->mode_config.link_status_property;

 	/* Set the connector's (and possibly all its downstream MST ports') link
 	 * status to BAD.
@@ -6011,7 +6014,7 @@  static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
 	}
 	mutex_unlock(&connector->dev->mode_config.mutex);
 	/* Send Hotplug uevent so userspace can reprobe */
-	drm_kms_helper_connector_hotplug_event(connector);
+	drm_sysfs_connector_property_event(connector, link_status_property);
 }

 bool