Skip to content

Commit d1742f7

Browse files
vsyrjalagregkh
authored andcommitted
drm/i915/cdclk: Fix CDCLK programming order when pipes are active
commit 7b1f6b5 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 09e6cbe commit d1742f7

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
@@ -2462,7 +2462,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
24622462
if (IS_DG2(i915))
24632463
intel_cdclk_pcode_pre_notify(state);
24642464

2465-
if (pipe == INVALID_PIPE ||
2465+
if (new_cdclk_state->disable_pipes ||
24662466
old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) {
24672467
drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
24682468

@@ -2494,7 +2494,7 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)
24942494
if (IS_DG2(i915))
24952495
intel_cdclk_pcode_post_notify(state);
24962496

2497-
if (pipe != INVALID_PIPE &&
2497+
if (!new_cdclk_state->disable_pipes &&
24982498
old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) {
24992499
drm_WARN_ON(&i915->drm, !new_cdclk_state->base.changed);
25002500

@@ -2946,6 +2946,7 @@ static struct intel_global_state *intel_cdclk_duplicate_state(struct intel_globa
29462946
return NULL;
29472947

29482948
cdclk_state->pipe = INVALID_PIPE;
2949+
cdclk_state->disable_pipes = false;
29492950

29502951
return &cdclk_state->base;
29512952
}
@@ -3124,6 +3125,8 @@ int intel_modeset_calc_cdclk(struct intel_atomic_state *state)
31243125
if (ret)
31253126
return ret;
31263127

3128+
new_cdclk_state->disable_pipes = true;
3129+
31273130
drm_dbg_kms(&dev_priv->drm,
31283131
"Modeset required for cdclk change\n");
31293132
}

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)