• Alex Goins's avatar
    randr/xf86: Add PRIME Synchronization / Double Buffer · 1bdbc7e7
    Alex Goins authored
    Changes PRIME to use double buffering and synchronization if all required
    driver functions are available.
    
    rrcrtc.c:
        Changes rrSetupPixmapSharing() to use double buffering and
        synchronization in the case that all required driver functions are
        available. Otherwise, falls back to unsynchronized single buffer.
    
        Changes RRCrtcDetachScanoutPixmap() to properly clean up in the case of
        double buffering.
    
        Moves StopPixmapTracking() from rrDestroySharedPixmap() to
        RRCrtcDetachScanoutPixmap().
    
        Changes RRReplaceScanoutPixmap() to fail if we are using double buffering,
        as it would need a second ppix parameter to function with double buffering,
        and AFAICT no driver I've implemented double buffered source support in uses
        RRReplaceScanoutPixmap().
    
    randrstr.h:
        Adds scanout_pixmap_back to struct _rrCrtc to facilitate PRIME
        double buffering.
    
    xf86Crtc.h:
        Adds current_scanout_back to _xf86Crtc to facilitate detection
        of changes to it in xf86RandR12CrtcSet().
    
    xf86RandR12.c:
        Changes xf86RandR12CrtcSet() to detect changes in
        scanout_pixmap_back.
    
        Adds scanout_pixmap_back to struct _rrCrtc to facilitate PRIME double
        buffering.
    
    v1: Initial commit
    v2: Rename PresentTrackedFlippingPixmap to PresentSharedPixmap
    v3: Refactor to accomodate moving (rr)StartFlippingPixmapTracking and
        (rr)(Enable/Disable)SharedPixmapFlipping to rrScrPrivRec from ScreenRec
        Add fallback if flipping funcs fail
    v4: Detach scanout pixmap when destroying scanout_pixmap_back, to avoid
        dangling pointers in some drivers
    v5: Disable RRReplaceScanoutPixmap for double-buffered PRIME, it would need an
        ABI change with support for 2 pixmaps if it were to be supported, but AFAICT
        no driver that actually supports double-buffered PRIME uses it.
        Refactor to use rrEnableSharedPixmapFlipping() as a substitute for
        rrCrtcSetScanoutPixmap() in the flipping case.
        Remove extraneous pSlaveScrPriv from DetachScanoutPixmap()
        Remove extraneous protopix and pScrPriv from rrSetupPixmapSharing()
    v6: Rebase onto ToT
    v7: Unchanged
    Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
    Signed-off-by: Alex Goins's avatarAlex Goins <agoins@nvidia.com>
    1bdbc7e7
xf86RandR12.c 60.9 KB