I'm pretty sure that p_atomic_dec_zero should return 1 if the count drops to 
zero.

Cc: "10.2 10.1 10.0" <mesa-sta...@lists.freedesktop.org>
Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com>
---
diff --git a/src/gallium/auxiliary/util/u_atomic.h 
b/src/gallium/auxiliary/util/u_atomic.h
index 2f2b42b..08cadb4 100644
--- a/src/gallium/auxiliary/util/u_atomic.h
+++ b/src/gallium/auxiliary/util/u_atomic.h
@@ -183,7 +183,7 @@ p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
#define p_atomic_set(_v, _i) (*(_v) = (_i))
 #define p_atomic_read(_v) (*(_v))
-#define p_atomic_dec_zero(_v) ((boolean) --(*(_v)))
+#define p_atomic_dec_zero(_v) (!(boolean) --(*(_v)))
 #define p_atomic_inc(_v) ((void) (*(_v))++)
 #define p_atomic_dec(_v) ((void) (*(_v))--)
 #define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v))
@@ -324,7 +324,7 @@ p_atomic_dec_zero(int32_t *v)
 {
    uint32_t n = atomic_dec_32_nv((uint32_t *) v);
- return n != 0;
+   return n == 0;
 }
#define p_atomic_inc(_v) atomic_inc_32((uint32_t *) _v)

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to