From 6d5f11ab345b05759c22acbcd2f79928311689e3 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sun, 8 Sep 2019 12:57:16 +0300 Subject: [PATCH] radv: store engine name We'll use this later for a new driconfig matching parameter. v2: Avoid leak in device creation error case (Bas) Signed-off-by: Lionel Landwerlin Reviewed-by: Eric Engestrom Reviewed-by: Bas Nieuwenhuizen Cc: 19.2 --- src/amd/vulkan/radv_device.c | 13 +++++++++++++ src/amd/vulkan/radv_private.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index beeec37e54a..57f492088bd 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -588,6 +588,13 @@ VkResult radv_CreateInstance( client_version = VK_API_VERSION_1_0; } + const char *engine_name = NULL; + uint32_t engine_version = 0; + if (pCreateInfo->pApplicationInfo) { + engine_name = pCreateInfo->pApplicationInfo->pEngineName; + engine_version = pCreateInfo->pApplicationInfo->engineVersion; + } + instance = vk_zalloc2(&default_alloc, pAllocator, sizeof(*instance), 8, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (!instance) @@ -631,6 +638,10 @@ VkResult radv_CreateInstance( return vk_error(instance, result); } + instance->engineName = vk_strdup(&instance->alloc, engine_name, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + instance->engineVersion = engine_version; + _mesa_locale_init(); glsl_type_singleton_init_or_ref(); @@ -657,6 +668,8 @@ void radv_DestroyInstance( radv_physical_device_finish(instance->physicalDevices + i); } + vk_free(&instance->alloc, instance->engineName); + VG(VALGRIND_DESTROY_MEMPOOL(instance)); glsl_type_singleton_decref(); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index bf62ccc9c1d..d6c446abd06 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -315,6 +315,9 @@ struct radv_instance { int physicalDeviceCount; struct radv_physical_device physicalDevices[RADV_MAX_DRM_DEVICES]; + char * engineName; + uint32_t engineVersion; + uint64_t debug_flags; uint64_t perftest_flags; -- 2.30.2