Mesa (master): radv: store engine name

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Sep 15 12:58:31 UTC 2019


Module: Mesa
Branch: master
Commit: 6d5f11ab345b05759c22acbcd2f79928311689e3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d5f11ab345b05759c22acbcd2f79928311689e3

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Sun Sep  8 12:57:16 2019 +0300

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 at intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Cc: 19.2 <mesa-stable at lists.freedesktop.org>

---

 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;
 




More information about the mesa-commit mailing list