[Mesa-dev] [PATCH 0/6] st/mesa: add locking around lazy texture/sampler updates

Nicolai Hähnle nhaehnle at gmail.com
Fri Oct 6 20:38:10 UTC 2017


Hi all,

This series is a first result of debugging some random crashes in dEQP's
multi-threaded EGL tests.

The OpenGL spec is pretty clear that application must not modify a texture
in one context while simultaneously using it for texturing (or even
modifying) it in another context. Texturing simultaneously in multiple
contexts is fine, though.

This can lead to races when st_finalize_texture is called simultaneously
for two contexts, or if two contexts simultaneously attempt to access the
sampler view array of a texture.

This series should fix most (all?) issues where our internal data
structures could become corrupted. I am aware of one remaining corner
case that could lead to rendering corruption. It appears rather non-trivial
to fix, and it is documented in a comment of patch #5.

Please review!
Thanks,
Nicolai
--
 src/gallium/auxiliary/util/u_inlines.h   |  16 ++-
 src/gallium/include/pipe/p_context.h     |  10 ++
 src/mesa/state_tracker/st_atom_sampler.c |  12 +-
 src/mesa/state_tracker/st_atom_texture.c |  12 --
 src/mesa/state_tracker/st_cb_texture.c   |  59 +++++++--
 src/mesa/state_tracker/st_manager.c      |   3 +
 src/mesa/state_tracker/st_sampler_view.c | 137 +++++++++++++++++----
 src/mesa/state_tracker/st_sampler_view.h |   7 ++
 src/mesa/state_tracker/st_texture.h      |  23 +++-
 9 files changed, 205 insertions(+), 74 deletions(-)



More information about the mesa-dev mailing list