Skip to content

Commit 7b1f6b5

Browse files
vsyrjalarodrigovivi
authored andcommitted
drm/i915/cdclk: Fix CDCLK programming order when pipes are active
Currently we always reprogram CDCLK from the intel_set_cdclk_pre_plane_update() when using squash/crawl. The code only works correctly for the cd2x update or full modeset cases, and it was simply never updated to deal with squash/crawl. If the CDCLK frequency is increasing we must reprogram it before we do anything else that might depend on the new higher frequency, and conversely we must not decrease the frequency until everything that might still depend on the old higher frequency has been dealt with. Since cdclk_state->pipe is only relevant when doing a cd2x update we can't use it to determine the correct sequence during squash/crawl. To that end introduce cdclk_state->disable_pipes which simply indicates that we must perform the update while the pipes are disable (ie. during intel_set_cdclk_pre_plane_update()). Otherwise we use the same old vs. new CDCLK frequency comparsiong as for cd2x updates. The only remaining problem case is when the voltage_level needs to increase due to a DDI port, but the CDCLK frequency is decreasing (and not all pipes are being disabled). The current approach will not bump the voltage level up until after the port has already been enabled, which is too late. But we'll take care of that case separately. v2: Don't break the "must disable pipes case" v3: Keep the on stack 'pipe' for future use Cc: [email protected] Fixes: d62686b ("drm/i915/adl_p: CDCLK crawl support for ADL") Reviewed-by: Uma Shankar <[email protected]> Reviewed-by: Gustavo Sousa <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 3aecee9) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent fec50db commit 7b1f6b5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
25432543
if (IS_DG2(i915))
25442544
intel_cdclk_pcode_pre_notify(state);
25452545

2546-
if (pipe == INVALID_PIPE ||
2546+
if (new_cdclk_state->disable_pipes ||
25472547
old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
25482548
drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
25492549

@@ -2575,7 +2575,7 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)
25752575
if (IS_DG2(i915))
25762576
intel_cdclk_pcode_post_notify(state);
25772577

2578-
if (pipe != INVALID_PIPE &&
2578+
if (!new_cdclk_state->disable_pipes &&
25792579
old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) {
25802580
drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
25812581

@@ -3058,6 +3058,7 @@ static struct intel_global_state *intel_cdclk_duplicate_state(struct intel_globa
30583058
return NULL;
30593059

30603060
cdclk_state->pipe = INVALID_PIPE;
3061+
cdclk_state->disable_pipes = false;
30613062

30623063
return &cdclk_state->base;
30633064
}
@@ -3236,6 +3237,8 @@ int intel_modeset_calc_cdclk(struct intel_atomic_state *state)
32363237
if (ret)
32373238
return ret;
32383239

3240+
new_cdclk_state->disable_pipes = true;
3241+
32393242
drm_dbg_kms(&dev_priv->drm,
32403243
"Modeset required for cdclk change\n");
32413244
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ struct intel_cdclk_state {
5151

5252
/* bitmask of active pipes */
5353
u8 active_pipes;
54+
55+
/* update cdclk with pipes disabled */
56+
bool disable_pipes;
5457
};
5558

5659
int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state);

0 commit comments

Comments
 (0)