[Mesa-dev] [PATCH 2/2] nouveau: use atomic operations for driver statistics
Ilia Mirkin
imirkin at alum.mit.edu
Sat Dec 8 17:53:49 UTC 2018
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Sat, Dec 8, 2018 at 12:10 PM Karol Herbst <kherbst at redhat.com> wrote:
>
> multiple threads can write to those at the same time
>
> Signed-off-by: Karol Herbst <kherbst at redhat.com>
> ---
> 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 7f16ee3f269..8b161af2964 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
> @@ -100,10 +101,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
> --
> 2.19.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list