Skip to content
  • Derek Foreman's avatar
    shm: Add shm_buffer ref and shm_pool unref functions · eba83cd5
    Derek Foreman authored
    
    
    Sometimes the compositor wants to make sure a shm pool doesn't disappear
    out from under it.
    
    For example, in Enlightenment, rendering happens in a separate thread
    while the main thread can still dispatch events.  If a client is destroyed
    during rendering, all its resources are cleaned up and its shm pools are
    unmapped.  This causes the rendering thread to segfault.
    
    This patch adds a way for the compositor to increment the refcount of the
    shm pool so it can't disappear, and decrement it when it's finished.
    
    The ref/unref are asymmetrical (ref returns the pool) because it's
    possible the buffer itself will be gone when you need to unref the pool.
    
    Reviewed-by: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
    Signed-off-by: default avatarDerek Foreman <derekf@osg.samsung.com>
    eba83cd5