All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu/dce: Don't turn off DP sink when disconnected
@ 2018-03-09 17:27 Michel Dänzer
       [not found] ` <20180309172731.2256-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2018-03-09 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

Turning off the sink in this case causes various issues, because
userspace expects it to stay on until it turns it off explicitly.

Instead, turn the sink off and back on when a display is connected
again. This dance seems necessary for link training to work correctly.

Bugzilla: https://bugs.freedesktop.org/105308
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 31 ++++++++++----------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index ffc1f6f46913..9da8d5802980 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -69,25 +69,18 @@ void amdgpu_connector_hotplug(struct drm_connector *connector)
 		/* don't do anything if sink is not display port, i.e.,
 		 * passive dp->(dvi|hdmi) adaptor
 		 */
-		if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
-			int saved_dpms = connector->dpms;
-			/* Only turn off the display if it's physically disconnected */
-			if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) {
-				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
-			} else if (amdgpu_atombios_dp_needs_link_train(amdgpu_connector)) {
-				/* Don't try to start link training before we
-				 * have the dpcd */
-				if (amdgpu_atombios_dp_get_dpcd(amdgpu_connector))
-					return;
-
-				/* set it to OFF so that drm_helper_connector_dpms()
-				 * won't return immediately since the current state
-				 * is ON at this point.
-				 */
-				connector->dpms = DRM_MODE_DPMS_OFF;
-				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
-			}
-			connector->dpms = saved_dpms;
+		if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT &&
+		    amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd) &&
+		    amdgpu_atombios_dp_needs_link_train(amdgpu_connector)) {
+			/* Don't start link training before we have the DPCD */
+			if (amdgpu_atombios_dp_get_dpcd(amdgpu_connector))
+				return;
+
+			/* Turn the connector off and back on immediately, which
+			 * will trigger link training
+			 */
+			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
+			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
 		}
 	}
 }
-- 
2.16.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu/dce: Don't turn off DP sink when disconnected
       [not found] ` <20180309172731.2256-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-03-09 20:26   ` Alex Deucher
       [not found]     ` <CADnq5_NA2OHe6eeiwou-HNNKNW0yt02_2dy3RUV2ouiDN7GjXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Deucher @ 2018-03-09 20:26 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list

On Fri, Mar 9, 2018 at 12:27 PM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> Turning off the sink in this case causes various issues, because
> userspace expects it to stay on until it turns it off explicitly.
>
> Instead, turn the sink off and back on when a display is connected
> again. This dance seems necessary for link training to work correctly.
>
> Bugzilla: https://bugs.freedesktop.org/105308
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Care to send a similar patch for radeon as well?

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 31 ++++++++++----------------
>  1 file changed, 12 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index ffc1f6f46913..9da8d5802980 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -69,25 +69,18 @@ void amdgpu_connector_hotplug(struct drm_connector *connector)
>                 /* don't do anything if sink is not display port, i.e.,
>                  * passive dp->(dvi|hdmi) adaptor
>                  */
> -               if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
> -                       int saved_dpms = connector->dpms;
> -                       /* Only turn off the display if it's physically disconnected */
> -                       if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) {
> -                               drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
> -                       } else if (amdgpu_atombios_dp_needs_link_train(amdgpu_connector)) {
> -                               /* Don't try to start link training before we
> -                                * have the dpcd */
> -                               if (amdgpu_atombios_dp_get_dpcd(amdgpu_connector))
> -                                       return;
> -
> -                               /* set it to OFF so that drm_helper_connector_dpms()
> -                                * won't return immediately since the current state
> -                                * is ON at this point.
> -                                */
> -                               connector->dpms = DRM_MODE_DPMS_OFF;
> -                               drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
> -                       }
> -                       connector->dpms = saved_dpms;
> +               if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT &&
> +                   amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd) &&
> +                   amdgpu_atombios_dp_needs_link_train(amdgpu_connector)) {
> +                       /* Don't start link training before we have the DPCD */
> +                       if (amdgpu_atombios_dp_get_dpcd(amdgpu_connector))
> +                               return;
> +
> +                       /* Turn the connector off and back on immediately, which
> +                        * will trigger link training
> +                        */
> +                       drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
> +                       drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
>                 }
>         }
>  }
> --
> 2.16.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu/dce: Don't turn off DP sink when disconnected
       [not found]     ` <CADnq5_NA2OHe6eeiwou-HNNKNW0yt02_2dy3RUV2ouiDN7GjXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-03-10 11:07       ` Michel Dänzer
  0 siblings, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2018-03-10 11:07 UTC (permalink / raw)
  To: Alex Deucher; +Cc: amd-gfx list

On 2018-03-09 09:26 PM, Alex Deucher wrote:
> On Fri, Mar 9, 2018 at 12:27 PM, Michel Dänzer <michel@daenzer.net> wrote:
>> From: Michel Dänzer <michel.daenzer@amd.com>
>>
>> Turning off the sink in this case causes various issues, because
>> userspace expects it to stay on until it turns it off explicitly.
>>
>> Instead, turn the sink off and back on when a display is connected
>> again. This dance seems necessary for link training to work correctly.
>>
>> Bugzilla: https://bugs.freedesktop.org/105308
>> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
> 
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Thanks! Is it okay to add Cc: stable as well?


> Care to send a similar patch for radeon as well?

Will do.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-10 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 17:27 [PATCH] drm/amdgpu/dce: Don't turn off DP sink when disconnected Michel Dänzer
     [not found] ` <20180309172731.2256-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-03-09 20:26   ` Alex Deucher
     [not found]     ` <CADnq5_NA2OHe6eeiwou-HNNKNW0yt02_2dy3RUV2ouiDN7GjXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-10 11:07       ` Michel Dänzer

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.