freedreno/drm: Make rb refcnt non-atomic
authorRob Clark <robdclark@chromium.org>
Sat, 11 Feb 2023 15:52:42 +0000 (07:52 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 16 Feb 2023 19:57:13 +0000 (19:57 +0000)
Now that the one special case where multiple threads could race to
ref/unref, we can go back to using non-atomic refcnts.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21274>

src/freedreno/drm/freedreno_ringbuffer.h

index 7acb70c..3c2be70 100644 (file)
@@ -165,7 +165,7 @@ unref(int32_t *ref)
 static inline void
 fd_ringbuffer_del(struct fd_ringbuffer *ring)
 {
-   if (!unref(&ring->refcnt))
+   if (--ring->refcnt > 0)
       return;
 
    ring->funcs->destroy(ring);
@@ -174,7 +174,7 @@ fd_ringbuffer_del(struct fd_ringbuffer *ring)
 static inline struct fd_ringbuffer *
 fd_ringbuffer_ref(struct fd_ringbuffer *ring)
 {
-   ref(&ring->refcnt);
+   ring->refcnt++;
    return ring;
 }