]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vc4: kms: Store the unassigned channel list in the state
authorMaxime Ripard <maxime@cerno.tech>
Fri, 20 Nov 2020 14:42:44 +0000 (15:42 +0100)
committerMaxime Ripard <maxime@cerno.tech>
Mon, 23 Nov 2020 16:59:23 +0000 (17:59 +0100)
commit222ea8fe157d32f8acc671e9f3519b337d56d862
tree56bac36b1c90847f04ce35bc73b0cb3d01b89ab7
parentb8a3f3ec769a229e494579c4c24eaf22ec5629de
drm/vc4: kms: Store the unassigned channel list in the state

If a CRTC is enabled but not active, and that we're then doing a page
flip on another CRTC, drm_atomic_get_crtc_state will bring the first
CRTC state into the global state, and will make us wait for its vblank
as well, even though that might never occur.

Instead of creating the list of the free channels each time atomic_check
is called, and calling drm_atomic_get_crtc_state to retrieve the
allocated channels, let's create a private state object in the main
atomic state, and use it to store the available channels.

Since vc4 has a semaphore (with a value of 1, so a lock) in its commit
implementation to serialize all the commits, even the nonblocking ones, we
are free from the use-after-free race if two subsequent commits are not ran
in their submission order.

Fixes: 4a7a3c9d39ea ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Reviewed-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120144245.398711-2-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_kms.c