vulkan/util: call glsl_type_singleton_init_or_ref from vk_instance_init

v2: link libvulkan_util with libglsl so it can find the glsl singleton symbols.
v3: link with libcompiler instead of libglsl (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> for the v3dv bits.
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> for the turnip bits.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> for the radv bits.
Acked-by: Dave Airlie <airlied@redhat.com> for the lvp bits.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9457>
This commit is contained in:
Iago Toral Quiroga 2021-03-08 08:26:28 +01:00
parent 164a51c80f
commit 1e4abf1fe3
8 changed files with 7 additions and 25 deletions

View file

@ -53,7 +53,6 @@ typedef void* drmDevicePtr;
#include "util/mesa-sha1.h"
#include "util/timespec.h"
#include "util/u_atomic.h"
#include "compiler/glsl_types.h"
#include "util/driconf.h"
/* The number of IBs per submit isn't infinite, it depends on the ring type
@ -982,8 +981,6 @@ VkResult radv_CreateInstance(
instance->physical_devices_enumerated = false;
list_inithead(&instance->physical_devices);
glsl_type_singleton_init_or_ref();
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
radv_init_dri_options(instance);
@ -1010,8 +1007,6 @@ void radv_DestroyInstance(
VG(VALGRIND_DESTROY_MEMPOOL(instance));
glsl_type_singleton_decref();
driDestroyOptionCache(&instance->dri_options);
driDestroyOptionInfo(&instance->available_dri_options);

View file

@ -125,8 +125,6 @@ libvulkan_broadcom = shared_library(
link_with : [
libbroadcom_cle,
libbroadcom_v3d,
# For glsl_type_singleton_init_or_ref:
libglsl,
libvulkan_wsi,
],
dependencies : v3dv_deps,

View file

@ -37,7 +37,6 @@
#include "broadcom/cle/v3dx_pack.h"
#include "compiler/v3d_compiler.h"
#include "compiler/glsl_types.h"
#include "drm-uapi/v3d_drm.h"
#include "format/u_format.h"
@ -168,8 +167,6 @@ v3dv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
util_cpu_detect();
glsl_type_singleton_init_or_ref();
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
*pInstance = v3dv_instance_to_handle(instance);
@ -217,8 +214,6 @@ v3dv_DestroyInstance(VkInstance _instance,
VG(VALGRIND_DESTROY_MEMPOOL(instance));
glsl_type_singleton_decref();
vk_instance_finish(&instance->vk);
vk_free(&instance->vk.alloc, instance);
}

View file

@ -35,7 +35,6 @@
#include <sys/sysinfo.h>
#include <unistd.h>
#include "compiler/glsl_types.h"
#include "util/debug.h"
#include "util/disk_cache.h"
#include "util/u_atomic.h"
@ -255,8 +254,6 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
if (instance->debug_flags & TU_DEBUG_STARTUP)
mesa_logi("Created an instance");
glsl_type_singleton_init_or_ref();
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
*pInstance = tu_instance_to_handle(instance);
@ -279,8 +276,6 @@ tu_DestroyInstance(VkInstance _instance,
VG(VALGRIND_DESTROY_MEMPOOL(instance));
glsl_type_singleton_decref();
vk_instance_finish(&instance->vk);
vk_free(&instance->vk.alloc, instance);
}

View file

@ -30,7 +30,6 @@
#include "pipe/p_context.h"
#include "frontend/drisw_api.h"
#include "compiler/glsl_types.h"
#include "util/u_inlines.h"
#include "util/os_memory.h"
#include "util/u_thread.h"
@ -242,7 +241,6 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateInstance(
instance->physicalDeviceCount = -1;
// _mesa_locale_init();
glsl_type_singleton_init_or_ref();
// VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
*pInstance = lvp_instance_to_handle(instance);
@ -258,7 +256,6 @@ VKAPI_ATTR void VKAPI_CALL lvp_DestroyInstance(
if (!instance)
return;
glsl_type_singleton_decref();
if (instance->physicalDeviceCount > 0)
lvp_physical_device_finish(&instance->physicalDevice);
// _mesa_locale_fini();

View file

@ -48,7 +48,6 @@
#include "common/intel_aux_map.h"
#include "common/intel_defines.h"
#include "common/intel_uuid.h"
#include "compiler/glsl_types.h"
#include "perf/gen_perf.h"
#include "genxml/gen7_pack.h"
@ -1035,8 +1034,6 @@ VkResult anv_CreateInstance(
instance->pipeline_cache_enabled =
env_var_as_boolean("ANV_ENABLE_PIPELINE_CACHE", true);
glsl_type_singleton_init_or_ref();
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
anv_init_dri_options(instance);
@ -1061,8 +1058,6 @@ void anv_DestroyInstance(
VG(VALGRIND_DESTROY_MEMPOOL(instance));
glsl_type_singleton_decref();
driDestroyOptionCache(&instance->dri_options);
driDestroyOptionInfo(&instance->available_dri_options);

View file

@ -92,6 +92,8 @@ libvulkan_util = static_library(
vk_enum_to_str, vk_extensions],
include_directories : [inc_include, inc_src, inc_gallium],
dependencies : [vulkan_wsi_deps, idep_mesautil],
# For glsl_type_singleton
link_with : libcompiler,
c_args : [vulkan_wsi_args],
gnu_symbol_visibility : 'hidden',
build_by_default : false,

View file

@ -27,6 +27,8 @@
#include "vk_common_entrypoints.h"
#include "vk_util.h"
#include "compiler/glsl_types.h"
VkResult
vk_instance_init(struct vk_instance *instance,
const struct vk_instance_extension_table *supported_extensions,
@ -91,12 +93,15 @@ vk_instance_init(struct vk_instance *instance,
list_inithead(&instance->debug_report.callbacks);
glsl_type_singleton_init_or_ref();
return VK_SUCCESS;
}
void
vk_instance_finish(struct vk_instance *instance)
{
glsl_type_singleton_decref();
mtx_destroy(&instance->debug_report.callbacks_mutex);
vk_free(&instance->alloc, (char *)instance->app_info.app_name);
vk_free(&instance->alloc, (char *)instance->app_info.engine_name);