Skip to content

Commit 244a36e

Browse files
mriparddanvet
authored andcommitted
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: d7d96c0 ("drm/vc4: hvs: Boost the core clock during modeset") Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Tested-by: Jian-Hong Pan <[email protected]> [danvet: re-apply this from 0c980a0 ("drm/vc4: kms: Wait for the commit before increasing our clock rate") because I lost that part in my merge resolution in 99b03ca ("Merge v5.16-rc5 into drm-next")] Fixes: 99b03ca ("Merge v5.16-rc5 into drm-next") Acked-by: Maxime Ripard <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 99b03ca commit 244a36e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/gpu/drm/vc4/vc4_kms.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,6 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
365365
vc4_hvs_mask_underrun(dev, vc4_crtc_state->assigned_channel);
366366
}
367367

368-
if (vc4->hvs->hvs5) {
369-
unsigned long core_rate = max_t(unsigned long,
370-
500000000,
371-
new_hvs_state->core_clock_rate);
372-
373-
clk_set_min_rate(hvs->core_clk, core_rate);
374-
}
375-
376368
for (channel = 0; channel < HVS_NUM_CHANNELS; channel++) {
377369
struct drm_crtc_commit *commit;
378370
int ret;
@@ -392,6 +384,13 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
392384
old_hvs_state->fifo_state[channel].pending_commit = NULL;
393385
}
394386

387+
if (vc4->hvs->hvs5) {
388+
unsigned long core_rate = max_t(unsigned long,
389+
500000000,
390+
new_hvs_state->core_clock_rate);
391+
392+
clk_set_min_rate(hvs->core_clk, core_rate);
393+
}
395394
drm_atomic_helper_commit_modeset_disables(dev, state);
396395

397396
vc4_ctm_commit(vc4, state);

0 commit comments

Comments
 (0)