[PATCH 09/30] drm/amd/display: Fix rehook MST display not light back on

Grodzovsky, Andrey Andrey.Grodzovsky at amd.com
Thu Dec 14 17:34:15 UTC 2017



> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Harry Wentland
> Sent: Wednesday, December 13, 2017 5:35 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Zuo, Jerry <Jerry.Zuo at amd.com>
> Subject: [PATCH 09/30] drm/amd/display: Fix rehook MST display not light
> back on
> 
> From: "Jerry (Fangzhi) Zuo" <Jerry.Zuo at amd.com>
> 
> Original applied dm_restore_drm_connector_state() has got removed.
> Set link status to BAD before hotplug() event could trigger another modeset
> from userspace.
> 
> The fix "Fix MST daisy chain SST not light up" commit makes so it is trying to
> create a stream prior to dc_sink. That makes dc_sink is not present in
> create_stream_for_sink().

Could you please make a more clear message what is broken and what is the fix ?

Thanks,
Andrey

> 
> Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo at amd.com>
> Reviewed-by: Roman Li <Roman.Li at amd.com>
> Acked-by: Harry Wentland <harry.wentland at amd.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 13 +++---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |  2 +
>  .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    | 51
> ++++++++++++++++++++++
>  .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.h    |  1 +
>  4 files changed, 62 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 5163cf6fb73c..3f982aa56b01 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2356,7 +2356,7 @@ create_stream_for_sink(struct
> amdgpu_dm_connector *aconnector,
>  		       const struct dm_connector_state *dm_state)  {
>  	struct drm_display_mode *preferred_mode = NULL;
> -	const struct drm_connector *drm_connector;
> +	struct drm_connector *drm_connector;
>  	struct dc_stream_state *stream = NULL;
>  	struct drm_display_mode mode = *drm_mode;
>  	bool native_mode_found = false;
> @@ -2375,11 +2375,13 @@ create_stream_for_sink(struct
> amdgpu_dm_connector *aconnector,
> 
>  	if (!aconnector->dc_sink) {
>  		/*
> -		 * Exclude MST from creating fake_sink
> -		 * TODO: need to enable MST into fake_sink feature
> +		 * Create dc_sink when necessary to MST
> +		 * Don't apply fake_sink to MST
>  		 */
> -		if (aconnector->mst_port)
> -			goto stream_create_fail;
> +		if (aconnector->mst_port) {
> +			dm_dp_mst_dc_sink_create(drm_connector);
> +			goto mst_dc_sink_create_done;
> +		}
> 
>  		if (create_fake_sink(aconnector))
>  			goto stream_create_fail;
> @@ -2430,6 +2432,7 @@ create_stream_for_sink(struct
> amdgpu_dm_connector *aconnector,
>  stream_create_fail:
>  dm_state_null:
>  drm_connector_null:
> +mst_dc_sink_create_done:
>  	return stream;
>  }
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> index 450379d684cb..3c9154f2d058 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> @@ -189,6 +189,8 @@ struct amdgpu_dm_connector {
>  	struct mutex hpd_lock;
> 
>  	bool fake_enable;
> +
> +	bool mst_connected;
>  };
> 
>  #define to_amdgpu_dm_connector(x) container_of(x, struct
> amdgpu_dm_connector, base) diff --git
> a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> index 707928b88448..f3d87f418d2e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> +++
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> @@ -180,6 +180,42 @@ static int dm_connector_update_modes(struct
> drm_connector *connector,
>  	return drm_add_edid_modes(connector, edid);  }
> 
> +void dm_dp_mst_dc_sink_create(struct drm_connector *connector) {
> +	struct amdgpu_dm_connector *aconnector =
> to_amdgpu_dm_connector(connector);
> +	struct edid *edid;
> +	struct dc_sink *dc_sink;
> +	struct dc_sink_init_data init_params = {
> +			.link = aconnector->dc_link,
> +			.sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST };
> +
> +	edid = drm_dp_mst_get_edid(connector, &aconnector->mst_port-
> >mst_mgr,
> +aconnector->port);
> +
> +	if (!edid) {
> +		drm_mode_connector_update_edid_property(
> +			&aconnector->base,
> +			NULL);
> +		return;
> +	}
> +
> +	aconnector->edid = edid;
> +
> +	dc_sink = dc_link_add_remote_sink(
> +		aconnector->dc_link,
> +		(uint8_t *)aconnector->edid,
> +		(aconnector->edid->extensions + 1) * EDID_LENGTH,
> +		&init_params);
> +
> +	dc_sink->priv = aconnector;
> +	aconnector->dc_sink = dc_sink;
> +
> +	amdgpu_dm_add_sink_to_freesync_module(
> +			connector, aconnector->edid);
> +
> +	drm_mode_connector_update_edid_property(
> +					&aconnector->base, aconnector-
> >edid); }
> +
>  static int dm_dp_mst_get_modes(struct drm_connector *connector)  {
>  	struct amdgpu_dm_connector *aconnector =
> to_amdgpu_dm_connector(connector);
> @@ -306,6 +342,7 @@ dm_dp_add_mst_connector(struct
> drm_dp_mst_topology_mgr *mgr,
> 
> 	drm_mode_connector_set_path_property(connector, pathprop);
> 
>  			drm_connector_list_iter_end(&conn_iter);
> +			aconnector->mst_connected = true;
>  			return &aconnector->base;
>  		}
>  	}
> @@ -358,6 +395,8 @@ dm_dp_add_mst_connector(struct
> drm_dp_mst_topology_mgr *mgr,
>  	 */
>  	amdgpu_dm_connector_funcs_reset(connector);
> 
> +	aconnector->mst_connected = true;
> +
>  	DRM_INFO("DM_MST: added connector: %p [id: %d] [master:
> %p]\n",
>  			aconnector, connector->base.id, aconnector-
> >mst_port);
> 
> @@ -389,6 +428,8 @@ static void dm_dp_destroy_mst_connector(struct
> drm_dp_mst_topology_mgr *mgr,
>  	drm_mode_connector_update_edid_property(
>  			&aconnector->base,
>  			NULL);
> +
> +	aconnector->mst_connected = false;
>  }
> 
>  static void dm_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
> @@ -399,10 +440,18 @@ static void dm_dp_mst_hotplug(struct
> drm_dp_mst_topology_mgr *mgr)
>  	drm_kms_helper_hotplug_event(dev);
>  }
> 
> +static void dm_dp_mst_link_status_reset(struct drm_connector
> +*connector) {
> +	mutex_lock(&connector->dev->mode_config.mutex);
> +	drm_mode_connector_set_link_status_property(connector,
> DRM_MODE_LINK_STATUS_BAD);
> +	mutex_unlock(&connector->dev->mode_config.mutex);
> +}
> +
>  static void dm_dp_mst_register_connector(struct drm_connector
> *connector)  {
>  	struct drm_device *dev = connector->dev;
>  	struct amdgpu_device *adev = dev->dev_private;
> +	struct amdgpu_dm_connector *aconnector =
> +to_amdgpu_dm_connector(connector);
> 
>  	if (adev->mode_info.rfbdev)
>  		drm_fb_helper_add_one_connector(&adev-
> >mode_info.rfbdev->helper, connector); @@ -411,6 +460,8 @@ static void
> dm_dp_mst_register_connector(struct drm_connector *connector)
> 
>  	drm_connector_register(connector);
> 
> +	if (aconnector->mst_connected)
> +		dm_dp_mst_link_status_reset(connector);
>  }
> 
>  static const struct drm_dp_mst_topology_cbs dm_mst_cbs = { diff --git
> a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> index 2da851b40042..8cf51da26657 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> +++
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> @@ -31,5 +31,6 @@ struct amdgpu_dm_connector;
> 
>  void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager
> *dm,
>  				       struct amdgpu_dm_connector
> *aconnector);
> +void dm_dp_mst_dc_sink_create(struct drm_connector *connector);
> 
>  #endif
> --
> 2.14.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list