From: Axel Davy Date: Wed, 26 Oct 2016 21:15:34 +0000 (+0200) Subject: st/nine: Use atomics for nine_bind X-Git-Tag: upstream/17.1.0~3774 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a5252d25b3e65c29c3c231cec46fed8ca7dedb0;p=platform%2Fupstream%2Fmesa.git st/nine: Use atomics for nine_bind nine_bind didn't need atomics up to now, because it's use what always within a protected mutex. We need to use atomics because with the next patches several threads may use nine_bind. Signed-off-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/iunknown.h b/src/gallium/state_trackers/nine/iunknown.h index 63b16bd..d357aad 100644 --- a/src/gallium/state_trackers/nine/iunknown.h +++ b/src/gallium/state_trackers/nine/iunknown.h @@ -25,6 +25,7 @@ #include "pipe/p_compiler.h" +#include "util/u_atomic.h" #include "util/u_memory.h" #include "guid.h" @@ -127,7 +128,7 @@ NineUnknown_Destroy( struct NineUnknown *This ) static inline UINT NineUnknown_Bind( struct NineUnknown *This ) { - UINT b = ++This->bind; + UINT b = p_atomic_inc_return(&This->bind); assert(b); if (b == 1 && This->container) { if (This->container != NineUnknown(This->device)) @@ -139,7 +140,7 @@ NineUnknown_Bind( struct NineUnknown *This ) static inline UINT NineUnknown_Unbind( struct NineUnknown *This ) { - UINT b = --This->bind; + UINT b = p_atomic_dec_return(&This->bind); if (!b) { if (This->container) { if (This->container != NineUnknown(This->device))