winsys/amdgpu: Close KMS handles for other DRM file descriptions
authorMichel Dänzer <mdaenzer@redhat.com>
Mon, 23 Dec 2019 17:59:10 +0000 (18:59 +0100)
committerMichel Dänzer <michel@daenzer.net>
Thu, 23 Jan 2020 16:39:34 +0000 (17:39 +0100)
commit552028c013cc1d49a2b61ebe0fc3a3781a9ba826
tree2ae067440a65326a70b9b9f096934e33b00ca2ad
parentb60f5cbc15a99ddd9251bce40eae7d84c3a1c373
winsys/amdgpu: Close KMS handles for other DRM file descriptions

When a BO or amdgpu_screen_winsys is destroyed.

Should fix leaking such BOs in other DRM file descriptions.

v2:
* Pass the correct file descriptor to drmIoctl (Pierre-Eric
  Pelloux-Prayer)
* Use _mesa_hash_table_remove
v3:
* Close handles in amdgpu_winsys_unref as well
v4:
* Adapt to amdgpu_winsys::sws_list_lock.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2270
Fixes: 11a3679e3aba "winsys/amdgpu: Make KMS handles valid for original
                     DRM file descriptor"

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3202>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3202>
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c