summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon/drm
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-03-05 12:32:06 +1100
committerTimothy Arceri <[email protected]>2017-03-07 08:53:05 +1100
commit628e84a58fdb26c63a705861b92f65f242613321 (patch)
treebd6084a4dee53a1f180c62f41e790ab490ddf3ee /src/gallium/winsys/radeon/drm
parentba72554f3e576c1674d52ab16d8d2edff9398b71 (diff)
gallium/util: replace pipe_mutex_unlock() with mtx_unlock()
pipe_mutex_unlock() was made unnecessary with fd33a6bcd7f12. Replaced using: find ./src -type f -exec sed -i -- \ 's:pipe_mutex_unlock(\([^)]*\)):mtx_unlock(\&\1):g' {} \; Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon/drm')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c54
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_cs.c2
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.c22
3 files changed, 39 insertions, 39 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index e302273d0ea..d4f4763c2f3 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -88,7 +88,7 @@ static bool radeon_bo_is_busy(struct radeon_bo *bo)
memmove(&bo->u.slab.fences[0], &bo->u.slab.fences[num_idle],
(bo->u.slab.num_fences - num_idle) * sizeof(bo->u.slab.fences[0]));
bo->u.slab.num_fences -= num_idle;
- pipe_mutex_unlock(bo->rws->bo_fence_lock);
+ mtx_unlock(&bo->rws->bo_fence_lock);
return busy;
}
@@ -111,7 +111,7 @@ static void radeon_bo_wait_idle(struct radeon_bo *bo)
while (bo->u.slab.num_fences) {
struct radeon_bo *fence = NULL;
radeon_bo_reference(&fence, bo->u.slab.fences[0]);
- pipe_mutex_unlock(bo->rws->bo_fence_lock);
+ mtx_unlock(&bo->rws->bo_fence_lock);
/* Wait without holding the fence lock. */
radeon_real_bo_wait_idle(fence);
@@ -125,7 +125,7 @@ static void radeon_bo_wait_idle(struct radeon_bo *bo)
}
radeon_bo_reference(&fence, NULL);
}
- pipe_mutex_unlock(bo->rws->bo_fence_lock);
+ mtx_unlock(&bo->rws->bo_fence_lock);
}
}
@@ -218,7 +218,7 @@ static uint64_t radeon_bomgr_find_va(struct radeon_drm_winsys *rws,
offset = hole->offset;
list_del(&hole->list);
FREE(hole);
- pipe_mutex_unlock(rws->bo_va_mutex);
+ mtx_unlock(&rws->bo_va_mutex);
return offset;
}
if ((hole->size - waste) > size) {
@@ -230,12 +230,12 @@ static uint64_t radeon_bomgr_find_va(struct radeon_drm_winsys *rws,
}
hole->size -= (size + waste);
hole->offset += size + waste;
- pipe_mutex_unlock(rws->bo_va_mutex);
+ mtx_unlock(&rws->bo_va_mutex);
return offset;
}
if ((hole->size - waste) == size) {
hole->size = waste;
- pipe_mutex_unlock(rws->bo_va_mutex);
+ mtx_unlock(&rws->bo_va_mutex);
return offset;
}
}
@@ -251,7 +251,7 @@ static uint64_t radeon_bomgr_find_va(struct radeon_drm_winsys *rws,
}
offset += waste;
rws->va_offset += size + waste;
- pipe_mutex_unlock(rws->bo_va_mutex);
+ mtx_unlock(&rws->bo_va_mutex);
return offset;
}
@@ -318,7 +318,7 @@ static void radeon_bomgr_free_va(struct radeon_drm_winsys *rws,
}
}
out:
- pipe_mutex_unlock(rws->bo_va_mutex);
+ mtx_unlock(&rws->bo_va_mutex);
}
void radeon_bo_destroy(struct pb_buffer *_buf)
@@ -337,7 +337,7 @@ void radeon_bo_destroy(struct pb_buffer *_buf)
util_hash_table_remove(rws->bo_names,
(void*)(uintptr_t)bo->flink_name);
}
- pipe_mutex_unlock(rws->bo_handles_mutex);
+ mtx_unlock(&rws->bo_handles_mutex);
if (bo->u.real.ptr)
os_munmap(bo->u.real.ptr, bo->base.size);
@@ -422,7 +422,7 @@ void *radeon_bo_do_map(struct radeon_bo *bo)
/* Return the pointer if it's already mapped. */
if (bo->u.real.ptr) {
bo->u.real.map_count++;
- pipe_mutex_unlock(bo->u.real.map_mutex);
+ mtx_unlock(&bo->u.real.map_mutex);
return (uint8_t*)bo->u.real.ptr + offset;
}
args.handle = bo->handle;
@@ -432,7 +432,7 @@ void *radeon_bo_do_map(struct radeon_bo *bo)
DRM_RADEON_GEM_MMAP,
&args,
sizeof(args))) {
- pipe_mutex_unlock(bo->u.real.map_mutex);
+ mtx_unlock(&bo->u.real.map_mutex);
fprintf(stderr, "radeon: gem_mmap failed: %p 0x%08X\n",
bo, bo->handle);
return NULL;
@@ -447,7 +447,7 @@ void *radeon_bo_do_map(struct radeon_bo *bo)
ptr = os_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED,
bo->rws->fd, args.addr_ptr);
if (ptr == MAP_FAILED) {
- pipe_mutex_unlock(bo->u.real.map_mutex);
+ mtx_unlock(&bo->u.real.map_mutex);
fprintf(stderr, "radeon: mmap failed, errno: %i\n", errno);
return NULL;
}
@@ -461,7 +461,7 @@ void *radeon_bo_do_map(struct radeon_bo *bo)
bo->rws->mapped_gtt += bo->base.size;
bo->rws->num_mapped_buffers++;
- pipe_mutex_unlock(bo->u.real.map_mutex);
+ mtx_unlock(&bo->u.real.map_mutex);
return (uint8_t*)bo->u.real.ptr + offset;
}
@@ -555,13 +555,13 @@ static void radeon_bo_unmap(struct pb_buffer *_buf)
mtx_lock(&bo->u.real.map_mutex);
if (!bo->u.real.ptr) {
- pipe_mutex_unlock(bo->u.real.map_mutex);
+ mtx_unlock(&bo->u.real.map_mutex);
return; /* it's not been mapped */
}
assert(bo->u.real.map_count);
if (--bo->u.real.map_count) {
- pipe_mutex_unlock(bo->u.real.map_mutex);
+ mtx_unlock(&bo->u.real.map_mutex);
return; /* it's been mapped multiple times */
}
@@ -574,7 +574,7 @@ static void radeon_bo_unmap(struct pb_buffer *_buf)
bo->rws->mapped_gtt -= bo->base.size;
bo->rws->num_mapped_buffers--;
- pipe_mutex_unlock(bo->u.real.map_mutex);
+ mtx_unlock(&bo->u.real.map_mutex);
}
static const struct pb_vtbl radeon_bo_vtbl = {
@@ -671,13 +671,13 @@ static struct radeon_bo *radeon_create_bo(struct radeon_drm_winsys *rws,
struct radeon_bo *old_bo =
util_hash_table_get(rws->bo_vas, (void*)(uintptr_t)va.offset);
- pipe_mutex_unlock(rws->bo_handles_mutex);
+ mtx_unlock(&rws->bo_handles_mutex);
pb_reference(&b, &old_bo->base);
return radeon_bo(b);
}
util_hash_table_set(rws->bo_vas, (void*)(uintptr_t)bo->va, bo);
- pipe_mutex_unlock(rws->bo_handles_mutex);
+ mtx_unlock(&rws->bo_handles_mutex);
}
if (initial_domains & RADEON_DOMAIN_VRAM)
@@ -1032,7 +1032,7 @@ no_slab:
mtx_lock(&ws->bo_handles_mutex);
util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
return &bo->base;
}
@@ -1080,7 +1080,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
if (ws->info.has_virtual_memory) {
struct drm_radeon_gem_va va;
@@ -1107,13 +1107,13 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
struct radeon_bo *old_bo =
util_hash_table_get(ws->bo_vas, (void*)(uintptr_t)va.offset);
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
pb_reference(&b, &old_bo->base);
return b;
}
util_hash_table_set(ws->bo_vas, (void*)(uintptr_t)bo->va, bo);
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
}
ws->allocated_gtt += align(bo->base.size, ws->info.gart_page_size);
@@ -1218,7 +1218,7 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
done:
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
if (stride)
*stride = whandle->stride;
@@ -1250,13 +1250,13 @@ done:
struct radeon_bo *old_bo =
util_hash_table_get(ws->bo_vas, (void*)(uintptr_t)va.offset);
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
pb_reference(&b, &old_bo->base);
return b;
}
util_hash_table_set(ws->bo_vas, (void*)(uintptr_t)bo->va, bo);
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
}
bo->initial_domain = radeon_bo_get_initial_domain((void*)bo);
@@ -1269,7 +1269,7 @@ done:
return (struct pb_buffer*)bo;
fail:
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
return NULL;
}
@@ -1303,7 +1303,7 @@ static bool radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
mtx_lock(&ws->bo_handles_mutex);
util_hash_table_set(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo);
- pipe_mutex_unlock(ws->bo_handles_mutex);
+ mtx_unlock(&ws->bo_handles_mutex);
}
whandle->handle = bo->flink_name;
} else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index 3f615f84343..d431bfc11f4 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -602,7 +602,7 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
p_atomic_inc(&bo->num_active_ioctls);
radeon_bo_slab_fence(bo, (struct radeon_bo *)fence);
}
- pipe_mutex_unlock(cs->ws->bo_fence_lock);
+ mtx_unlock(&cs->ws->bo_fence_lock);
radeon_fence_reference(&fence, NULL);
} else {
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 562d15e4c9a..2e7bfe90423 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -71,12 +71,12 @@ static bool radeon_set_fd_access(struct radeon_drm_cs *applier,
/* Early exit if we are sure the request will fail. */
if (enable) {
if (*owner) {
- pipe_mutex_unlock(*mutex);
+ mtx_unlock(&*mutex);
return false;
}
} else {
if (*owner != applier) {
- pipe_mutex_unlock(*mutex);
+ mtx_unlock(&*mutex);
return false;
}
}
@@ -86,7 +86,7 @@ static bool radeon_set_fd_access(struct radeon_drm_cs *applier,
info.request = request;
if (drmCommandWriteRead(applier->ws->fd, DRM_RADEON_INFO,
&info, sizeof(info)) != 0) {
- pipe_mutex_unlock(*mutex);
+ mtx_unlock(&*mutex);
return false;
}
@@ -94,14 +94,14 @@ static bool radeon_set_fd_access(struct radeon_drm_cs *applier,
if (enable) {
if (value) {
*owner = applier;
- pipe_mutex_unlock(*mutex);
+ mtx_unlock(&*mutex);
return true;
}
} else {
*owner = NULL;
}
- pipe_mutex_unlock(*mutex);
+ mtx_unlock(&*mutex);
return false;
}
@@ -715,7 +715,7 @@ static bool radeon_winsys_unref(struct radeon_winsys *ws)
if (destroy && fd_tab)
util_hash_table_remove(fd_tab, intptr_to_pointer(rws->fd));
- pipe_mutex_unlock(fd_tab_mutex);
+ mtx_unlock(&fd_tab_mutex);
return destroy;
}
@@ -744,13 +744,13 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
ws = util_hash_table_get(fd_tab, intptr_to_pointer(fd));
if (ws) {
pipe_reference(NULL, &ws->reference);
- pipe_mutex_unlock(fd_tab_mutex);
+ mtx_unlock(&fd_tab_mutex);
return &ws->base;
}
ws = CALLOC_STRUCT(radeon_drm_winsys);
if (!ws) {
- pipe_mutex_unlock(fd_tab_mutex);
+ mtx_unlock(&fd_tab_mutex);
return NULL;
}
@@ -830,7 +830,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
ws->base.screen = screen_create(&ws->base);
if (!ws->base.screen) {
radeon_winsys_destroy(&ws->base);
- pipe_mutex_unlock(fd_tab_mutex);
+ mtx_unlock(&fd_tab_mutex);
return NULL;
}
@@ -839,7 +839,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
/* We must unlock the mutex once the winsys is fully initialized, so that
* other threads attempting to create the winsys from the same fd will
* get a fully initialized winsys and not just half-way initialized. */
- pipe_mutex_unlock(fd_tab_mutex);
+ mtx_unlock(&fd_tab_mutex);
return &ws->base;
@@ -849,7 +849,7 @@ fail_slab:
fail_cache:
pb_cache_deinit(&ws->bo_cache);
fail1:
- pipe_mutex_unlock(fd_tab_mutex);
+ mtx_unlock(&fd_tab_mutex);
if (ws->surf_man)
radeon_surface_manager_free(ws->surf_man);
if (ws->fd >= 0)