[PATCH v7 10/17] drm/dp_mst: Manually overwrite PBN divider for calculating timeslots

Leo sunpeng.li at amd.com
Tue Nov 26 15:06:02 UTC 2019


Reviewed-by: Leo Li <sunpeng.li at amd.com>

On 2019-11-16 5:01 p.m., mikita.lipski at amd.com wrote:
> From: Mikita Lipski <mikita.lipski at amd.com>
> 
> [why]
> For DSC case we cannot always use topology manager's PBN divider
> variable. The default divider does not take FEC into account.
> Therefore we should allow driver to calculate its own divider based
> on the link rate and count its handling, as it is hw specific.
> [how]
> Pass pbn_div as an argument, which will be used if its more than
> zero, otherwise default topology manager's pbn_div will be used.
> 
> 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 6c32b73c5197..3657a26ce1d1 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 d5df02315e14..94bb259ab73e 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -3211,6 +3211,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
> @@ -3237,7 +3238,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;
> @@ -3270,7 +3272,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 dfac450841df..2123ac2939f0 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 c45832230ccc..27c5ff99f77e 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -784,7 +784,8 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
>  	if (crtc_state->mode_changed) {
>  		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 4cf738545dfb..fc19094b06c3 100644
> --- a/include/drm/drm_dp_mst_helper.h
> +++ b/include/drm/drm_dp_mst_helper.h
> @@ -661,7 +661,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,
> 


More information about the amd-gfx mailing list