• Lyude Paul's avatar
    drm/display/dp_mst: Add nonblocking helpers for DP MST · a5c2c0d1
    Lyude Paul authored
    As Daniel Vetter pointed out, if we only use the atomic modesetting locks
    with MST it's technically possible for a driver with non-blocking modesets
    to race when it comes to MST displays - as we make the mistake of not doing
    our own CRTC commit tracking in the topology_state object.
    
    This could potentially cause problems if something like this happens:
    
    * User starts non-blocking commit to disable CRTC-1 on MST topology 1
    * User starts non-blocking commit to enable CRTC-2 on MST topology 1
    
    There's no guarantee here that the commit for disabling CRTC-2 will only
    occur after CRTC-1 has finished, since neither commit shares a CRTC - only
    the private modesetting object for MST. Keep in mind this likely isn't a
    problem for blocking modesets, only non-blocking.
    
    So, begin fixing this by keeping track of which CRTCs on a topology have
    changed by keeping track of which CRTCs we release or allocate timeslots
    on. As well, add some helpers for:
    
    * Setting up the drm_crtc_commit structs in the ->commit_setup hook
    * Waiting for any CRTC dependencies from the previous topology state
    
    v2:
    * Use drm_dp_mst_atomic_setup_commit() directly - Jani
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    Cc: Wayne Lin <Wayne.Lin@amd.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: Imre Deak <imre.deak@intel.com>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Cc: Sean Paul <sean@poorly.run>
    Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-9-lyude@redhat.com
    a5c2c0d1
disp.c 80.6 KB