gallium/util: replace pipe_mutex with mtx_t
authorTimothy Arceri <tarceri@itsqueeze.com>
Sun, 5 Mar 2017 01:32:01 +0000 (12:32 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 6 Mar 2017 21:48:11 +0000 (08:48 +1100)
pipe_mutex was made unnecessary with fd33a6bcd7f12.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
45 files changed:
src/gallium/auxiliary/os/os_thread.h
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
src/gallium/auxiliary/pipebuffer/pb_cache.h
src/gallium/auxiliary/pipebuffer/pb_slab.h
src/gallium/auxiliary/util/u_debug_flush.c
src/gallium/auxiliary/util/u_queue.h
src/gallium/auxiliary/util/u_range.h
src/gallium/auxiliary/util/u_ringbuffer.c
src/gallium/drivers/ddebug/dd_pipe.h
src/gallium/drivers/freedreno/freedreno_screen.h
src/gallium/drivers/llvmpipe/lp_fence.h
src/gallium/drivers/llvmpipe/lp_scene.h
src/gallium/drivers/llvmpipe/lp_screen.h
src/gallium/drivers/nouveau/nv50/nv50_surface.c
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
src/gallium/drivers/r300/r300_screen.h
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/rbug/rbug_context.h
src/gallium/drivers/rbug/rbug_screen.h
src/gallium/drivers/svga/svga_screen.h
src/gallium/drivers/svga/svga_screen_cache.h
src/gallium/drivers/vc4/vc4_screen.h
src/gallium/state_trackers/dri/dri_screen.h
src/gallium/state_trackers/glx/xlib/xm_api.h
src/gallium/state_trackers/hgl/hgl_context.h
src/gallium/state_trackers/nine/nine_queue.c
src/gallium/state_trackers/nine/nine_state.c
src/gallium/state_trackers/va/va_private.h
src/gallium/state_trackers/vdpau/vdpau_private.h
src/gallium/targets/haiku-softpipe/GalliumContext.h
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
src/gallium/winsys/radeon/drm/radeon_drm_bo.h
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
src/gallium/winsys/svga/drm/vmw_fence.c
src/gallium/winsys/svga/drm/vmw_surface.h
src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h

index 6eca2ca..af350b8 100644 (file)
@@ -108,12 +108,8 @@ static inline int pipe_thread_is_self( pipe_thread thread )
    return 0;
 }
 
-/* pipe_mutex
- */
-typedef mtx_t pipe_mutex;
-
 #define pipe_static_mutex(mutex) \
-   static pipe_mutex mutex = _MTX_INITIALIZER_NP
+   static mtx_t mutex = _MTX_INITIALIZER_NP
 
 #define pipe_mutex_init(mutex) \
    (void) mtx_init(&(mutex), mtx_plain)
@@ -131,11 +127,11 @@ typedef mtx_t pipe_mutex;
    __pipe_mutex_assert_locked(&(mutex))
 
 static inline void
-__pipe_mutex_assert_locked(pipe_mutex *mutex)
+__pipe_mutex_assert_locked(mtx_t *mutex)
 {
 #ifdef DEBUG
    /* NOTE: this would not work for recursive mutexes, but
-    * pipe_mutex doesn't support those
+    * mtx_t doesn't support those
     */
    int ret = mtx_trylock(mutex);
    assert(ret == thrd_busy);
@@ -179,7 +175,7 @@ typedef struct {
    unsigned count;
    unsigned waiters;
    uint64_t sequence;
-   pipe_mutex mutex;
+   mtx_t mutex;
    pipe_condvar condvar;
 } pipe_barrier;
 
@@ -231,7 +227,7 @@ static inline void pipe_barrier_wait(pipe_barrier *barrier)
 
 typedef struct
 {
-   pipe_mutex mutex;
+   mtx_t mutex;
    pipe_condvar cond;
    int counter;
 } pipe_semaphore;
index 7717d78..f5e761b 100644 (file)
@@ -81,7 +81,7 @@ struct fenced_manager
    /**
     * Following members are mutable and protected by this mutex.
     */
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    /**
     * Fenced buffer list.
index 4e36866..26ce603 100644 (file)
@@ -78,7 +78,7 @@ struct pb_debug_buffer
 
    struct debug_stack_frame create_backtrace[PB_DEBUG_CREATE_BACKTRACE];
 
-   pipe_mutex mutex;
+   mtx_t mutex;
    unsigned map_count;
    struct debug_stack_frame map_backtrace[PB_DEBUG_MAP_BACKTRACE];
    
@@ -95,7 +95,7 @@ struct pb_debug_manager
    pb_size underflow_size;
    pb_size overflow_size;
    
-   pipe_mutex mutex;
+   mtx_t mutex;
    struct list_head list;
 };
 
index 023a028..ef7e5ad 100644 (file)
@@ -53,7 +53,7 @@ struct mm_pb_manager
 {
    struct pb_manager base;
    
-   pipe_mutex mutex;
+   mtx_t mutex;
    
    pb_size size;
    struct mem_block *heap;
index 98877b4..3bfe720 100644 (file)
@@ -56,7 +56,7 @@ struct pool_pb_manager
 {
    struct pb_manager base;
    
-   pipe_mutex mutex;
+   mtx_t mutex;
    
    pb_size bufSize;
    pb_size bufAlign;
index cc42eea..54aba98 100644 (file)
@@ -128,7 +128,7 @@ struct pb_slab_manager
     */
    struct list_head slabs;
    
-   pipe_mutex mutex;
+   mtx_t mutex;
 };
 
 
index 7000fcd..d082eca 100644 (file)
@@ -52,7 +52,7 @@ struct pb_cache
     */
    struct list_head buckets[4];
 
-   pipe_mutex mutex;
+   mtx_t mutex;
    uint64_t cache_size;
    uint64_t max_cache_size;
    unsigned usecs;
index e779d95..78a4bf7 100644 (file)
@@ -110,7 +110,7 @@ typedef bool (slab_can_reclaim_fn)(void *priv, struct pb_slab_entry *);
  */
 struct pb_slabs
 {
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    unsigned min_order;
    unsigned num_orders;
index 52e72cd..6a8a91d 100644 (file)
@@ -53,7 +53,7 @@
 struct debug_flush_buf {
    /* Atomic */
    struct pipe_reference reference; /* Must be the first member. */
-   pipe_mutex mutex;
+   mtx_t mutex;
    /* Immutable */
    boolean supports_unsync;
    unsigned bt_depth;
index 2e0a5a3..8d4804f 100644 (file)
@@ -40,7 +40,7 @@
  * Put this into your job structure.
  */
 struct util_queue_fence {
-   pipe_mutex mutex;
+   mtx_t mutex;
    pipe_condvar cond;
    int signalled;
 };
@@ -57,7 +57,7 @@ struct util_queue_job {
 /* Put this into your context. */
 struct util_queue {
    const char *name;
-   pipe_mutex lock;
+   mtx_t lock;
    pipe_condvar has_queued_cond;
    pipe_condvar has_space_cond;
    pipe_thread *threads;
index a1da5e5..9055d7b 100644 (file)
@@ -43,7 +43,7 @@ struct util_range {
    unsigned end; /* exclusive */
 
    /* for the range to be consistent with multiple contexts: */
-   pipe_mutex write_mutex;
+   mtx_t write_mutex;
 };
 
 
index a97236f..19f82f5 100644 (file)
@@ -17,7 +17,7 @@ struct util_ringbuffer
    unsigned head;
    unsigned tail;
    pipe_condvar change;
-   pipe_mutex mutex;
+   mtx_t mutex;
 };
 
 
index 08cd1e3..dc7c325 100644 (file)
@@ -235,7 +235,7 @@ struct dd_context
     * the thread dumps the record of the oldest unsignalled fence.
     */
    pipe_thread thread;
-   pipe_mutex mutex;
+   mtx_t mutex;
    int kill_thread;
    struct pipe_resource *fence;
    struct pipe_transfer *fence_transfer;
index 087b07e..f2b1d8c 100644 (file)
@@ -44,7 +44,7 @@ struct fd_bo;
 struct fd_screen {
        struct pipe_screen base;
 
-       pipe_mutex lock;
+       mtx_t lock;
 
        /* it would be tempting to use pipe_reference here, but that
         * really doesn't work well if it isn't the first member of
index d7f0c15..4fc0801 100644 (file)
@@ -43,7 +43,7 @@ struct lp_fence
    struct pipe_reference reference;
    unsigned id;
 
-   pipe_mutex mutex;
+   mtx_t mutex;
    pipe_condvar signalled;
 
    boolean issued;
index b1464bb..da29057 100644 (file)
@@ -174,7 +174,7 @@ struct lp_scene {
    unsigned tiles_x, tiles_y;
 
    int curr_x, curr_y;  /**< for iterating over bins */
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    struct cmd_bin tile[TILES_X][TILES_Y];
    struct data_block_list data;
index 00bf20c..da702ad 100644 (file)
@@ -56,7 +56,7 @@ struct llvmpipe_screen
    unsigned timestamp;
 
    struct lp_rasterizer *rast;
-   pipe_mutex rast_mutex;
+   mtx_t rast_mutex;
 };
 
 
index f5fa9d6..01bf14b 100644 (file)
@@ -821,7 +821,7 @@ struct nv50_blitter
 
    struct nv50_tsc_entry sampler[2]; /* nearest, bilinear */
 
-   pipe_mutex mutex;
+   mtx_t mutex;
 };
 
 struct nv50_blitctx
index d567d82..96b2b5f 100644 (file)
@@ -772,7 +772,7 @@ struct nvc0_blitter
 
    struct nv50_tsc_entry sampler[2]; /* nearest, bilinear */
 
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    struct nvc0_screen *screen;
 };
index 4b783af..952dc34 100644 (file)
@@ -48,7 +48,7 @@ struct r300_screen {
 
     /* The MSAA texture with CMASK access; */
     struct pipe_resource *cmask_resource;
-    pipe_mutex cmask_mutex;
+    mtx_t cmask_mutex;
 };
 
 
index 55d2d0b..726dbb3 100644 (file)
@@ -381,7 +381,7 @@ struct r600_common_screen {
        /* Auxiliary context. Mainly used to initialize resources.
         * It must be locked prior to using and flushed before unlocking. */
        struct pipe_context             *aux_context;
-       pipe_mutex                      aux_context_lock;
+       mtx_t                           aux_context_lock;
 
        /* This must be in the screen, because UE4 uses one context for
         * compilation and another one for rendering.
@@ -394,7 +394,7 @@ struct r600_common_screen {
        unsigned                        num_shader_cache_hits;
 
        /* GPU load thread. */
-       pipe_mutex                      gpu_load_mutex;
+       mtx_t                           gpu_load_mutex;
        pipe_thread                     gpu_load_thread;
        union r600_mmio_counters        mmio_counters;
        volatile unsigned               gpu_load_stop_thread; /* bool */
index ec7cf30..617ec20 100644 (file)
@@ -84,7 +84,7 @@ struct si_screen {
        bool                            use_monolithic_shaders;
        bool                            record_llvm_ir;
 
-       pipe_mutex                      shader_parts_mutex;
+       mtx_t                   shader_parts_mutex;
        struct si_shader_part           *vs_prologs;
        struct si_shader_part           *vs_epilogs;
        struct si_shader_part           *tcs_epilogs;
@@ -104,7 +104,7 @@ struct si_screen {
         * - GS and CS aren't cached, but it's certainly possible to cache
         *   those as well.
         */
-       pipe_mutex                      shader_cache_mutex;
+       mtx_t                   shader_cache_mutex;
        struct hash_table               *shader_cache;
 
        /* Shader compiler queue for multithreaded compilation. */
index c38e7f5..17ffc5d 100644 (file)
@@ -278,7 +278,7 @@ struct si_shader_selector {
        struct util_queue_fence ready;
        struct si_compiler_ctx_state compiler_ctx_state;
 
-       pipe_mutex              mutex;
+       mtx_t           mutex;
        struct si_shader        *first_variant; /* immutable after the first variant */
        struct si_shader        *last_variant; /* mutable */
 
index e99f6ed..6f11fa4 100644 (file)
@@ -42,7 +42,7 @@ struct rbug_context {
    struct rbug_list list;
 
    /* call locking */
-   pipe_mutex call_mutex;
+   mtx_t call_mutex;
 
    /* current state */
    struct {
@@ -58,7 +58,7 @@ struct rbug_context {
    } curr;
 
    /* draw locking */
-   pipe_mutex draw_mutex;
+   mtx_t draw_mutex;
    pipe_condvar draw_cond;
    unsigned draw_num_rules;
    int draw_blocker;
@@ -74,7 +74,7 @@ struct rbug_context {
    } draw_rule;
 
    /* list of state objects */
-   pipe_mutex list_mutex;
+   mtx_t list_mutex;
    unsigned num_shaders;
    struct rbug_list shaders;
 };
index fd92374..67e2876 100644 (file)
@@ -49,7 +49,7 @@ struct rbug_screen
    /* remote debugger */
    struct rbug_rbug *rbug;
 
-   pipe_mutex list_mutex;
+   mtx_t list_mutex;
    int num_contexts;
    int num_resources;
    int num_surfaces;
index 6cafeba..68834a6 100644 (file)
@@ -66,9 +66,9 @@ struct svga_screen
    } debug;
 
    unsigned texture_timestamp;
-   pipe_mutex tex_mutex; 
+   mtx_t tex_mutex;
 
-   pipe_mutex swc_mutex; /* Used for buffer uploads */
+   mtx_t swc_mutex; /* Used for buffer uploads */
 
    /* which formats to translate depth formats into */
    struct {
index 619603a..2ade102 100644 (file)
@@ -105,7 +105,7 @@ struct svga_host_surface_cache_entry
  */
 struct svga_host_surface_cache 
 {
-   pipe_mutex mutex;
+   mtx_t mutex;
    
    /* Unused buffers are put in buckets to speed up lookups */
    struct list_head bucket[SVGA_HOST_SURFACE_CACHE_BUCKETS];
index 1f91ad3..54751ff 100644 (file)
@@ -77,14 +77,14 @@ struct vc4_screen {
                 struct list_head *size_list;
                 uint32_t size_list_size;
 
-                pipe_mutex lock;
+                mtx_t lock;
 
                 uint32_t bo_size;
                 uint32_t bo_count;
         } bo_cache;
 
         struct util_hash_table *bo_handles;
-        pipe_mutex bo_handles_mutex;
+        mtx_t bo_handles_mutex;
 
         uint32_t bo_size;
         uint32_t bo_count;
index dc4692a..7f5fd13 100644 (file)
@@ -89,7 +89,7 @@ struct dri_screen
    __DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle);
 
    /* OpenCL interop */
-   pipe_mutex opencl_func_mutex;
+   mtx_t opencl_func_mutex;
    opencl_dri_event_add_ref_t opencl_dri_event_add_ref;
    opencl_dri_event_release_t opencl_dri_event_release;
    opencl_dri_event_wait_t opencl_dri_event_wait;
index ccf35a5..06bf839 100644 (file)
@@ -76,7 +76,7 @@ typedef struct xmesa_visual *XMesaVisual;
 
 
 struct xmesa_display {
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    Display *display;
    struct pipe_screen *screen;
index d2ec7fb..5acb2f0 100644 (file)
@@ -74,7 +74,7 @@ struct hgl_context
        Bitmap* bitmap;
        color_space colorSpace;
 
-       pipe_mutex fbMutex;
+       mtx_t fbMutex;
 
        struct hgl_buffer* draw;
        struct hgl_buffer* read;
index b50b57b..4724b6b 100644 (file)
@@ -74,8 +74,8 @@ struct nine_queue_pool {
     BOOL worker_wait;
     pipe_condvar event_pop;
     pipe_condvar event_push;
-    pipe_mutex mutex_pop;
-    pipe_mutex mutex_push;
+    mtx_t mutex_pop;
+    mtx_t mutex_push;
 };
 
 /* Consumer functions: */
index 90c49cf..231e422 100644 (file)
@@ -64,13 +64,13 @@ struct csmt_context {
     struct nine_queue_pool* pool;
     BOOL terminate;
     pipe_condvar event_processed;
-    pipe_mutex mutex_processed;
+    mtx_t mutex_processed;
     struct NineDevice9 *device;
     BOOL processed;
     BOOL toPause;
     BOOL hasPaused;
-    pipe_mutex thread_running;
-    pipe_mutex thread_resume;
+    mtx_t thread_running;
+    mtx_t thread_resume;
 };
 
 /* Wait for instruction to be processed.
index a744461..a7cedae 100644 (file)
@@ -209,7 +209,7 @@ typedef struct {
    struct vl_compositor compositor;
    struct vl_compositor_state cstate;
    vl_csc_matrix csc;
-   pipe_mutex mutex;
+   mtx_t mutex;
 } vlVaDriver;
 
 typedef struct {
index cc20e5d..b36c0c4 100644 (file)
@@ -354,7 +354,7 @@ typedef struct
    struct pipe_context *context;
    struct vl_compositor compositor;
    struct pipe_sampler_view *dummy_sv;
-   pipe_mutex mutex;
+   mtx_t mutex;
 } vlVdpDevice;
 
 typedef struct
@@ -439,7 +439,7 @@ typedef struct
 typedef struct
 {
    vlVdpDevice *device;
-   pipe_mutex mutex;
+   mtx_t mutex;
    struct pipe_video_codec *decoder;
 } vlVdpDecoder;
 
index 22076cb..d8d75b9 100644 (file)
@@ -50,7 +50,7 @@ private:
                // Context Management
                struct hgl_context*     fContext[CONTEXT_MAX];
                context_id                      fCurrentContext;
-               pipe_mutex                      fMutex;
+               mtx_t                   fMutex;
 };
 
 
index b19d976..a5154ff 100644 (file)
@@ -52,7 +52,7 @@ struct amdgpu_winsys {
 
    amdgpu_device_handle dev;
 
-   pipe_mutex bo_fence_lock;
+   mtx_t bo_fence_lock;
 
    int num_cs; /* The number of command streams created. */
    unsigned num_total_rejected_cs;
@@ -79,7 +79,7 @@ struct amdgpu_winsys {
    bool check_vm;
 
    /* List of all allocated buffers */
-   pipe_mutex global_bo_list_lock;
+   mtx_t global_bo_list_lock;
    struct list_head global_bo_list;
    unsigned num_buffers;
 };
index 236e94c..d5fabab 100644 (file)
@@ -43,7 +43,7 @@ struct radeon_bo {
             struct pb_cache_entry cache_entry;
 
             void *ptr;
-            pipe_mutex map_mutex;
+            mtx_t map_mutex;
             unsigned map_count;
             bool use_reusable_pool;
         } real;
index a39a7be..6c6d920 100644 (file)
@@ -57,7 +57,7 @@ pipe_static_mutex(fd_tab_mutex);
  * 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,
-                                 pipe_mutex *mutex,
+                                 mtx_t *mutex,
                                  unsigned request, const char *request_name,
                                  bool enable)
 {
index 04659e4..362dab2 100644 (file)
@@ -78,9 +78,9 @@ struct radeon_drm_winsys {
     struct util_hash_table *bo_handles;
     /* List of buffer virtual memory ranges. Protectded by bo_handles_mutex. */
     struct util_hash_table *bo_vas;
-    pipe_mutex bo_handles_mutex;
-    pipe_mutex bo_va_mutex;
-    pipe_mutex bo_fence_lock;
+    mtx_t bo_handles_mutex;
+    mtx_t bo_va_mutex;
+    mtx_t bo_fence_lock;
 
     uint64_t va_offset;
     struct list_head va_holes;
@@ -91,9 +91,9 @@ struct radeon_drm_winsys {
     uint32_t num_cpus;      /* Number of CPUs. */
 
     struct radeon_drm_cs *hyperz_owner;
-    pipe_mutex hyperz_owner_mutex;
+    mtx_t hyperz_owner_mutex;
     struct radeon_drm_cs *cmask_owner;
-    pipe_mutex cmask_owner_mutex;
+    mtx_t cmask_owner_mutex;
 
     /* multithreaded command submission */
     struct util_queue cs_queue;
index d049d1d..4c5a121 100644 (file)
@@ -70,7 +70,7 @@ struct fenced_manager
    /**
     * Following members are mutable and protected by this mutex.
     */
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    /**
     * Fenced buffer list.
index bcf473a..0fbb078 100644 (file)
@@ -40,7 +40,7 @@ struct vmw_fence_ops
    struct pb_fence_ops base;
    struct vmw_winsys_screen *vws;
 
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    /*
     * Protected by mutex;
index f8b582d..baeef50 100644 (file)
@@ -57,7 +57,7 @@ struct vmw_svga_winsys_surface
    unsigned next_present_no;
    uint32_t present_fences[VMW_MAX_PRESENTS];
 
-   pipe_mutex mutex;
+   mtx_t mutex;
    struct svga_winsys_buffer *buf; /* Current backing guest buffer */
    uint32_t mapcount; /* Number of mappers */
    uint32_t map_mode; /* PIPE_TRANSFER_[READ|WRITE] */
index ffd7658..f677215 100644 (file)
@@ -59,11 +59,11 @@ struct virgl_drm_winsys
    struct list_head delayed;
    int num_delayed;
    unsigned usecs;
-   pipe_mutex mutex;
+   mtx_t mutex;
 
    struct util_hash_table *bo_handles;
    struct util_hash_table *bo_names;
-   pipe_mutex bo_handles_mutex;
+   mtx_t bo_handles_mutex;
 };
 
 struct virgl_drm_cmd_buf {
index b4faa70..031037b 100644 (file)
@@ -48,7 +48,7 @@ struct virgl_vtest_winsys {
    struct list_head delayed;
    int num_delayed;
    unsigned usecs;
-   pipe_mutex mutex;
+   mtx_t mutex;
 };
 
 struct virgl_hw_res {