This was made unnecessary with fd33a6bcd7f12. --- src/gallium/auxiliary/hud/hud_cpufreq.c | 2 +- src/gallium/auxiliary/hud/hud_diskstat.c | 2 +- src/gallium/auxiliary/hud/hud_nic.c | 2 +- src/gallium/auxiliary/hud/hud_sensors_temp.c | 2 +- src/gallium/auxiliary/os/os_thread.h | 3 --- src/gallium/auxiliary/rtasm/rtasm_execmem.c | 2 +- src/gallium/auxiliary/util/u_debug_flush.c | 2 +- src/gallium/auxiliary/util/u_debug_memory.c | 2 +- src/gallium/auxiliary/util/u_debug_refcnt.c | 2 +- src/gallium/auxiliary/util/u_debug_symbol.c | 2 +- src/gallium/auxiliary/util/u_queue.c | 2 +- src/gallium/drivers/trace/tr_dump.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- src/gallium/state_trackers/nine/nine_lock.c | 2 +- src/gallium/state_trackers/omx/entrypoint.c | 2 +- src/gallium/state_trackers/vdpau/htab.c | 2 +- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 2 +- src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c | 2 +- src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c | 2 +- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 +- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 2 +- src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 2 +- 22 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/src/gallium/auxiliary/hud/hud_cpufreq.c b/src/gallium/auxiliary/hud/hud_cpufreq.c index 78754b2..41e5827 100644 --- a/src/gallium/auxiliary/hud/hud_cpufreq.c +++ b/src/gallium/auxiliary/hud/hud_cpufreq.c @@ -55,21 +55,21 @@ struct cpufreq_info int cpu_index; /* EG. /sys/devices/system/cpu/cpu?/cpufreq/scaling_cur_freq */ char sysfs_filename[128]; uint64_t KHz; uint64_t last_time; }; static int gcpufreq_count = 0; static struct list_head gcpufreq_list; -pipe_static_mutex(gcpufreq_mutex); +static mtx_t gcpufreq_mutex = _MTX_INITIALIZER_NP; static struct cpufreq_info * find_cfi_by_index(int cpu_index, int mode) { list_for_each_entry(struct cpufreq_info, cfi, &gcpufreq_list, list) { if (cfi->mode != mode) continue; if (cfi->cpu_index == cpu_index) return cfi; } diff --git a/src/gallium/auxiliary/hud/hud_diskstat.c b/src/gallium/auxiliary/hud/hud_diskstat.c index af6e62d..fb64e3d 100644 --- a/src/gallium/auxiliary/hud/hud_diskstat.c +++ b/src/gallium/auxiliary/hud/hud_diskstat.c @@ -75,21 +75,21 @@ struct diskstat_info uint64_t last_time; struct stat_s last_stat; }; /* TODO: We don't handle dynamic block device / partition * arrival or removal. * Static globals specific to this HUD category. */ static int gdiskstat_count = 0; static struct list_head gdiskstat_list; -pipe_static_mutex(gdiskstat_mutex); +static mtx_t gdiskstat_mutex = _MTX_INITIALIZER_NP; static struct diskstat_info * find_dsi_by_name(const char *n, int mode) { list_for_each_entry(struct diskstat_info, dsi, &gdiskstat_list, list) { if (dsi->mode != mode) continue; if (strcasecmp(dsi->name, n) == 0) return dsi; } diff --git a/src/gallium/auxiliary/hud/hud_nic.c b/src/gallium/auxiliary/hud/hud_nic.c index 634add1..2fbeaa5 100644 --- a/src/gallium/auxiliary/hud/hud_nic.c +++ b/src/gallium/auxiliary/hud/hud_nic.c @@ -60,21 +60,21 @@ struct nic_info char throughput_filename[128]; uint64_t last_time; uint64_t last_nic_bytes; }; /* TODO: We don't handle dynamic NIC arrival or removal. * Static globals specific to this HUD category. */ static int gnic_count = 0; static struct list_head gnic_list; -pipe_static_mutex(gnic_mutex); +static mtx_t gnic_mutex = _MTX_INITIALIZER_NP; static struct nic_info * find_nic_by_name(const char *n, int mode) { list_for_each_entry(struct nic_info, nic, &gnic_list, list) { if (nic->mode != mode) continue; if (strcasecmp(nic->name, n) == 0) return nic; diff --git a/src/gallium/auxiliary/hud/hud_sensors_temp.c b/src/gallium/auxiliary/hud/hud_sensors_temp.c index 11b8a4c..4d723cc 100644 --- a/src/gallium/auxiliary/hud/hud_sensors_temp.c +++ b/src/gallium/auxiliary/hud/hud_sensors_temp.c @@ -43,21 +43,21 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <sensors/sensors.h> /* TODO: We don't handle dynamic sensor discovery / arrival or removal. * Static globals specific to this HUD category. */ static int gsensors_temp_count = 0; static struct list_head gsensors_temp_list; -pipe_static_mutex(gsensor_temp_mutex); +static mtx_t gsensor_temp_mutex = _MTX_INITIALIZER_NP; struct sensors_temp_info { struct list_head list; /* Combined chip and feature name, human readable. */ char name[64]; /* The type of measurement, critical or current. */ unsigned int mode; diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h index af350b8..a6a9fea 100644 --- a/src/gallium/auxiliary/os/os_thread.h +++ b/src/gallium/auxiliary/os/os_thread.h @@ -101,23 +101,20 @@ static inline int pipe_thread_is_self( pipe_thread thread ) { #if defined(HAVE_PTHREAD) # if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) return pthread_equal(pthread_self(), thread); # endif #endif return 0; } -#define pipe_static_mutex(mutex) \ - static mtx_t mutex = _MTX_INITIALIZER_NP - #define pipe_mutex_init(mutex) \ (void) mtx_init(&(mutex), mtx_plain) #define pipe_mutex_destroy(mutex) \ mtx_destroy(&(mutex)) #define pipe_mutex_lock(mutex) \ (void) mtx_lock(&(mutex)) #define pipe_mutex_unlock(mutex) \ diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index f7e605e..a60d521 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -56,21 +56,21 @@ * Allocate a large block of memory which can hold code then dole it out * in pieces by means of the generic memory manager code. */ #include <unistd.h> #include <sys/mman.h> #include "util/u_mm.h" #define EXEC_HEAP_SIZE (10*1024*1024) -pipe_static_mutex(exec_mutex); +static mtx_t exec_mutex = _MTX_INITIALIZER_NP; static struct mem_block *exec_heap = NULL; static unsigned char *exec_mem = NULL; static int init_heap(void) { if (!exec_heap) exec_heap = u_mmInit( 0, EXEC_HEAP_SIZE ); diff --git a/src/gallium/auxiliary/util/u_debug_flush.c b/src/gallium/auxiliary/util/u_debug_flush.c index 6a8a91d..d125205 100644 --- a/src/gallium/auxiliary/util/u_debug_flush.c +++ b/src/gallium/auxiliary/util/u_debug_flush.c @@ -70,21 +70,21 @@ struct debug_flush_item { }; struct debug_flush_ctx { /* Contexts are used by a single thread at a time */ unsigned bt_depth; boolean catch_map_of_referenced; struct util_hash_table *ref_hash; struct list_head head; }; -pipe_static_mutex(list_mutex); +static mtx_t list_mutex = _MTX_INITIALIZER_NP; static struct list_head ctx_list = {&ctx_list, &ctx_list}; static struct debug_stack_frame * debug_flush_capture_frame(int start, int depth) { struct debug_stack_frame *frames; frames = CALLOC(depth, sizeof(*frames)); if (!frames) return NULL; diff --git a/src/gallium/auxiliary/util/u_debug_memory.c b/src/gallium/auxiliary/util/u_debug_memory.c index f1cc8eb..2f7031d 100644 --- a/src/gallium/auxiliary/util/u_debug_memory.c +++ b/src/gallium/auxiliary/util/u_debug_memory.c @@ -80,21 +80,21 @@ struct debug_memory_header }; struct debug_memory_footer { unsigned magic; }; static struct list_head list = { &list, &list }; -pipe_static_mutex(list_mutex); +static mtx_t list_mutex = _MTX_INITIALIZER_NP; static unsigned long last_no = 0; static inline struct debug_memory_header * header_from_data(void *data) { if(data) return (struct debug_memory_header *)((char *)data - sizeof(struct debug_memory_header)); else diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c index 0a47864..eda95bb 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -45,21 +45,21 @@ #include "util/u_hash_table.h" #include "os/os_thread.h" int debug_refcnt_state; static FILE *stream; /* TODO: maybe move this serial machinery to a stand-alone module and * expose it? */ -pipe_static_mutex(serials_mutex); +static mtx_t serials_mutex = _MTX_INITIALIZER_NP; static struct util_hash_table *serials_hash; static unsigned serials_last; static unsigned hash_ptr(void *p) { return (unsigned) (uintptr_t) p; } diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c index 10efdd5..cfd354a 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -264,21 +264,21 @@ debug_symbol_name(const void *addr, char* buf, unsigned size) void debug_symbol_print(const void *addr) { char buf[1024]; debug_symbol_name(addr, buf, sizeof(buf)); debug_printf("\t%s\n", buf); } struct util_hash_table* symbols_hash; -pipe_static_mutex(symbols_mutex); +static mtx_t symbols_mutex = _MTX_INITIALIZER_NP; static unsigned hash_ptr(void* p) { return (unsigned)(uintptr_t)p; } static int compare_ptr(void* a, void* b) { if(a == b) return 0; diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c index c84e0ad..ca637ad 100644 --- a/src/gallium/auxiliary/util/u_queue.c +++ b/src/gallium/auxiliary/util/u_queue.c @@ -33,21 +33,21 @@ static void util_queue_killall_and_wait(struct util_queue *queue); /**************************************************************************** * Wait for all queues to assert idle when exit() is called. * * Otherwise, C++ static variable destructors can be called while threads * are using the static variables. */ static once_flag atexit_once_flag = ONCE_FLAG_INIT; static struct list_head queue_list; -pipe_static_mutex(exit_mutex); +static mtx_t exit_mutex = _MTX_INITIALIZER_NP; static void atexit_handler(void) { struct util_queue *iter; pipe_mutex_lock(exit_mutex); /* Wait for all queues to assert idle. */ LIST_FOR_EACH_ENTRY(iter, &queue_list, head) { util_queue_killall_and_wait(iter); diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 112a69e..b052e2a 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -52,21 +52,21 @@ #include "util/u_math.h" #include "util/u_format.h" #include "tr_dump.h" #include "tr_screen.h" #include "tr_texture.h" static boolean close_stream = FALSE; static FILE *stream = NULL; -pipe_static_mutex(call_mutex); +static mtx_t call_mutex = _MTX_INITIALIZER_NP; static long unsigned call_no = 0; static boolean dumping = FALSE; static inline void trace_dump_write(const char *buf, size_t size) { if (stream) { fwrite(buf, size, 1, stream); } diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 8d1b360..9297b68 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -182,21 +182,21 @@ xmesa_close_display(Display *display) * } */ free(xmdpy->smapi); XFree((char *) info); } static XMesaDisplay xmesa_init_display( Display *display ) { - pipe_static_mutex(init_mutex); + static mtx_t init_mutex = _MTX_INITIALIZER_NP; XMesaDisplay xmdpy; XMesaExtDisplayInfo *info; if (display == NULL) { return NULL; } pipe_mutex_lock(init_mutex); /* Look for XMesaDisplay which corresponds to this display */ diff --git a/src/gallium/state_trackers/nine/nine_lock.c b/src/gallium/state_trackers/nine/nine_lock.c index 1136dad..5b53559 100644 --- a/src/gallium/state_trackers/nine/nine_lock.c +++ b/src/gallium/state_trackers/nine/nine_lock.c @@ -41,21 +41,21 @@ #include "vertexshader9.h" #include "volume9.h" #include "volumetexture9.h" #include "d3d9.h" #include "nine_lock.h" #include "os/os_thread.h" /* Global mutex as described by MSDN */ -pipe_static_mutex(d3dlock_global); +static mtx_t d3dlock_global = _MTX_INITIALIZER_NP; void NineLockGlobalMutex() { pipe_mutex_lock(d3dlock_global); } void NineUnlockGlobalMutex() { diff --git a/src/gallium/state_trackers/omx/entrypoint.c b/src/gallium/state_trackers/omx/entrypoint.c index afcbd97..c12eb20 100644 --- a/src/gallium/state_trackers/omx/entrypoint.c +++ b/src/gallium/state_trackers/omx/entrypoint.c @@ -38,21 +38,21 @@ #include <X11/Xlib.h> #include "os/os_thread.h" #include "util/u_memory.h" #include "loader/loader.h" #include "entrypoint.h" #include "vid_dec.h" #include "vid_enc.h" -pipe_static_mutex(omx_lock); +static mtx_t omx_lock = _MTX_INITIALIZER_NP; static Display *omx_display = NULL; static struct vl_screen *omx_screen = NULL; static unsigned omx_usecount = 0; static const char *omx_render_node = NULL; static int drm_fd; int omx_component_library_Setup(stLoaderComponentType **stComponents) { OMX_ERRORTYPE r; diff --git a/src/gallium/state_trackers/vdpau/htab.c b/src/gallium/state_trackers/vdpau/htab.c index 1d7b3ff..277ea0c 100644 --- a/src/gallium/state_trackers/vdpau/htab.c +++ b/src/gallium/state_trackers/vdpau/htab.c @@ -23,21 +23,21 @@ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ #include "util/u_handle_table.h" #include "os/os_thread.h" #include "vdpau_private.h" static struct handle_table *htab = NULL; -pipe_static_mutex(htab_lock); +static mtx_t htab_lock = _MTX_INITIALIZER_NP; boolean vlCreateHTAB(void) { boolean ret; /* Make sure handle table handles match VDPAU handles. */ assert(sizeof(unsigned) <= sizeof(vlHandle)); pipe_mutex_lock(htab_lock); if (!htab) htab = handle_table_create(); diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index da9371d..546e3e6 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -57,21 +57,21 @@ #define CIK__PIPE_CONFIG__ADDR_SURF_P8_32x32_16x32 13 #define CIK__PIPE_CONFIG__ADDR_SURF_P8_32x64_32x32 14 #define CIK__PIPE_CONFIG__ADDR_SURF_P16_32X32_8X16 16 #define CIK__PIPE_CONFIG__ADDR_SURF_P16_32X32_16X16 17 #ifndef AMDGPU_INFO_NUM_EVICTIONS #define AMDGPU_INFO_NUM_EVICTIONS 0x18 #endif static struct util_hash_table *dev_tab = NULL; -pipe_static_mutex(dev_tab_mutex); +static mtx_t dev_tab_mutex = _MTX_INITIALIZER_NP; static unsigned cik_get_num_tile_pipes(struct amdgpu_gpu_info *info) { unsigned mode2d = info->gb_tile_mode[CIK_TILE_MODE_COLOR_2D]; switch (CIK__GB_TILE_MODE__PIPE_CONFIG(mode2d)) { case CIK__PIPE_CONFIG__ADDR_SURF_P2: return 2; case CIK__PIPE_CONFIG__ADDR_SURF_P4_8x16: case CIK__PIPE_CONFIG__ADDR_SURF_P4_16x16: diff --git a/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c b/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c index 3b34c30..141191f 100644 --- a/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c +++ b/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c @@ -62,21 +62,21 @@ screen_create(struct renderonly *ro) break; etna_gpu_del(gpu); } return etna_screen_create(dev, gpu, ro); } static struct util_hash_table *etna_tab = NULL; -pipe_static_mutex(etna_screen_mutex); +static mtx_t etna_screen_mutex = _MTX_INITIALIZER_NP; static void etna_drm_screen_destroy(struct pipe_screen *pscreen) { struct etna_screen *screen = etna_screen(pscreen); boolean destroy; pipe_mutex_lock(etna_screen_mutex); destroy = --screen->refcnt == 0; if (destroy) { diff --git a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c index e4785f8..9ccbce1 100644 --- a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c +++ b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c @@ -35,21 +35,21 @@ #include "util/u_inlines.h" #include "util/u_hash_table.h" #include "os/os_thread.h" #include "freedreno_drm_public.h" #include "freedreno/freedreno_screen.h" static struct util_hash_table *fd_tab = NULL; -pipe_static_mutex(fd_screen_mutex); +static mtx_t fd_screen_mutex = _MTX_INITIALIZER_NP; static void fd_drm_screen_destroy(struct pipe_screen *pscreen) { struct fd_screen *screen = fd_screen(pscreen); boolean destroy; pipe_mutex_lock(fd_screen_mutex); destroy = --screen->refcnt == 0; if (destroy) { diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c index cc9dfa7..f7b1e5e 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -12,21 +12,21 @@ #include "nouveau_drm_public.h" #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_screen.h" #include <nvif/class.h> #include <nvif/cl0080.h> static struct util_hash_table *fd_tab = NULL; -pipe_static_mutex(nouveau_screen_mutex); +static mtx_t nouveau_screen_mutex = _MTX_INITIALIZER_NP; bool nouveau_drm_screen_unref(struct nouveau_screen *screen) { int ret; if (screen->refcount == -1) return true; pipe_mutex_lock(nouveau_screen_mutex); ret = --screen->refcount; assert(ret >= 0); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 6c6d920..2726237 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -40,21 +40,21 @@ #include <xf86drm.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <radeon_surface.h> static struct util_hash_table *fd_tab = NULL; -pipe_static_mutex(fd_tab_mutex); +static mtx_t fd_tab_mutex = _MTX_INITIALIZER_NP; /* Enable/disable feature access for one command stream. * If enable == true, return true on success. * Otherwise, return false. * * We basically do the same thing kernel does, because we have to deal * with multiple contexts (here command streams) backed by one winsys. */ static bool radeon_set_fd_access(struct radeon_drm_cs *applier, struct radeon_drm_cs **owner, mtx_t *mutex, diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index 86e0470..7353873 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -799,21 +799,21 @@ virgl_drm_winsys_create(int drmFD) qdws->base.cs_create_fence = virgl_cs_create_fence; qdws->base.fence_wait = virgl_fence_wait; qdws->base.fence_reference = virgl_fence_reference; qdws->base.get_caps = virgl_drm_get_caps; return &qdws->base; } static struct util_hash_table *fd_tab = NULL; -pipe_static_mutex(virgl_screen_mutex); +static mtx_t virgl_screen_mutex = _MTX_INITIALIZER_NP; static void virgl_drm_screen_destroy(struct pipe_screen *pscreen) { struct virgl_screen *screen = virgl_screen(pscreen); boolean destroy; pipe_mutex_lock(virgl_screen_mutex); destroy = --screen->refcnt == 0; if (destroy) { -- 2.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev