compiler/glsl: handle case where we have multiple users for types

Both Vulkan and OpenGL might be using glsl_types simultaneously or we
can also have multiple concurrent Vulkan instances using glsl_types.
Patch adds a one time init to track number of users and will release
types only when last user calls _glsl_type_singleton_decref().

This change fixes glsl_type memory leaks we have with anv driver.

v2: reuse hash_mutex, cleanup, apply fix also to radv driver and
    rename helper functions (Jason)

v3: move init, destroy to happen on GL context init and destroy

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
14 jobs for !453 with glsl-type-users in 14 minutes and 51 seconds (queued for 2 seconds)
detached
Status Job ID Name Coverage
  Containers Build
passed #240798
debian

00:02:48

 
  Build+Test
passed #240800
meson-clang

00:11:59

passed #240806
meson-gallium-clover-llvm

00:06:53

passed #240807
meson-gallium-clover-llvm39

00:04:35

passed #240805
meson-gallium-drivers-other

00:08:21

passed #240804
meson-gallium-radeonsi

00:04:38

passed #240808
meson-gallium-st-other

00:04:39

passed #240799
meson-gallium-swr

00:09:16

passed #240803
meson-glvnd

00:04:34

passed #240802
meson-loader-classic-dri

00:06:06

passed #240801
meson-vulkan

00:02:45

passed #240810
scons-llvm

00:03:36

passed #240809
scons-nollvm

00:05:58

passed #240811
scons-swr

00:08:23