Mesa (master): nouveau: use atomic operations for driver statistics
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Dec 9 16:21:05 UTC 2018
Module: Mesa
Branch: master
Commit: d63a13308229b5c5a08358ccacdac83272596c78
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d63a13308229b5c5a08358ccacdac83272596c78
Author: Karol Herbst <kherbst at redhat.com>
Date: Fri Dec 7 20:10:50 2018 +0100
nouveau: use atomic operations for driver statistics
multiple threads can write to those at the same time
Signed-off-by: Karol Herbst <kherbst at redhat.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
src/gallium/drivers/nouveau/nouveau_screen.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 9273d52c1d..b714f0a2aa 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
More information about the mesa-commit
mailing list