[PATCH v9 10/18] drm/dp_mst: Manually overwrite PBN divider for calculating timeslots

Lyude Paul lyude at redhat.com
Fri Dec 20 21:45:58 UTC 2019


Reviewed-by: Lyude Paul <lyude at redhat.com>

On Fri, 2019-12-13 at 15:08 -0500, mikita.lipski at amd.com wrote:
> From: Mikita Lipski <mikita.lipski at amd.com>
> 
> [why]
> For DSC case we cannot use topology manager's PBN divider
> variable. The default divider does not take FEC into account.
> Therefore the driver has to calculate its own divider based
> on the link rate and lane count its handling, as it is hw specific.
> 
> [how]
> Pass pbn_div as an argument, which is used if its more than
> zero, otherwise default topology manager's pbn_div will be used.
> 
> Cc: Lyude Paul <lyude at redhat.com>
> Cc: Harry Wentland <harry.wentland at amd.com>
> Cc: Manasi Navare <manasi.d.navare at intel.com>
> Signed-off-by: Mikita Lipski <mikita.lipski at amd.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
>  drivers/gpu/drm/drm_dp_mst_topology.c             | 9 +++++++--
>  drivers/gpu/drm/i915/display/intel_dp_mst.c       | 2 +-
>  drivers/gpu/drm/nouveau/dispnv50/disp.c           | 3 ++-
>  include/drm/drm_dp_mst_helper.h                   | 3 ++-
>  5 files changed, 14 insertions(+), 6 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 9fc03fc1017d..753a79734817 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4972,7 +4972,8 @@ static int dm_encoder_helper_atomic_check(struct
> drm_encoder *encoder,
>  	dm_new_connector_state->vcpi_slots =
> drm_dp_atomic_find_vcpi_slots(state,
>  									   mst
> _mgr,
>  									   mst
> _port,
> -									   dm_
> new_connector_state->pbn);
> +									   dm_
> new_connector_state->pbn,
> +									   0);
>  	if (dm_new_connector_state->vcpi_slots < 0) {
>  		DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n",
> (int)dm_new_connector_state->vcpi_slots);
>  		return dm_new_connector_state->vcpi_slots;
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 74bed71f7315..bb0844dfb3d2 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -4020,6 +4020,7 @@ static int drm_dp_init_vcpi(struct
> drm_dp_mst_topology_mgr *mgr,
>   * @mgr: MST topology manager for the port
>   * @port: port to find vcpi slots for
>   * @pbn: bandwidth required for the mode in PBN
> + * @pbn_div: divider for DSC mode that takes FEC into account
>   *
>   * Allocates VCPI slots to @port, replacing any previous VCPI allocations
> it
>   * may have had. Any atomic drivers which support MST must call this
> function
> @@ -4046,7 +4047,8 @@ static int drm_dp_init_vcpi(struct
> drm_dp_mst_topology_mgr *mgr,
>   */
>  int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
>  				  struct drm_dp_mst_topology_mgr *mgr,
> -				  struct drm_dp_mst_port *port, int pbn)
> +				  struct drm_dp_mst_port *port, int pbn,
> +				  int pbn_div)
>  {
>  	struct drm_dp_mst_topology_state *topology_state;
>  	struct drm_dp_vcpi_allocation *pos, *vcpi = NULL;
> @@ -4079,7 +4081,10 @@ int drm_dp_atomic_find_vcpi_slots(struct
> drm_atomic_state *state,
>  	if (!vcpi)
>  		prev_slots = 0;
>  
> -	req_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
> +	if (pbn_div <= 0)
> +		pbn_div = mgr->pbn_div;
> +
> +	req_slots = DIV_ROUND_UP(pbn, pbn_div);
>  
>  	DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n",
>  			 port->connector->base.id, port->connector->name,
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 92be17711287..a068f54a6793 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -65,7 +65,7 @@ static int intel_dp_mst_compute_link_config(struct
> intel_encoder *encoder,
>  						       false);
>  
>  		slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp-
> >mst_mgr,
> -						      port, crtc_state->pbn);
> +						      port, crtc_state->pbn,
> 0);
>  		if (slots == -EDEADLK)
>  			return slots;
>  		if (slots >= 0)
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index 1c9e23d5a6fd..edb78966c5b6 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -787,7 +787,8 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
>  
>  		slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr,
>  						      mstc->port,
> -						      asyh->dp.pbn);
> +						      asyh->dp.pbn,
> +						      0);
>  		if (slots < 0)
>  			return slots;
>  
> diff --git a/include/drm/drm_dp_mst_helper.h
> b/include/drm/drm_dp_mst_helper.h
> index 32e60b9d7098..0f813d6346aa 100644
> --- a/include/drm/drm_dp_mst_helper.h
> +++ b/include/drm/drm_dp_mst_helper.h
> @@ -771,7 +771,8 @@ struct drm_dp_mst_topology_state
> *drm_atomic_get_mst_topology_state(struct drm_a
>  int __must_check
>  drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
>  			      struct drm_dp_mst_topology_mgr *mgr,
> -			      struct drm_dp_mst_port *port, int pbn);
> +			      struct drm_dp_mst_port *port, int pbn,
> +			      int pbn_div);
>  int __must_check
>  drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,
>  				 struct drm_dp_mst_topology_mgr *mgr,
-- 
Cheers,
	Lyude Paul



More information about the amd-gfx mailing list