Skip to content
  • Mathias Fröhlich's avatar
    mesa: Use atomics for buffer objects reference counts. · 2313c33e
    Mathias Fröhlich authored
    
    
    The mutex is currently used for reference counting and updating
    the minmax index cache.
    The change uses atomics directly for reference counting and
    the mutex for the minmax cache.
    This is safe since the reference count is not modified beside
    in _mesa_reference_buffer_object where atomics aim to be used.
    While using the minmax cache, the calling code holds a reference
    to the buffer object. Thus unreferencing or even referencing the
    buffer object does not need to be serialized with accessing
    the minmax cache.
    The change reduces the time _mesa_reference_buffer_object_ takes
    by about a factor of two when looking at perf results for some
    of my favorite use cases.
    
    Signed-off-by: default avatarMathias Fröhlich <Mathias.Froehlich@web.de>
    Reviewed-by: default avatarBrian Paul <brianp@vmware.com>
    2313c33e