Gallium OSMesa driver is far from being thread-safe
Submitted by Frederic Devernay
Assigned to mes..@..op.org
Description
see src/gallium/state_trackers/osmesa/osmesa.c
There are at least three global variables with no protection:
- stapi in get_st_api()
- stmgr in get_st_manager()
- BufferList
Consequently:
- OSMesaCreateContext cannot be called simultaneously from two threads
- OSMesaMakeCurrent called from two threads with the same buffer attribs will share the same element in BufferList, and thus render to the same memory!
My guess is that these two objects should simply be stored in the context itself, but I cannot foresee the consequences.
For example, will shared display lists still work?
I am willing to help on solving this (we use OSMesa in highly multithreaded application).
Version: 11.2