mesa/shaderobj: Fix races on refcounts
authorChad Versace <chadversary@chromium.org>
Tue, 27 Dec 2016 22:26:24 +0000 (14:26 -0800)
committerChad Versace <chadversary@chromium.org>
Wed, 28 Dec 2016 19:10:43 +0000 (11:10 -0800)
commit464b23b1f289e8f9ede7c9d817c1678bbef0ad8d
tree90e13b0f32234a49d2d0345264dce1f4ba5aca1a
parentec01ef2db187bfb2af4ce264c2f3ed24bbf005b4
mesa/shaderobj: Fix races on refcounts

Use atomic ops when updating gl_shader::RefCount.

Fixes intermittent failures and crashes in
'dEQP-EGL.functional.sharing.gles2.multithread.*'.
All tests in that group now pass except
'dEQP-EGL.functional.sharing.gles2.multithread.simple_egl_server_sync.textures.copyteximage2d_texsubimage2d_render'.

Tested with:
  mesa: branch 'master' at d6545f2
  deqp: branch 'nougat-cts-dev' at 4acf725 with additional local fixes
  DEQP_TARGET: x11_egl
  hw: Intel Broadwell 0x1616

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99085
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: Mark Janes <mark.a.janes@intel.com>
Cc: Haixia Shi <hshi@chromium.org>
src/mesa/main/shaderobj.c