winsys/amdgpu: Close KMS handles for other DRM file descriptions
authorMichel Dänzer <mdaenzer@redhat.com>
Tue, 28 Jan 2020 10:12:24 +0000 (11:12 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jan 2020 15:51:01 +0000 (15:51 +0000)
commitca6a22305b275b49fbc88b8f4cba2fefb24c2a5d
treef862de0d2fdca5d372499a90778e14abcf07cd8c
parent9f2bed49d476a15af0df270307f9051d810ea0ab
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>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3582>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3582>
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c