dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] Add atomic_inc_return to atomics.
@ 2015-02-26 10:54 Maarten Lankhorst
       [not found] ` <1424948044-32228-1-git-send-email-maarten.lankhorst-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
  2015-02-27 13:46 ` [Nouveau] [PATCH v2 1/4] Add atomic_inc_return to atomics Emil Velikov
  0 siblings, 2 replies; 5+ messages in thread
From: Maarten Lankhorst @ 2015-02-26 10:54 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Maarten Lankhorst

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
---
 xf86atomic.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xf86atomic.h b/xf86atomic.h
index 8c4b696..17fb088 100644
--- a/xf86atomic.h
+++ b/xf86atomic.h
@@ -49,6 +49,7 @@ typedef struct {
 # define atomic_read(x) ((x)->atomic)
 # define atomic_set(x, val) ((x)->atomic = (val))
 # define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1))
+# define atomic_inc_return(x) (__sync_add_and_fetch (&(x)->atomic, 1))
 # define atomic_dec_and_test(x) (__sync_fetch_and_add (&(x)->atomic, -1) == 1)
 # define atomic_add(x, v) ((void) __sync_add_and_fetch(&(x)->atomic, (v)))
 # define atomic_dec(x, v) ((void) __sync_sub_and_fetch(&(x)->atomic, (v)))
@@ -68,6 +69,7 @@ typedef struct {
 # define atomic_read(x) AO_load_full(&(x)->atomic)
 # define atomic_set(x, val) AO_store_full(&(x)->atomic, (val))
 # define atomic_inc(x) ((void) AO_fetch_and_add1_full(&(x)->atomic))
+# define atomic_inc_return(x) (AO_fetch_and_add1_full(&(x)->atomic) + 1)
 # define atomic_add(x, v) ((void) AO_fetch_and_add_full(&(x)->atomic, (v)))
 # define atomic_dec(x, v) ((void) AO_fetch_and_add_full(&(x)->atomic, -(v)))
 # define atomic_dec_and_test(x) (AO_fetch_and_sub1_full(&(x)->atomic) == 1)
@@ -91,6 +93,7 @@ typedef struct { LIBDRM_ATOMIC_TYPE atomic; } atomic_t;
 # define atomic_read(x) (int) ((x)->atomic)
 # define atomic_set(x, val) ((x)->atomic = (LIBDRM_ATOMIC_TYPE)(val))
 # define atomic_inc(x) (atomic_inc_uint (&(x)->atomic))
+# define atomic_inc_return (atomic_inc_uint_nv(&(x)->atomic))
 # define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 0)
 # define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v)))
 # define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v)))
-- 
2.3.0

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-27 13:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-26 10:54 [PATCH v2 1/4] Add atomic_inc_return to atomics Maarten Lankhorst
     [not found] ` <1424948044-32228-1-git-send-email-maarten.lankhorst-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
2015-02-26 10:54   ` [PATCH v2 2/4] Use __sync_add_and_fetch instead of __sync_fetch_and_add for atomic_dec_and_test Maarten Lankhorst
2015-02-26 10:54   ` [PATCH v2 3/4] nouveau: make nouveau importing global buffers completely thread-safe, with tests Maarten Lankhorst
2015-02-26 10:54   ` [PATCH v2 4/4] nouveau: Do not add most bo's to the global bo list Maarten Lankhorst
2015-02-27 13:46 ` [Nouveau] [PATCH v2 1/4] Add atomic_inc_return to atomics Emil Velikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox