diff options
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe.c | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_shaders.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/i965/brw_winsys.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_blend_logicop.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_dump_state.c | 2 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_atomic.h | 121 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_refcnt.h | 52 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_state.h | 7 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_state.h | 2 | ||||
-rw-r--r-- | src/gallium/winsys/drm/intel/gem/intel_drm_fence.c | 2 | ||||
-rw-r--r-- | src/gallium/winsys/drm/vmware/core/vmw_surface.h | 4 |
16 files changed, 67 insertions, 134 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 11d6485dcf0..83dc1a35f4c 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -32,6 +32,7 @@ #include "draw/draw_private.h" #include "draw/draw_pipe.h" +#include "util/u_debug.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 0ae46785bbe..60a1cb1af4f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -33,6 +33,7 @@ #include "tgsi/tgsi_info.h" #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_sanity.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "util/u_math.h" diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index e25f35c6dc3..6198ca34642 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -30,6 +30,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_shader_tokens.h" +#include "util/u_debug.h" #ifdef __cplusplus extern "C" { diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 53f0de42151..72a4d6d5083 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -30,7 +30,10 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" +#include "pipe/p_state.h" #include "pipe/p_screen.h" +#include "util/u_debug.h" +#include "pipe/p_atomic.h" #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index b751e29ab62..019dda767d0 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -38,6 +38,7 @@ #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" #include "util/u_simple_shaders.h" +#include "util/u_debug.h" #include "tgsi/tgsi_ureg.h" diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h index 1c63f03429e..8841de2611e 100644 --- a/src/gallium/drivers/i965/brw_winsys.h +++ b/src/gallium/drivers/i965/brw_winsys.h @@ -28,7 +28,6 @@ #include "pipe/p_compiler.h" #include "pipe/p_defines.h" -#include "pipe/p_refcnt.h" #include "util/u_inlines.h" struct brw_winsys; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c index ad1dbbc9b19..0215bb72ac6 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c @@ -44,6 +44,7 @@ #include "pipe/p_state.h" +#include "util/u_debug.h" #include "lp_bld_type.h" #include "lp_bld_const.h" diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_logicop.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_logicop.c index 88321f62a2c..1eac0a5c891 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_blend_logicop.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_logicop.c @@ -35,6 +35,7 @@ #include "pipe/p_state.h" +#include "util/u_debug.h" #include "lp_bld_blend.h" diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c index a73d1158e79..6d5a45db7a3 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c @@ -69,6 +69,7 @@ #include "pipe/p_state.h" +#include "util/u_debug.h" #include "lp_bld_type.h" #include "lp_bld_arit.h" diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index dbca5de0a52..c7364e2bd1d 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -49,7 +49,7 @@ static void trace_dump_reference(const struct pipe_reference *reference) return; trace_dump_struct_begin("pipe_reference"); - trace_dump_member(int, &reference->count, count); + trace_dump_member(int, reference, count); trace_dump_struct_end(); } diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h index a4b769d0bf5..c0a0ac0edb3 100644 --- a/src/gallium/include/pipe/p_atomic.h +++ b/src/gallium/include/pipe/p_atomic.h @@ -44,41 +44,37 @@ extern "C" { #define PIPE_ATOMIC "GCC x86 assembly" -struct pipe_atomic { - int32_t count; -}; - -#define p_atomic_set(_v, _i) ((_v)->count = (_i)) -#define p_atomic_read(_v) ((_v)->count) +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) static INLINE boolean -p_atomic_dec_zero(struct pipe_atomic *v) +p_atomic_dec_zero(int32_t *v) { unsigned char c; - __asm__ __volatile__("lock; decl %0; sete %1":"+m"(v->count), "=qm"(c) + __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c) ::"memory"); return c != 0; } static INLINE void -p_atomic_inc(struct pipe_atomic *v) +p_atomic_inc(int32_t *v) { - __asm__ __volatile__("lock; incl %0":"+m"(v->count)); + __asm__ __volatile__("lock; incl %0":"+m"(*v)); } static INLINE void -p_atomic_dec(struct pipe_atomic *v) +p_atomic_dec(int32_t *v) { - __asm__ __volatile__("lock; decl %0":"+m"(v->count)); + __asm__ __volatile__("lock; decl %0":"+m"(*v)); } static INLINE int32_t -p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) +p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { - return __sync_val_compare_and_swap(&v->count, old, _new); + return __sync_val_compare_and_swap(v, old, _new); } #endif @@ -90,36 +86,32 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) #define PIPE_ATOMIC "GCC Sync Intrinsics" -struct pipe_atomic { - int32_t count; -}; - -#define p_atomic_set(_v, _i) ((_v)->count = (_i)) -#define p_atomic_read(_v) ((_v)->count) +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) static INLINE boolean -p_atomic_dec_zero(struct pipe_atomic *v) +p_atomic_dec_zero(int32_t *v) { - return (__sync_sub_and_fetch(&v->count, 1) == 0); + return (__sync_sub_and_fetch(v, 1) == 0); } static INLINE void -p_atomic_inc(struct pipe_atomic *v) +p_atomic_inc(int32_t *v) { - (void) __sync_add_and_fetch(&v->count, 1); + (void) __sync_add_and_fetch(v, 1); } static INLINE void -p_atomic_dec(struct pipe_atomic *v) +p_atomic_dec(int32_t *v) { - (void) __sync_sub_and_fetch(&v->count, 1); + (void) __sync_sub_and_fetch(v, 1); } static INLINE int32_t -p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) +p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { - return __sync_val_compare_and_swap(&v->count, old, _new); + return __sync_val_compare_and_swap(v, old, _new); } #endif @@ -132,17 +124,12 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) #define PIPE_ATOMIC "Unlocked" -struct pipe_atomic -{ - int32_t count; -}; - -#define p_atomic_set(_v, _i) ((_v)->count = (_i)) -#define p_atomic_read(_v) ((_v)->count) -#define p_atomic_dec_zero(_v) ((boolean) --(_v)->count) -#define p_atomic_inc(_v) ((void) (_v)->count++) -#define p_atomic_dec(_v) ((void) (_v)->count--) -#define p_atomic_cmpxchg(_v, old, _new) ((_v)->count == old ? (_v)->count = (_new) : (_v)->count) +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) +#define p_atomic_dec_zero(_v) ((boolean) --(*(_v))) +#define p_atomic_inc(_v) ((void) (*(_v))++) +#define p_atomic_dec(_v) ((void) (*(_v))--) +#define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v)) #endif @@ -153,22 +140,16 @@ struct pipe_atomic #define PIPE_ATOMIC "MSVC x86 assembly" -struct pipe_atomic -{ - int32_t count; -}; - -#define p_atomic_set(_v, _i) ((_v)->count = (_i)) -#define p_atomic_read(_v) ((_v)->count) +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) static INLINE boolean -p_atomic_dec_zero(struct pipe_atomic *v) +p_atomic_dec_zero(int32_t *v) { - int32_t *pcount = &v->count; unsigned char c; __asm { - mov eax, [pcount] + mov eax, [v] lock dec dword ptr [eax] sete byte ptr [c] } @@ -177,35 +158,30 @@ p_atomic_dec_zero(struct pipe_atomic *v) } static INLINE void -p_atomic_inc(struct pipe_atomic *v) +p_atomic_inc(int32_t *v) { - int32_t *pcount = &v->count; - __asm { - mov eax, [pcount] + mov eax, [v] lock inc dword ptr [eax] } } static INLINE void -p_atomic_dec(struct pipe_atomic *v) +p_atomic_dec(int32_t *v) { - int32_t *pcount = &v->count; - __asm { - mov eax, [pcount] + mov eax, [v] lock dec dword ptr [eax] } } static INLINE int32_t -p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) +p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { - int32_t *pcount = &v->count; int32_t orig; __asm { - mov ecx, [pcount] + mov ecx, [v] mov eax, [old] mov edx, [_new] lock cmpxchg [ecx], edx @@ -221,42 +197,37 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) #define PIPE_ATOMIC "MSVC Intrinsics" -struct pipe_atomic -{ - int32_t count; -}; - #include <intrin.h> #pragma intrinsic(_InterlockedIncrement) #pragma intrinsic(_InterlockedDecrement) #pragma intrinsic(_InterlockedCompareExchange) -#define p_atomic_set(_v, _i) ((_v)->count = (_i)) -#define p_atomic_read(_v) ((_v)->count) +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) static INLINE boolean -p_atomic_dec_zero(struct pipe_atomic *v) +p_atomic_dec_zero(int32_t *v) { - return _InterlockedDecrement(&v->count) == 0; + return _InterlockedDecrement(v) == 0; } static INLINE void -p_atomic_inc(struct pipe_atomic *v) +p_atomic_inc(int32_t *v) { - _InterlockedIncrement(&v->count); + _InterlockedIncrement(v); } static INLINE void -p_atomic_dec(struct pipe_atomic *v) +p_atomic_dec(int32_t *v) { - _InterlockedDecrement(&v->count); + _InterlockedDecrement(v); } static INLINE int32_t -p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) +p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { - return _InterlockedCompareExchange(&v->count, _new, old); + return _InterlockedCompareExchange(v, _new, old); } #endif diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h deleted file mode 100644 index 6609f94510a..00000000000 --- a/src/gallium/include/pipe/p_refcnt.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef P_REFCNT_H -#define P_REFCNT_H - - -#include "p_defines.h" -#include "p_atomic.h" -#include "util/u_debug.h" /* FIXME: remove this */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -struct pipe_reference -{ - struct pipe_atomic count; -}; - - -#ifdef __cplusplus -} -#endif - -#endif /* P_REFCNT_H */ diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index f293df57334..9ae096ee3cf 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -43,7 +43,6 @@ #include "p_compiler.h" #include "p_defines.h" #include "p_format.h" -#include "p_refcnt.h" #include "p_screen.h" @@ -66,6 +65,12 @@ extern "C" { #define PIPE_MAX_TEXTURE_LEVELS 16 +struct pipe_reference +{ + int32_t count; /* atomic */ +}; + + /** * The driver will certainly subclass this to include actual memory * management information. diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 842860f74bd..77e22d0a566 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -33,7 +33,7 @@ #include <pipe/p_defines.h> #include <pipe/p_format.h> -#include <pipe/p_refcnt.h> +#include <pipe/p_state.h> #include <pipe/p_screen.h> #include <util/u_inlines.h> diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c b/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c index e8b58742ab7..e7622766b82 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c @@ -1,7 +1,7 @@ #include "intel_drm_winsys.h" #include "util/u_memory.h" -#include "pipe/p_refcnt.h" +#include "pipe/p_atomic.h" /** * Because gem does not have fence's we have to create our own fences. diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.h b/src/gallium/winsys/drm/vmware/core/vmw_surface.h index 340cc1532e0..718c38767b3 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_surface.h +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.h @@ -37,7 +37,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_atomic.h" -#include "pipe/p_refcnt.h" +#include "pipe/p_atomic.h" #define VMW_MAX_PRESENTS 3 @@ -45,7 +45,7 @@ struct vmw_svga_winsys_surface { - struct pipe_atomic validated; + int32_t validated; /* atomic */ struct pipe_reference refcnt; struct vmw_winsys_screen *screen; |