anv: use Mesa's u_atomic.h header
authorEric Engestrom <eric.engestrom@imgtec.com>
Mon, 26 Jun 2017 11:14:49 +0000 (12:14 +0100)
committerEric Engestrom <eric.engestrom@imgtec.com>
Mon, 26 Jun 2017 17:21:22 +0000 (18:21 +0100)
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/vulkan/anv_private.h

index e5d88f2815066c4a09057dff626789c6aff41c0d..8079378ae633779b99222dc01b505248e21f9216 100644 (file)
@@ -46,6 +46,7 @@
 #include "compiler/brw_compiler.h"
 #include "util/macros.h"
 #include "util/list.h"
+#include "util/u_atomic.h"
 #include "util/u_vector.h"
 #include "vk_alloc.h"
 
@@ -1862,14 +1863,14 @@ static inline void
 anv_shader_bin_ref(struct anv_shader_bin *shader)
 {
    assert(shader && shader->ref_cnt >= 1);
-   __sync_fetch_and_add(&shader->ref_cnt, 1);
+   p_atomic_inc(&shader->ref_cnt);
 }
 
 static inline void
 anv_shader_bin_unref(struct anv_device *device, struct anv_shader_bin *shader)
 {
    assert(shader && shader->ref_cnt >= 1);
-   if (__sync_fetch_and_add(&shader->ref_cnt, -1) == 1)
+   if (p_atomic_dec_zero(&shader->ref_cnt))
       anv_shader_bin_destroy(device, shader);
 }