drm/vc4: kms: Wait for the commit before increasing our clock rate
Several DRM/KMS atomic commits can run in parallel if they affect different CRTC. These commits share the global HVS state, so we have some code to make sure we run commits in sequence. This synchronization code is one of the first thing that runs in vc4_atomic_commit_tail(). Another constraints we have is that we need to make sure the HVS clock gets a boost during the commit. That code relies on clk_set_min_rate and will remove the old minimum and set a new one. We also need another, temporary, minimum for the duration of the commit. The algorithm is thus to set a temporary minimum, drop the previous one, do the commit, and finally set the minimum for the current mode. However, the part that sets the temporary minimum and drops the older one runs before the commit synchronization code. Thus, under the proper conditions, we can end up mixing up the minimums and ending up with the wrong one for our current step. To avoid it, let's move the clock setup in the protected section. Fixes:d7d96c00e5
("drm/vc4: hvs: Boost the core clock during modeset") Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Tested-by: Jian-Hong Pan <jhp@endlessos.org> [danvet: re-apply this from0c980a006d
("drm/vc4: kms: Wait for the commit before increasing our clock rate") because I lost that part in my merge resolution in99b03ca651
("Merge v5.16-rc5 into drm-next")] Fixes:99b03ca651
("Merge v5.16-rc5 into drm-next") Acked-by: Maxime Ripard <maxime@cerno.tech> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://lore.kernel.org/r/20211117094527.146275-2-maxime@cerno.tech
This commit is contained in:
parent
99b03ca651
commit
244a36e50d
|
@ -365,14 +365,6 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
|
||||||
vc4_hvs_mask_underrun(dev, vc4_crtc_state->assigned_channel);
|
vc4_hvs_mask_underrun(dev, vc4_crtc_state->assigned_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vc4->hvs->hvs5) {
|
|
||||||
unsigned long core_rate = max_t(unsigned long,
|
|
||||||
500000000,
|
|
||||||
new_hvs_state->core_clock_rate);
|
|
||||||
|
|
||||||
clk_set_min_rate(hvs->core_clk, core_rate);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (channel = 0; channel < HVS_NUM_CHANNELS; channel++) {
|
for (channel = 0; channel < HVS_NUM_CHANNELS; channel++) {
|
||||||
struct drm_crtc_commit *commit;
|
struct drm_crtc_commit *commit;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -392,6 +384,13 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
|
||||||
old_hvs_state->fifo_state[channel].pending_commit = NULL;
|
old_hvs_state->fifo_state[channel].pending_commit = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vc4->hvs->hvs5) {
|
||||||
|
unsigned long core_rate = max_t(unsigned long,
|
||||||
|
500000000,
|
||||||
|
new_hvs_state->core_clock_rate);
|
||||||
|
|
||||||
|
clk_set_min_rate(hvs->core_clk, core_rate);
|
||||||
|
}
|
||||||
drm_atomic_helper_commit_modeset_disables(dev, state);
|
drm_atomic_helper_commit_modeset_disables(dev, state);
|
||||||
|
|
||||||
vc4_ctm_commit(vc4, state);
|
vc4_ctm_commit(vc4, state);
|
||||||
|
|
Loading…
Reference in New Issue