From 8fda98c4f1dba2488b9e3ef3e820585f48a8a2f9 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 6 Dec 2017 10:28:14 +0000 Subject: [PATCH] radv: Add LLVM version to the device name string MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Allows apps to determine the LLVM version so that they can decide whether or not to enable workarounds for LLVM issues. Signed-off-by: Alex Smith Cc: "17.2 17.3" Reviewed-by: Samuel Pitoiset Tested-by: Dieter Nützel --- src/amd/vulkan/radv_device.c | 61 +++++++++++++++++++++-------------- src/amd/vulkan/radv_private.h | 2 +- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 2538472bea6..c6288241638 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -75,32 +75,43 @@ radv_get_device_uuid(struct radeon_info *info, void *uuid) ac_compute_device_uuid(info, uuid, VK_UUID_SIZE); } -static const char * -get_chip_name(enum radeon_family family) +static void +radv_get_device_name(enum radeon_family family, char *name, size_t name_len) { + const char *chip_string; + char llvm_string[32] = {}; + switch (family) { - case CHIP_TAHITI: return "AMD RADV TAHITI"; - case CHIP_PITCAIRN: return "AMD RADV PITCAIRN"; - case CHIP_VERDE: return "AMD RADV CAPE VERDE"; - case CHIP_OLAND: return "AMD RADV OLAND"; - case CHIP_HAINAN: return "AMD RADV HAINAN"; - case CHIP_BONAIRE: return "AMD RADV BONAIRE"; - case CHIP_KAVERI: return "AMD RADV KAVERI"; - case CHIP_KABINI: return "AMD RADV KABINI"; - case CHIP_HAWAII: return "AMD RADV HAWAII"; - case CHIP_MULLINS: return "AMD RADV MULLINS"; - case CHIP_TONGA: return "AMD RADV TONGA"; - case CHIP_ICELAND: return "AMD RADV ICELAND"; - case CHIP_CARRIZO: return "AMD RADV CARRIZO"; - case CHIP_FIJI: return "AMD RADV FIJI"; - case CHIP_POLARIS10: return "AMD RADV POLARIS10"; - case CHIP_POLARIS11: return "AMD RADV POLARIS11"; - case CHIP_POLARIS12: return "AMD RADV POLARIS12"; - case CHIP_STONEY: return "AMD RADV STONEY"; - case CHIP_VEGA10: return "AMD RADV VEGA"; - case CHIP_RAVEN: return "AMD RADV RAVEN"; - default: return "AMD RADV unknown"; - } + case CHIP_TAHITI: chip_string = "AMD RADV TAHITI"; break; + case CHIP_PITCAIRN: chip_string = "AMD RADV PITCAIRN"; break; + case CHIP_VERDE: chip_string = "AMD RADV CAPE VERDE"; break; + case CHIP_OLAND: chip_string = "AMD RADV OLAND"; break; + case CHIP_HAINAN: chip_string = "AMD RADV HAINAN"; break; + case CHIP_BONAIRE: chip_string = "AMD RADV BONAIRE"; break; + case CHIP_KAVERI: chip_string = "AMD RADV KAVERI"; break; + case CHIP_KABINI: chip_string = "AMD RADV KABINI"; break; + case CHIP_HAWAII: chip_string = "AMD RADV HAWAII"; break; + case CHIP_MULLINS: chip_string = "AMD RADV MULLINS"; break; + case CHIP_TONGA: chip_string = "AMD RADV TONGA"; break; + case CHIP_ICELAND: chip_string = "AMD RADV ICELAND"; break; + case CHIP_CARRIZO: chip_string = "AMD RADV CARRIZO"; break; + case CHIP_FIJI: chip_string = "AMD RADV FIJI"; break; + case CHIP_POLARIS10: chip_string = "AMD RADV POLARIS10"; break; + case CHIP_POLARIS11: chip_string = "AMD RADV POLARIS11"; break; + case CHIP_POLARIS12: chip_string = "AMD RADV POLARIS12"; break; + case CHIP_STONEY: chip_string = "AMD RADV STONEY"; break; + case CHIP_VEGA10: chip_string = "AMD RADV VEGA"; break; + case CHIP_RAVEN: chip_string = "AMD RADV RAVEN"; break; + default: chip_string = "AMD RADV unknown"; break; + } + + if (HAVE_LLVM > 0) { + snprintf(llvm_string, sizeof(llvm_string), + " (LLVM %i.%i.%i)", (HAVE_LLVM >> 8) & 0xff, + HAVE_LLVM & 0xff, MESA_LLVM_VERSION_PATCH); + } + + snprintf(name, name_len, "%s%s", chip_string, llvm_string); } static void @@ -215,7 +226,7 @@ radv_physical_device_init(struct radv_physical_device *device, device->local_fd = fd; device->ws->query_info(device->ws, &device->rad_info); - device->name = get_chip_name(device->rad_info.family); + radv_get_device_name(device->rad_info.family, device->name, sizeof(device->name)); if (radv_device_get_cache_uuid(device->rad_info.family, device->cache_uuid)) { device->ws->destroy(device->ws); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 67c20111076..3edfda6b122 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -261,7 +261,7 @@ struct radv_physical_device { struct radeon_winsys *ws; struct radeon_info rad_info; char path[20]; - const char * name; + char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; uint8_t driver_uuid[VK_UUID_SIZE]; uint8_t device_uuid[VK_UUID_SIZE]; uint8_t cache_uuid[VK_UUID_SIZE]; -- 2.30.2