Skip to content
Commit 10151fdf authored by Maxime Ripard's avatar Maxime Ripard Committed by Phil Elwell
Browse files

drm/vc4: Wait for the commit before starting our clock request



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_requests and
will remove the old requests and start a new one. We also need another,
temporary, request for the duration of the commit.

The algorithm is thus to start a temporary request, drop the previous
one, do the commit, start a new request for the current mode, and
finally drop the temporary request.

However, the part that takes a temporary request and drops the older one
runs before the commit synchronization code.

Thus, under the proper conditions, we can end up dropping twice the old
request, resulting in an use-after-free.

To avoid it, let's move the clock setup in the protected section.

Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
parent 2d01bc8f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment