From: Marek Olšák Date: Mon, 27 Jan 2020 22:40:32 +0000 (-0500) Subject: Revert "winsys/amdgpu: Close KMS handles for other DRM file descriptions" X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba06c7620f3eac333b58542bf01e1586d6346a61;p=mesa.git Revert "winsys/amdgpu: Close KMS handles for other DRM file descriptions" This reverts commit 552028c013cc1d49a2b61ebe0fc3a3781a9ba826. Required by the next reverted commit. --- diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 5fe1a837929..e6a5a7773e0 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -183,21 +183,10 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf) simple_mtx_unlock(&ws->global_bo_list_lock); } - /* Close all KMS handles retrieved for other DRM file descriptions */ simple_mtx_lock(&ws->sws_list_lock); for (sws_iter = ws->sws_list; sws_iter; sws_iter = sws_iter->next) { - struct hash_entry *entry; - - if (!sws_iter->kms_handles) - continue; - - entry = _mesa_hash_table_search(sws_iter->kms_handles, bo); - if (entry) { - struct drm_gem_close args = { .handle = (uintptr_t)entry->data }; - - drmIoctl(sws_iter->fd, DRM_IOCTL_GEM_CLOSE, &args); - _mesa_hash_table_remove(sws_iter->kms_handles, entry); - } + if (sws_iter->kms_handles) + _mesa_hash_table_remove_key(sws_iter->kms_handles, bo); } simple_mtx_unlock(&ws->sws_list_lock); diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index 13a4b3ab7f1..8fadf584e3f 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -304,15 +304,8 @@ static bool amdgpu_winsys_unref(struct radeon_winsys *rws) simple_mtx_unlock(&aws->sws_list_lock); - if (ret && sws->kms_handles) { - struct drm_gem_close args; - - hash_table_foreach(sws->kms_handles, entry) { - args.handle = (uintptr_t)entry->data; - drmIoctl(sws->fd, DRM_IOCTL_GEM_CLOSE, &args); - } + if (ret && sws->kms_handles) _mesa_hash_table_destroy(sws->kms_handles, NULL); - } return ret; }