diff options
author | Pandiyan, Dhinakaran <dhinakaran.pandiyan@intel.com> | 2017-04-28 19:14:20 -0400 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2017-05-04 09:02:48 -0400 |
commit | f424f55e31779bdc2389db9115fca65c553f8558 (patch) | |
tree | 7a92890b6a4fb676a910a758cdeae5abbfa960d7 /drivers/gpu/drm/i915/intel_dp_mst.c | |
parent | edb1ed1ab7d314e114de84003f763da34c0f34c0 (diff) |
drm/i915: Track MST link bandwidth
Use the added helpers to track MST link bandwidth for atomic modesets.
Link bw is acquired in the ->atomic_check() phase when CRTCs are being
enabled with drm_atomic_find_vcpi_slots(). Similarly, link bw is released
during ->atomic_check() with the connector helper callback ->atomic_check()
when CRTCs are disabled.
v6: active_changed does not alter vcpi allocations (Maarten)
v5: Implement connector->atomic_check() in place of atomic_release()
v4: Return an int from intel_dp_mst_atomic_release() (Maarten)
v3:
Handled the case where ->atomic_release() is called more than once
during an atomic_check() for the same state.
v2:
Squashed atomic_release() implementation and caller (Daniel)
Fixed logic for connector-crtc switching case (Daniel)
Fixed logic for suspend-resume case.
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Harry Wentland <Harry.wentland@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1493421260-3146-1-git-send-email-dhinakaran.pandiyan@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dp_mst.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp_mst.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index c1f62eb07c07..1dee9933005f 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c | |||
@@ -39,7 +39,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, | |||
39 | struct intel_dp *intel_dp = &intel_dig_port->dp; | 39 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
40 | struct intel_connector *connector = | 40 | struct intel_connector *connector = |
41 | to_intel_connector(conn_state->connector); | 41 | to_intel_connector(conn_state->connector); |
42 | struct drm_atomic_state *state; | 42 | struct drm_atomic_state *state = pipe_config->base.state; |
43 | int bpp; | 43 | int bpp; |
44 | int lane_count, slots; | 44 | int lane_count, slots; |
45 | const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; | 45 | const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; |
@@ -57,20 +57,24 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, | |||
57 | * seem to suggest we should do otherwise. | 57 | * seem to suggest we should do otherwise. |
58 | */ | 58 | */ |
59 | lane_count = drm_dp_max_lane_count(intel_dp->dpcd); | 59 | lane_count = drm_dp_max_lane_count(intel_dp->dpcd); |
60 | |||
61 | pipe_config->lane_count = lane_count; | 60 | pipe_config->lane_count = lane_count; |
62 | 61 | ||
63 | pipe_config->pipe_bpp = bpp; | 62 | pipe_config->pipe_bpp = bpp; |
64 | pipe_config->port_clock = intel_dp_max_link_rate(intel_dp); | ||
65 | 63 | ||
66 | state = pipe_config->base.state; | 64 | pipe_config->port_clock = intel_dp_max_link_rate(intel_dp); |
67 | 65 | ||
68 | if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port)) | 66 | if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port)) |
69 | pipe_config->has_audio = true; | 67 | pipe_config->has_audio = true; |
70 | mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); | ||
71 | 68 | ||
69 | mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); | ||
72 | pipe_config->pbn = mst_pbn; | 70 | pipe_config->pbn = mst_pbn; |
73 | slots = drm_dp_find_vcpi_slots(&intel_dp->mst_mgr, mst_pbn); | 71 | |
72 | slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, | ||
73 | connector->port, mst_pbn); | ||
74 | if (slots < 0) { | ||
75 | DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots); | ||
76 | return false; | ||
77 | } | ||
74 | 78 | ||
75 | intel_link_compute_m_n(bpp, lane_count, | 79 | intel_link_compute_m_n(bpp, lane_count, |
76 | adjusted_mode->crtc_clock, | 80 | adjusted_mode->crtc_clock, |
@@ -80,7 +84,38 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, | |||
80 | pipe_config->dp_m_n.tu = slots; | 84 | pipe_config->dp_m_n.tu = slots; |
81 | 85 | ||
82 | return true; | 86 | return true; |
87 | } | ||
83 | 88 | ||
89 | static int intel_dp_mst_atomic_check(struct drm_connector *connector, | ||
90 | struct drm_connector_state *new_conn_state) | ||
91 | { | ||
92 | struct drm_atomic_state *state = new_conn_state->state; | ||
93 | struct drm_connector_state *old_conn_state; | ||
94 | struct drm_crtc *old_crtc; | ||
95 | struct drm_crtc_state *crtc_state; | ||
96 | int slots, ret = 0; | ||
97 | |||
98 | old_conn_state = drm_atomic_get_old_connector_state(state, connector); | ||
99 | old_crtc = old_conn_state->crtc; | ||
100 | if (!old_crtc) | ||
101 | return ret; | ||
102 | |||
103 | crtc_state = drm_atomic_get_new_crtc_state(state, old_crtc); | ||
104 | slots = to_intel_crtc_state(crtc_state)->dp_m_n.tu; | ||
105 | if (drm_atomic_crtc_needs_modeset(crtc_state) && slots > 0) { | ||
106 | struct drm_dp_mst_topology_mgr *mgr; | ||
107 | struct drm_encoder *old_encoder; | ||
108 | |||
109 | old_encoder = old_conn_state->best_encoder; | ||
110 | mgr = &enc_to_mst(old_encoder)->primary->dp.mst_mgr; | ||
111 | |||
112 | ret = drm_dp_atomic_release_vcpi_slots(state, mgr, slots); | ||
113 | if (ret) | ||
114 | DRM_DEBUG_KMS("failed releasing %d vcpi slots:%d\n", slots, ret); | ||
115 | else | ||
116 | to_intel_crtc_state(crtc_state)->dp_m_n.tu = 0; | ||
117 | } | ||
118 | return ret; | ||
84 | } | 119 | } |
85 | 120 | ||
86 | static void intel_mst_disable_dp(struct intel_encoder *encoder, | 121 | static void intel_mst_disable_dp(struct intel_encoder *encoder, |
@@ -387,6 +422,7 @@ static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_fun | |||
387 | .mode_valid = intel_dp_mst_mode_valid, | 422 | .mode_valid = intel_dp_mst_mode_valid, |
388 | .atomic_best_encoder = intel_mst_atomic_best_encoder, | 423 | .atomic_best_encoder = intel_mst_atomic_best_encoder, |
389 | .best_encoder = intel_mst_best_encoder, | 424 | .best_encoder = intel_mst_best_encoder, |
425 | .atomic_check = intel_dp_mst_atomic_check, | ||
390 | }; | 426 | }; |
391 | 427 | ||
392 | static void intel_dp_mst_encoder_destroy(struct drm_encoder *encoder) | 428 | static void intel_dp_mst_encoder_destroy(struct drm_encoder *encoder) |