summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
authorKarol Herbst <kherbst@redhat.com>2018-12-07 20:10:50 +0100
committerKarol Herbst <kherbst@redhat.com>2018-12-09 04:43:20 +0100
commitd63a13308229b5c5a08358ccacdac83272596c78 (patch)
tree1ce648be07942ec03cf35e4b164dc2d0010d695b /src/gallium/drivers/nouveau
parenta28ff2229513d68ae39e2ea927d21b327a356348 (diff)
nouveau: use atomic operations for driver statistics
multiple threads can write to those at the same time Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 9273d52c1de..b714f0a2aa9 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -3,6 +3,7 @@
#include "pipe/p_screen.h"
#include "util/disk_cache.h"
+#include "util/u_atomic.h"
#include "util/u_memory.h"
#ifdef DEBUG
@@ -106,10 +107,10 @@ struct nouveau_screen {
#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
# define NOUVEAU_DRV_STAT(s, n, v) do { \
- (s)->stats.named.n += (v); \
+ p_atomic_add(&(s)->stats.named.n, (v)); \
} while(0)
-# define NOUVEAU_DRV_STAT_RES(r, n, v) do { \
- nouveau_screen((r)->base.screen)->stats.named.n += (v); \
+# define NOUVEAU_DRV_STAT_RES(r, n, v) do { \
+ p_atomic_add(&nouveau_screen((r)->base.screen)->stats.named.n, v); \
} while(0)
# define NOUVEAU_DRV_STAT_IFD(x) x
#else