Skip to content
  • Alex Goins's avatar
    xsync: Add resource inside of SyncCreate, export SyncCreate · 82f01ad7
    Alex Goins authored and Aaron Plattner's avatar Aaron Plattner committed
    
    
    As shown by DRI3 adding the SyncCreateFenceFromFD() function, extensions may
    want to create a fence, then initialize it in their own way. This currently
    can't be done without adding a function directly to Xext/sync.c due to the fact
    that the RTFence resource type is private and there is no external interface to
    add to it.
    
    To facilitate other X extensions creating fences and initializing them, this
    change exports SyncCreate() and adds the resource directly within it. Callers no
    longer need to call AddResource() after SyncCreate(), they only need to
    initialize the SyncObject.
    
    To prevent FreeFence() and FreeCounter() from segfaulting if the call to
    AddResource() fails before the sync object is initialized, this adds a new
    'initialized' parameter to SyncObject that, when FALSE, causes FreeFence() and
    FreeCounter() to skip de-initialization and simply free the object.
    Initialization after adding the resource shouldn't otherwise be a problem due to
    the single-threaded nature of X.
    
    Signed-off-by: default avatarAlex Goins <agoins@nvidia.com>
    Reviewed-by: default avatarJames Jones <jajones@nvidia.com>
    Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
    (cherry picked from commit 7f962c70)
    82f01ad7