• Maxime Ripard's avatar
    drm/vc4: kms: Sort the CRTCs by output before assigning them · e3479398
    Maxime Ripard authored
    On the vc4 devices (and later), the blending is done by a single device
    called the HVS. The HVS has three FIFO that can operate in parallel, and
    route their output to 6 CRTCs and 7 encoders on the BCM2711.
    
    Each of these CRTCs and encoders have some constraints on which FIFO
    they can feed from, so we need some code to take all those constraints
    into account and assign FIFOs to CRTCs.
    
    The problem can be simplified by assigning those FIFOs to CRTCs by
    ascending output index number. We had a comment mentioning it already,
    but we were never actually enforcing it.
    
    It was working still in most situations because the probe order is
    roughly equivalent, except for the (optional, and fairly rarely used on
    the Pi4) VEC which was last in the probe order sequence, but one of the
    earliest device to assign.
    
    This resulted in configurations that were rejected by our code but were
    still valid with a different assignment.
    
    We can fix this by making sure we assign CRTCs to FIFOs by ordering
    them by ascending HVS output index.
    
    Fixes: 87ebcd42
    
     ("drm/vc4: crtc: Assign output to channel automatically")
    Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
    Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221123-rpi-kunit-tests-v1-10-051a0bb60a16@cerno.tech
    e3479398
vc4_kms.c 29.8 KB