From e09f327765902f3b7d31874ccf0f45b783299bc0 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Tue, 19 Feb 2019 09:39:43 +0000 Subject: [PATCH] freedreno: revert bad freedreno/atomic_ops commits This reverts 6d2379857b6fccc1cade "xf86atomic: #undef internal define" and b541d21a0a908bf98d44 "freedreno: remove always-defined #ifdef". I didn't realise at the time that freedreno/freedreno_ringbuffer.h gets installed, and then used by Mesa for instance. These two commits were fine in libdrm, but broke Mesa which needs to use struct fd_ringbuffer but doesn't need to access ::refcnt. The hack that I removed serves to keep the struct at the correct size while only exposing the ::refcnt member within libdrm. Fixes: 6d2379857b6fccc1cade "xf86atomic: #undef internal define" Fixes: b541d21a0a908bf98d44 "freedreno: remove always-defined #ifdef" Signed-off-by: Eric Engestrom --- freedreno/freedreno_ringbuffer.h | 3 ++- xf86atomic.h | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/freedreno/freedreno_ringbuffer.h b/freedreno/freedreno_ringbuffer.h index 1a1e8425..bc41a31c 100644 --- a/freedreno/freedreno_ringbuffer.h +++ b/freedreno/freedreno_ringbuffer.h @@ -29,7 +29,6 @@ #ifndef FREEDRENO_RINGBUFFER_H_ #define FREEDRENO_RINGBUFFER_H_ -#include #include /* the ringbuffer object is not opaque so that OUT_RING() type stuff @@ -84,7 +83,9 @@ struct fd_ringbuffer { * be inlined for performance reasons. */ union { +#ifdef HAS_ATOMIC_OPS atomic_t refcnt; +#endif uint64_t __pad; }; }; diff --git a/xf86atomic.h b/xf86atomic.h index e268d274..2d733bd5 100644 --- a/xf86atomic.h +++ b/xf86atomic.h @@ -101,8 +101,6 @@ typedef struct { LIBDRM_ATOMIC_TYPE atomic; } atomic_t; #error libdrm requires atomic operations, please define them for your CPU/compiler. #endif -#undef HAS_ATOMIC_OPS - static inline int atomic_add_unless(atomic_t *v, int add, int unless) { int c, old;