Mesa (master): gallium: Drop mutex-based pipe_atomic implementation.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Feb 3 19:37:01 UTC 2010


Module: Mesa
Branch: master
Commit: 7827bc73c79a506937b20ae834c89273bfb92c12
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7827bc73c79a506937b20ae834c89273bfb92c12

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Feb  1 14:23:36 2010 +0000

gallium: Drop mutex-based pipe_atomic implementation.

First step to severe the dependency in OS abstractions from the Gallium
interfaces.

---

 src/gallium/include/pipe/p_atomic.h |   83 +----------------------------------
 1 files changed, 1 insertions(+), 82 deletions(-)

diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h
index 0c3fbae..d505266 100644
--- a/src/gallium/include/pipe/p_atomic.h
+++ b/src/gallium/include/pipe/p_atomic.h
@@ -35,7 +35,7 @@ extern "C" {
 #elif defined(PIPE_CC_GCC)
 #define PIPE_ATOMIC_GCC_INTRINSIC
 #else
-#define PIPE_ATOMIC_MUTEX                       
+#error "Unsupported platform"
 #endif
 
 
@@ -259,87 +259,6 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
 
 
 
-#if defined(PIPE_ATOMIC_MUTEX)
-
-#define PIPE_ATOMIC "mutex-based fallback"
-
-#include "pipe/p_thread.h"
-
-/**
- * This implementation should really not be used.
- * Add an assembly port instead. It may abort and
- * doesn't destroy used mutexes.
- */
-
-struct pipe_atomic {
-   pipe_mutex mutex;
-   int32_t count;
-};
-
-static INLINE void
-p_atomic_set(struct pipe_atomic *v, int32_t i)
-{
-   pipe_mutex_init(v->mutex);
-   pipe_mutex_lock(v->mutex);
-   v->count = i;
-   pipe_mutex_unlock(v->mutex);
-}
-
-static INLINE int32_t
-p_atomic_read(struct pipe_atomic *v)
-{
-   int32_t ret;
-
-   pipe_mutex_lock(v->mutex);
-   ret = v->count;
-   pipe_mutex_unlock(v->mutex);
-   return ret;
-}
-
-static INLINE void
-p_atomic_inc(struct pipe_atomic *v)
-{
-   pipe_mutex_lock(v->mutex);
-   ++v->count;
-   pipe_mutex_unlock(v->mutex);
-}
-
-static INLINE void
-p_atomic_dec(struct pipe_atomic *v)
-{
-   pipe_mutex_lock(v->mutex);
-   --v->count;
-   pipe_mutex_unlock(v->mutex);
-}
-
-static INLINE boolean
-p_atomic_dec_zero(struct pipe_atomic *v)
-{
-   boolean ret;
-
-   pipe_mutex_lock(v->mutex);
-   ret = (--v->count == 0);
-   pipe_mutex_unlock(v->mutex);
-   return ret;
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
-{
-   int32_t ret;
-
-   pipe_mutex_lock(v->mutex);
-   ret = v->count;
-   if (ret == old)
-      v->count = _new;
-   pipe_mutex_unlock(v->mutex);
-
-   return ret;
-}
-
-#endif 
-
-
 #ifndef PIPE_ATOMIC
 #error "No pipe_atomic implementation selected"
 #endif




More information about the mesa-commit mailing list