diff mbox series

[v4,2/3] drm/probe-helper: Check epoch counter in output_poll_execute()

Message ID 20210120170033.38468-3-noralf@tronnes.org (mailing list archive)
State New, archived
Headers show
Series Generic USB Display driver | expand

Commit Message

Noralf Trønnes Jan. 20, 2021, 5 p.m. UTC
drm_helper_hpd_irq_event() checks the epoch counter to determine
connector status change. This was introduced in
commit 5186421cbfe2 ("drm: Introduce epoch counter to drm_connector").
Do the same for output_poll_execute() so it can detect other changes
beside connection status value changes.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_probe_helper.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Jan. 20, 2021, 5:41 p.m. UTC | #1
On Wed, Jan 20, 2021 at 6:10 PM Noralf Trønnes <noralf@tronnes.org> wrote:
>
> drm_helper_hpd_irq_event() checks the epoch counter to determine
> connector status change. This was introduced in
> commit 5186421cbfe2 ("drm: Introduce epoch counter to drm_connector").
> Do the same for output_poll_execute() so it can detect other changes
> beside connection status value changes.
>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/drm_probe_helper.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index d6017726cc2a..e5432dcf6999 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -623,6 +623,7 @@ static void output_poll_execute(struct work_struct *work)
>         struct drm_connector_list_iter conn_iter;
>         enum drm_connector_status old_status;
>         bool repoll = false, changed;
> +       u64 old_epoch_counter;
>
>         if (!dev->mode_config.poll_enabled)
>                 return;
> @@ -659,8 +660,9 @@ static void output_poll_execute(struct work_struct *work)
>
>                 repoll = true;
>
> +               old_epoch_counter = connector->epoch_counter;
>                 connector->status = drm_helper_probe_detect(connector, NULL, false);
> -               if (old_status != connector->status) {
Was about to ask whether we're not missing connector status changes
here, but that's already handled. Not sure why this wasn't done as
part of the original patch, I'd include a cc: stable here.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +               if (old_epoch_counter != connector->epoch_counter) {
>                         const char *old, *new;
>
>                         /*
> @@ -689,6 +691,9 @@ static void output_poll_execute(struct work_struct *work)
>                                       connector->base.id,
>                                       connector->name,
>                                       old, new);
> +                       DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
> +                                     connector->base.id, connector->name,
> +                                     old_epoch_counter, connector->epoch_counter);
>
>                         changed = true;
>                 }
> --
> 2.23.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index d6017726cc2a..e5432dcf6999 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -623,6 +623,7 @@  static void output_poll_execute(struct work_struct *work)
 	struct drm_connector_list_iter conn_iter;
 	enum drm_connector_status old_status;
 	bool repoll = false, changed;
+	u64 old_epoch_counter;
 
 	if (!dev->mode_config.poll_enabled)
 		return;
@@ -659,8 +660,9 @@  static void output_poll_execute(struct work_struct *work)
 
 		repoll = true;
 
+		old_epoch_counter = connector->epoch_counter;
 		connector->status = drm_helper_probe_detect(connector, NULL, false);
-		if (old_status != connector->status) {
+		if (old_epoch_counter != connector->epoch_counter) {
 			const char *old, *new;
 
 			/*
@@ -689,6 +691,9 @@  static void output_poll_execute(struct work_struct *work)
 				      connector->base.id,
 				      connector->name,
 				      old, new);
+			DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
+				      connector->base.id, connector->name,
+				      old_epoch_counter, connector->epoch_counter);
 
 			changed = true;
 		}