]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vc4: kms: Wait for the commit before increasing our clock rate
authorMaxime Ripard <maxime@cerno.tech>
Wed, 17 Nov 2021 09:45:22 +0000 (10:45 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 15 Dec 2021 11:10:50 +0000 (12:10 +0100)
commit9938b1ca0dcd598f6455ad40591a945e7b7a806b
treee60f8675fb62dbc0989650aa346c53c1b636ddd6
parent86cdba0589faccd19a9ba503010f1a3c1715ff59
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: f8ee023a91ff ("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 from f0318e5e95ca ("drm/vc4: kms: Wait for the
commit before increasing our clock rate") because I lost that part in
my merge resolution in 86cdba0589fa ("Merge v5.16-rc5 into drm-next")]
Fixes: 86cdba0589fa ("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
drivers/gpu/drm/vc4/vc4_kms.c