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.

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

Closes: mesa/mesa#2270
Fixes: 11a3679e "winsys/amdgpu: Make KMS handles valid for original
                     DRM file descriptor"

Reviewed-by: Pierre-Eric Pelloux-Prayer <>
Reviewed-by: Marek Olšák <>
Tested-by: Marge Bot <mesa/mesa!3582>
Part-of: <mesa/mesa!3582>
38 jobs for !3582 with winsys-amdgpu-same_file_description-proper-fd in 26 minutes and 30 seconds (queued for 13 seconds)
merge request