Skip to content

Commit 089d834

Browse files
committed
drm/vc4: hvs: Pull the state of all the CRTCs prior to PV muxing
The vc4 display engine has a first controller called the HVS that will perform the composition of the planes. That HVS has 3 FIFOs and can therefore compose planes for up to three outputs. The timings part is generated through a component called the Pixel Valve, and the BCM2711 has 6 of them. Thus, the HVS has some bits to control which FIFO gets output to which Pixel Valve. The current code supports that muxing by looking at all the CRTCs in a new DRM atomic state in atomic_check, and given the set of constraints that we have, assigns FIFOs to CRTCs or reject the mode entirely. The actual muxing will occur during atomic_commit. However, that doesn't work if only a fraction of the CRTCs' state is updated in that state, since it will ignore the CRTCs that are kept running unmodified, and will thus unassign its associated FIFO, and later disable it. In order to make the code work as expected, let's pull the CRTC state of all the enabled CRTC in our atomic_check so that we can operate on all the running CRTCs, no matter whether they are affected by the new state or not. Fixes: 87ebcd4 ("drm/vc4: crtc: Assign output to channel automatically") Signed-off-by: Maxime Ripard <[email protected]> Tested-by: Hoegeun Kwon <[email protected]> Tested-by: Dave Stevenson <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Reviewed-by: Hoegeun Kwon <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 92fdb97 commit 089d834

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/gpu/drm/vc4/vc4_kms.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,23 @@ vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
620620
struct drm_crtc *crtc;
621621
int i, ret;
622622

623+
/*
624+
* Since the HVS FIFOs are shared across all the pixelvalves and
625+
* the TXP (and thus all the CRTCs), we need to pull the current
626+
* state of all the enabled CRTCs so that an update to a single
627+
* CRTC still keeps the previous FIFOs enabled and assigned to
628+
* the same CRTCs, instead of evaluating only the CRTC being
629+
* modified.
630+
*/
631+
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
632+
if (!crtc->state->enable)
633+
continue;
634+
635+
crtc_state = drm_atomic_get_crtc_state(state, crtc);
636+
if (IS_ERR(crtc_state))
637+
return PTR_ERR(crtc_state);
638+
}
639+
623640
for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
624641
struct vc4_crtc_state *vc4_crtc_state =
625642
to_vc4_crtc_state(crtc_state);

0 commit comments

Comments
 (0)