summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/amdgpu/drm
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2021-05-07 09:17:12 -0400
committerMarge Bot <eric+marge@anholt.net>2021-05-25 16:15:44 +0000
commit66c8e40d698a9eec0c5eb4f554c3ef4cd7f11608 (patch)
tree750e45f63dc8c35409d77a355e10b944b34da05a /src/gallium/winsys/amdgpu/drm
parent4602147561e5684988a1a28527d7aea90d4a10b7 (diff)
winsys/amdgpu: don't hold a mutex while accessing is_shared
It adds overhead to amdgpu_bo_wait and I'm not sure whether the mutex is even needed. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10813>
Diffstat (limited to 'src/gallium/winsys/amdgpu/drm')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 6cadfaa4313..0642b3a5cb5 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -67,14 +67,7 @@ static bool amdgpu_bo_wait(struct radeon_winsys *rws,
return false;
}
- bool is_shared = false;
- if (bo->bo) {
- simple_mtx_lock(&bo->lock);
- is_shared = bo->u.real.is_shared;
- simple_mtx_unlock(&bo->lock);
- }
-
- if (is_shared) {
+ if (bo->bo && bo->u.real.is_shared) {
/* We can't use user fences for shared buffers, because user fences
* are local to this process only. If we want to wait for all buffer
* uses in all processes, we have to use amdgpu_bo_wait_for_idle.
@@ -1651,11 +1644,7 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
if (sws->fd == ws->fd) {
whandle->handle = bo->u.real.kms_handle;
- simple_mtx_lock(&bo->lock);
- bool is_shared = bo->u.real.is_shared;
- simple_mtx_unlock(&bo->lock);
-
- if (is_shared)
+ if (bo->u.real.is_shared)
return true;
goto hash_table_set;
@@ -1701,9 +1690,7 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
_mesa_hash_table_insert(ws->bo_export_table, bo->bo, bo);
simple_mtx_unlock(&ws->bo_export_table_lock);
- simple_mtx_lock(&bo->lock);
bo->u.real.is_shared = true;
- simple_mtx_unlock(&bo->lock);
return true;
}