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 <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: 19.2 <mesa-stable@lists.freedesktop.org>
This commit is contained in:
Lionel Landwerlin 2019-09-08 12:57:16 +03:00
parent 9466e4cfab
commit 6d5f11ab34
2 changed files with 16 additions and 0 deletions

View file

@ -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();

View file

@ -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;