Mesa (main): llvmpipe/fence: make the fence id counter atomic

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 10 04:05:34 UTC 2022


Module: Mesa
Branch: main
Commit: 3269d34b29a415e1f0f168ad5cffb0e3a36eeb49
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3269d34b29a415e1f0f168ad5cffb0e3a36eeb49

Author: Karol Herbst <kherbst at redhat.com>
Date:   Sun Apr  3 12:47:58 2022 +0200

llvmpipe/fence: make the fence id counter atomic

Multiple threads can race on the function static variable

Signed-off-by: Karol Herbst <kherbst at redhat.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16348>

---

 src/gallium/drivers/llvmpipe/lp_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c
index 00cd79d6ba6..7fb24d39046 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.c
+++ b/src/gallium/drivers/llvmpipe/lp_fence.c
@@ -44,7 +44,7 @@
 struct lp_fence *
 lp_fence_create(unsigned rank)
 {
-   static int fence_id;
+   static _Atomic int fence_id;
    struct lp_fence *fence = CALLOC_STRUCT(lp_fence);
 
    if (!fence)



More information about the mesa-commit mailing list