diff options
author | Chris Wilson | 2009-10-13 09:13:00 -0500 |
---|---|---|
committer | Chris Wilson | 2009-10-13 09:13:00 -0500 |
commit | 901bacd29cb5b242f68302b8384de6e193413a49 (patch) | |
tree | fe4d79398d1f986c81fabe85d93010cd5939646f /libdrm/intel/intel_atomic.h | |
parent | 24c905f84120a7b0bcd7c5e86c58e908b9e850f9 (diff) | |
download | external-libgbm-901bacd29cb5b242f68302b8384de6e193413a49.tar.gz external-libgbm-901bacd29cb5b242f68302b8384de6e193413a49.tar.xz external-libgbm-901bacd29cb5b242f68302b8384de6e193413a49.zip |
intel: Fallback to atomic-ops.h [libatomic-ops-dev]
Use the external implementation for atomic operations across a wide
range of architectures.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'libdrm/intel/intel_atomic.h')
-rw-r--r-- | libdrm/intel/intel_atomic.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libdrm/intel/intel_atomic.h b/libdrm/intel/intel_atomic.h index 9eb50a1e..e725c4a4 100644 --- a/libdrm/intel/intel_atomic.h +++ b/libdrm/intel/intel_atomic.h | |||
@@ -54,6 +54,23 @@ typedef struct { | |||
54 | 54 | ||
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #if HAVE_LIB_ATOMIC_OPS | ||
58 | #include <atomic_ops.h> | ||
59 | |||
60 | #define HAS_ATOMIC_OPS 1 | ||
61 | |||
62 | typedef struct { | ||
63 | AO_t atomic; | ||
64 | } atomic_t; | ||
65 | |||
66 | # define atomic_read(x) AO_load_full(&(x)->atomic) | ||
67 | # define atomic_set(x, val) AO_store_full(&(x)->atomic, (val)) | ||
68 | # define atomic_inc(x) ((void) AO_fetch_and_add1_full(&(x)->atomic)) | ||
69 | # define atomic_dec_and_test(x) (AO_fetch_and_sub1_full(&(x)->atomic) == 1) | ||
70 | # define atomic_cmpxchg(x, oldv, newv) AO_compare_and_swap_full(&(x)->atomic, oldv, newv) | ||
71 | |||
72 | #endif | ||
73 | |||
57 | #if ! HAS_ATOMIC_OPS | 74 | #if ! HAS_ATOMIC_OPS |
58 | #error libdrm-intel requires atomic operations, please define them for your CPU/compiler. | 75 | #error libdrm-intel requires atomic operations, please define them for your CPU/compiler. |
59 | #endif | 76 | #endif |