Skip to content

Commit f67ff36

Browse files
committed
drm/i915/fdi: Recompute state for affected CRTCs on FDI links
Recompute the state of all CRTCs on an FDI link during a modeset that may be affected by the modeset of other CRTCs on the same link. This ensures that each CRTC on the link maximizes its BW use (after another CRTC is disabled). In practice this means recomputing pipe B's config on IVB if pipe C gets disabled. v2: - Add the change recomputing affected CRTC states in a separate patch. (Ville) v3: (Ville) - Constify old and new crtc states. - Check for fused off pipe C. - Fix new vs. old crtc state mixup. - Drop check for pipe C's enabled state. Cc: Ville Syrjälä <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Imre Deak <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 998d2cd commit f67ff36

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6298,6 +6298,10 @@ static int intel_atomic_check_config(struct intel_atomic_state *state,
62986298
if (ret)
62996299
return ret;
63006300

6301+
ret = intel_fdi_add_affected_crtcs(state);
6302+
if (ret)
6303+
return ret;
6304+
63016305
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
63026306
if (!intel_crtc_needs_modeset(new_crtc_state)) {
63036307
if (intel_crtc_is_bigjoiner_slave(new_crtc_state))

drivers/gpu/drm/i915/display/intel_fdi.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,53 @@ void intel_fdi_link_train(struct intel_crtc *crtc,
120120
dev_priv->display.funcs.fdi->fdi_link_train(crtc, crtc_state);
121121
}
122122

123+
/**
124+
* intel_fdi_add_affected_crtcs - add CRTCs on FDI affected by other modeset CRTCs
125+
* @state: intel atomic state
126+
*
127+
* Add a CRTC using FDI to @state if changing another CRTC's FDI BW usage is
128+
* known to affect the available FDI BW for the former CRTC. In practice this
129+
* means adding CRTC B on IVYBRIDGE if its use of FDI lanes is limited (by
130+
* CRTC C) and CRTC C is getting disabled.
131+
*
132+
* Returns 0 in case of success, or a negative error code otherwise.
133+
*/
134+
int intel_fdi_add_affected_crtcs(struct intel_atomic_state *state)
135+
{
136+
struct drm_i915_private *i915 = to_i915(state->base.dev);
137+
const struct intel_crtc_state *old_crtc_state;
138+
const struct intel_crtc_state *new_crtc_state;
139+
struct intel_crtc *crtc;
140+
141+
if (!IS_IVYBRIDGE(i915) || INTEL_NUM_PIPES(i915) != 3)
142+
return 0;
143+
144+
crtc = intel_crtc_for_pipe(i915, PIPE_C);
145+
new_crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
146+
if (!new_crtc_state)
147+
return 0;
148+
149+
if (!intel_crtc_needs_modeset(new_crtc_state))
150+
return 0;
151+
152+
old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc);
153+
if (!old_crtc_state->fdi_lanes)
154+
return 0;
155+
156+
crtc = intel_crtc_for_pipe(i915, PIPE_B);
157+
new_crtc_state = intel_atomic_get_crtc_state(&state->base, crtc);
158+
if (IS_ERR(new_crtc_state))
159+
return PTR_ERR(new_crtc_state);
160+
161+
old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc);
162+
if (!old_crtc_state->fdi_lanes)
163+
return 0;
164+
165+
return intel_modeset_pipes_in_mask_early(state,
166+
"FDI link BW decrease on pipe C",
167+
BIT(PIPE_B));
168+
}
169+
123170
/* units of 100MHz */
124171
static int pipe_required_fdi_lanes(struct intel_crtc_state *crtc_state)
125172
{

drivers/gpu/drm/i915/display/intel_fdi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct intel_crtc_state;
1616
struct intel_encoder;
1717
struct intel_link_bw_limits;
1818

19+
int intel_fdi_add_affected_crtcs(struct intel_atomic_state *state);
1920
int intel_fdi_link_freq(struct drm_i915_private *i915,
2021
const struct intel_crtc_state *pipe_config);
2122
bool intel_fdi_compute_pipe_bpp(struct intel_crtc_state *crtc_state);

0 commit comments

Comments
 (0)