• Daniel Vetter's avatar
    drm/atomic-helper: implement ->page_flip · 8bc0f312
    Daniel Vetter authored
    Currently there is no way to implement async flips using atomic, that
    essentially requires us to be able to cancel pending requests
    mid-flight.
    
    To be able to do that (and I guess we want this since vblank synced
    updates which opportunistically cancel still pending updates seem to be
    wanted) we'd need to add a mandatory cancellation mode. Depending upon
    the exact semantics we decide upon that could mean that userspace will
    not get completion events, or will get them all stacked up.
    
    So reject async updates for now. Also async updates usually means not
    vblank synced at all, and I guess for drivers which want to support
    this they should simply add a special pageflip handler (since usually
    you need a special flip cmd to achieve this). That kind of async flip
    is pretty much exclusively just used for games and benchmarks where
    dropping just one frame means you'll get a headshot or something bad
    like that ... And so slight amounts of tearing is acceptable.
    
    v2: Fixup kerneldoc, reported by Paulo.
    
    v3: Use the set_crtc_for_plane function to assign the crtc, since
    otherwise the book-keeping is off.
    
    v4: Update crtc->primary->fb since ->page_flip is the only driver
    callback where the core won't do this itself. We might want to fix
    this inconsistency eventually.
    
    v5: Use set_crtc_for_connector as suggested by Sean.
    
    v6: Daniel Thompson noticed that my error handling is inconsistent
    and that in a few cases I didn't handle fatal errors (i.e. not
    -EDEADLK). Fix this by consolidate the ww mutex backoff handling
    into one check in the fail: block and flatten the error control
    flow everywhere else.
    
    v7: Fix spelling mistake in the commit message (Sean).
    
    Cc: Daniel Thompson <daniel.thompson@linaro.org>
    Cc: Sean Paul <seanpaul@chromium.org>
    Cc: Paulo Zanoni <przanoni@gmail.com>
    Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    8bc0f312
drm_atomic_helper.c 43.1 KB