Skip to content

Commit 0c980a0

Browse files
committed
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]> Link: https://lore.kernel.org/r/[email protected]
1 parent 42abd00 commit 0c980a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/vc4/vc4_kms.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,6 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
353353
vc4_hvs_mask_underrun(dev, vc4_crtc_state->assigned_channel);
354354
}
355355

356-
if (vc4->hvs->hvs5)
357-
clk_set_min_rate(hvs->core_clk, 500000000);
358-
359356
old_hvs_state = vc4_hvs_get_old_global_state(state);
360357
if (!old_hvs_state)
361358
return;
@@ -377,6 +374,9 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
377374
drm_err(dev, "Timed out waiting for commit\n");
378375
}
379376

377+
if (vc4->hvs->hvs5)
378+
clk_set_min_rate(hvs->core_clk, 500000000);
379+
380380
drm_atomic_helper_commit_modeset_disables(dev, state);
381381

382382
vc4_ctm_commit(vc4, state);

0 commit comments

Comments
 (0)