OSDN Git Service

drm/dp_mst: Manually overwrite PBN divider for calculating timeslots
authorMikita Lipski <mikita.lipski@amd.com>
Thu, 14 Nov 2019 21:24:29 +0000 (16:24 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 9 Jan 2020 23:07:47 +0000 (18:07 -0500)
[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.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/drm_dp_mst_topology.c
drivers/gpu/drm/i915/display/intel_dp_mst.c
drivers/gpu/drm/nouveau/dispnv50/disp.c
include/drm/drm_dp_mst_helper.h

index abc359a..ec8f6fc 100644 (file)
@@ -4938,7 +4938,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;
index 480c71a..9020182 100644 (file)
@@ -4093,6 +4093,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
@@ -4119,7 +4120,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;
@@ -4152,7 +4154,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,
index 92be177..a068f54 100644 (file)
@@ -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)
index d0b8ebb..fd31bff 100644 (file)
@@ -810,7 +810,7 @@ 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;
 
index c217b2a..82ab677 100644 (file)
@@ -779,7 +779,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,