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: mesa/mesa#2270
Fixes: 11a3679e "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 <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)
detached
Status Job ID Name Coverage
  Container
passed arm_build #1497111
aarch64

00:00:18

passed arm_test #1497113
aarch64

00:00:19

passed x86_build #1497106

00:00:21

passed x86_build_old #1497109

00:00:19

passed x86_test-gl #1497107

00:00:21

 
  Build
passed meson-arm64 #1497121
aarch64

00:02:26

passed meson-armhf #1497119
aarch64

00:02:40

passed meson-clang #1497123

00:08:11

passed meson-clover #1497129

00:07:29

passed meson-clover-old-llvm #1497131

00:08:18

passed meson-i386 #1497134

00:03:24

passed meson-main #1497117

00:07:34

passed meson-mingw32-x86_64 #1497136

00:04:17

passed meson-testing #1497115

00:06:00

passed meson-vulkan #1497133

00:04:04

passed scons #1497137

00:06:26

passed scons-old-llvm #1497139

00:03:52

passed scons-swr #1497125

00:07:19

passed scons-win64 #1497127

00:12:21

 
  Test
passed arm64_a306_gles2 #1497166
db410c

00:06:32

passed arm64_a630_gles2 #1497163
mesa-cheza

00:04:41

passed arm64_a630_gles3 #1497165
mesa-cheza

00:06:35

passed arm64_a630_gles31 #1497164
mesa-cheza

00:10:44

passed lima-mali450-test:arm64 #1497144
lava-meson-gxl-s905x-libretech-cc

00:09:46

passed panfrost-t720-test:arm64 #1497140
lava-sun50i-h6-pine-h64

00:08:16

passed panfrost-t760-test:armhf #1497142
lava-rk3288-veyron-jaq

00:05:52

passed panfrost-t860-test:arm64 #1497143
lava-rk3399-gru-kevin

00:07:57

passed piglit-glslparser #1497146

00:04:38

passed piglit-quick_gl #1497145

00:07:57

passed piglit-quick_shader #1497147

00:07:59

passed test-llvmpipe-gles2 #1497148

00:07:09

passed test-softpipe-gles2 #1497149

00:01:35

passed test-softpipe-gles31 1/4 #1497155

00:02:44

passed test-softpipe-gles3 1/2 #1497151

00:07:12

passed test-softpipe-gles31 2/4 #1497158

00:03:50

passed test-softpipe-gles31 3/4 #1497161

00:04:37

passed test-softpipe-gles31 4/4 #1497162

00:04:25

passed test-softpipe-gles3 2/2 #1497153

00:05:32