simplify LLVM version string printing
Figure it out once in the build system, then just use that all over the place. Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:

committed by
Eric Engestrom

parent
593614f4d4
commit
05b114e526
@@ -97,13 +97,13 @@ define mesa-build-with-llvm
|
|||||||
$(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5), \
|
$(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5), \
|
||||||
$(warning Unsupported LLVM version in Android $(MESA_ANDROID_MAJOR_VERSION)),) \
|
$(warning Unsupported LLVM version in Android $(MESA_ANDROID_MAJOR_VERSION)),) \
|
||||||
$(if $(filter 6,$(MESA_ANDROID_MAJOR_VERSION)), \
|
$(if $(filter 6,$(MESA_ANDROID_MAJOR_VERSION)), \
|
||||||
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_PATCH=0)) \
|
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_STRING="3.7")) \
|
||||||
$(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
|
$(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
|
||||||
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0)) \
|
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_STRING="3.8")) \
|
||||||
$(if $(filter 8,$(MESA_ANDROID_MAJOR_VERSION)), \
|
$(if $(filter 8,$(MESA_ANDROID_MAJOR_VERSION)), \
|
||||||
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
|
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_STRING="3.9")) \
|
||||||
$(if $(filter P,$(MESA_ANDROID_MAJOR_VERSION)), \
|
$(if $(filter P,$(MESA_ANDROID_MAJOR_VERSION)), \
|
||||||
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
|
$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_STRING="3.9")) \
|
||||||
$(eval LOCAL_SHARED_LIBRARIES += libLLVM)
|
$(eval LOCAL_SHARED_LIBRARIES += libLLVM)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@@ -2936,7 +2936,7 @@ dnl
|
|||||||
dnl Set defines and buildtime variables only when using LLVM.
|
dnl Set defines and buildtime variables only when using LLVM.
|
||||||
dnl
|
dnl
|
||||||
if test "x$enable_llvm" = xyes; then
|
if test "x$enable_llvm" = xyes; then
|
||||||
DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
|
DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_STRING=\\\"$LLVM_VERSION\\\""
|
||||||
|
|
||||||
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
|
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
|
||||||
LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
|
LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
|
||||||
|
10
meson.build
10
meson.build
@@ -1234,17 +1234,9 @@ if _llvm != 'false'
|
|||||||
endif
|
endif
|
||||||
if with_llvm
|
if with_llvm
|
||||||
_llvm_version = dep_llvm.version().split('.')
|
_llvm_version = dep_llvm.version().split('.')
|
||||||
|
|
||||||
# 3 digits versions in LLVM only started from 3.4.1 on
|
|
||||||
if dep_llvm.version().version_compare('>= 3.4.1')
|
|
||||||
_llvm_patch = _llvm_version[2]
|
|
||||||
else
|
|
||||||
_llvm_patch = '0'
|
|
||||||
endif
|
|
||||||
|
|
||||||
pre_args += [
|
pre_args += [
|
||||||
'-DHAVE_LLVM=0x0@0@0@1@'.format(_llvm_version[0], _llvm_version[1]),
|
'-DHAVE_LLVM=0x0@0@0@1@'.format(_llvm_version[0], _llvm_version[1]),
|
||||||
'-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
|
'-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version()),
|
||||||
]
|
]
|
||||||
|
|
||||||
# LLVM can be built without rtti, turning off rtti changes the ABI of C++
|
# LLVM can be built without rtti, turning off rtti changes the ABI of C++
|
||||||
|
@@ -629,7 +629,7 @@ static void
|
|||||||
radv_dump_device_name(struct radv_device *device, FILE *f)
|
radv_dump_device_name(struct radv_device *device, FILE *f)
|
||||||
{
|
{
|
||||||
struct radeon_info *info = &device->physical_device->rad_info;
|
struct radeon_info *info = &device->physical_device->rad_info;
|
||||||
char llvm_string[32] = {}, kernel_version[128] = {};
|
char kernel_version[128] = {};
|
||||||
struct utsname uname_data;
|
struct utsname uname_data;
|
||||||
const char *chip_name;
|
const char *chip_name;
|
||||||
|
|
||||||
@@ -639,14 +639,11 @@ radv_dump_device_name(struct radv_device *device, FILE *f)
|
|||||||
snprintf(kernel_version, sizeof(kernel_version),
|
snprintf(kernel_version, sizeof(kernel_version),
|
||||||
" / %s", uname_data.release);
|
" / %s", uname_data.release);
|
||||||
|
|
||||||
snprintf(llvm_string, sizeof(llvm_string),
|
fprintf(f, "Device name: %s (%s DRM %i.%i.%i%s, LLVM "
|
||||||
", LLVM %i.%i.%i", (HAVE_LLVM >> 8) & 0xff,
|
MESA_LLVM_VERSION_STRING ")\n\n",
|
||||||
HAVE_LLVM & 0xff, MESA_LLVM_VERSION_PATCH);
|
|
||||||
|
|
||||||
fprintf(f, "Device name: %s (%s DRM %i.%i.%i%s%s)\n\n",
|
|
||||||
chip_name, device->physical_device->name,
|
chip_name, device->physical_device->name,
|
||||||
info->drm_major, info->drm_minor, info->drm_patchlevel,
|
info->drm_major, info->drm_minor, info->drm_patchlevel,
|
||||||
kernel_version, llvm_string);
|
kernel_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@@ -87,7 +87,6 @@ static void
|
|||||||
radv_get_device_name(enum radeon_family family, char *name, size_t name_len)
|
radv_get_device_name(enum radeon_family family, char *name, size_t name_len)
|
||||||
{
|
{
|
||||||
const char *chip_string;
|
const char *chip_string;
|
||||||
char llvm_string[32] = {};
|
|
||||||
|
|
||||||
switch (family) {
|
switch (family) {
|
||||||
case CHIP_TAHITI: chip_string = "AMD RADV TAHITI"; break;
|
case CHIP_TAHITI: chip_string = "AMD RADV TAHITI"; break;
|
||||||
@@ -116,10 +115,7 @@ radv_get_device_name(enum radeon_family family, char *name, size_t name_len)
|
|||||||
default: chip_string = "AMD RADV unknown"; break;
|
default: chip_string = "AMD RADV unknown"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(llvm_string, sizeof(llvm_string),
|
snprintf(name, name_len, "%s (LLVM " MESA_LLVM_VERSION_STRING ")", chip_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 uint64_t
|
static uint64_t
|
||||||
@@ -1267,9 +1263,7 @@ void radv_GetPhysicalDeviceProperties2(
|
|||||||
memset(driver_props->driverInfo, 0, VK_MAX_DRIVER_INFO_SIZE_KHR);
|
memset(driver_props->driverInfo, 0, VK_MAX_DRIVER_INFO_SIZE_KHR);
|
||||||
snprintf(driver_props->driverInfo, VK_MAX_DRIVER_INFO_SIZE_KHR,
|
snprintf(driver_props->driverInfo, VK_MAX_DRIVER_INFO_SIZE_KHR,
|
||||||
"Mesa " PACKAGE_VERSION MESA_GIT_SHA1
|
"Mesa " PACKAGE_VERSION MESA_GIT_SHA1
|
||||||
" (LLVM %d.%d.%d)",
|
" (LLVM " MESA_LLVM_VERSION_STRING ")");
|
||||||
(HAVE_LLVM >> 8) & 0xff, HAVE_LLVM & 0xff,
|
|
||||||
MESA_LLVM_VERSION_PATCH);
|
|
||||||
|
|
||||||
driver_props->conformanceVersion = (VkConformanceVersionKHR) {
|
driver_props->conformanceVersion = (VkConformanceVersionKHR) {
|
||||||
.major = 1,
|
.major = 1,
|
||||||
|
@@ -47,10 +47,6 @@
|
|||||||
#include <llvm-c/TargetMachine.h>
|
#include <llvm-c/TargetMachine.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MESA_LLVM_VERSION_PATCH
|
|
||||||
#define MESA_LLVM_VERSION_PATCH 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct r600_multi_fence {
|
struct r600_multi_fence {
|
||||||
struct pipe_reference reference;
|
struct pipe_reference reference;
|
||||||
struct pipe_fence_handle *gfx;
|
struct pipe_fence_handle *gfx;
|
||||||
@@ -1271,7 +1267,7 @@ struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen,
|
|||||||
bool r600_common_screen_init(struct r600_common_screen *rscreen,
|
bool r600_common_screen_init(struct r600_common_screen *rscreen,
|
||||||
struct radeon_winsys *ws)
|
struct radeon_winsys *ws)
|
||||||
{
|
{
|
||||||
char family_name[32] = {}, llvm_string[32] = {}, kernel_version[128] = {};
|
char family_name[32] = {}, kernel_version[128] = {};
|
||||||
struct utsname uname_data;
|
struct utsname uname_data;
|
||||||
const char *chip_name;
|
const char *chip_name;
|
||||||
|
|
||||||
@@ -1288,17 +1284,15 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
|
|||||||
snprintf(kernel_version, sizeof(kernel_version),
|
snprintf(kernel_version, sizeof(kernel_version),
|
||||||
" / %s", uname_data.release);
|
" / %s", uname_data.release);
|
||||||
|
|
||||||
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(rscreen->renderer_string, sizeof(rscreen->renderer_string),
|
snprintf(rscreen->renderer_string, sizeof(rscreen->renderer_string),
|
||||||
"%s (%sDRM %i.%i.%i%s%s)",
|
"%s (%sDRM %i.%i.%i%s"
|
||||||
|
#if HAVE_LLVM > 0
|
||||||
|
", LLVM " MESA_LLVM_VERSION_STRING
|
||||||
|
#endif
|
||||||
|
")",
|
||||||
chip_name, family_name, rscreen->info.drm_major,
|
chip_name, family_name, rscreen->info.drm_major,
|
||||||
rscreen->info.drm_minor, rscreen->info.drm_patchlevel,
|
rscreen->info.drm_minor, rscreen->info.drm_patchlevel,
|
||||||
kernel_version, llvm_string);
|
kernel_version);
|
||||||
|
|
||||||
rscreen->b.get_name = r600_get_name;
|
rscreen->b.get_name = r600_get_name;
|
||||||
rscreen->b.get_vendor = r600_get_vendor;
|
rscreen->b.get_vendor = r600_get_vendor;
|
||||||
|
@@ -961,13 +961,10 @@ static void si_init_renderer_string(struct si_screen *sscreen)
|
|||||||
", %s", uname_data.release);
|
", %s", uname_data.release);
|
||||||
|
|
||||||
snprintf(sscreen->renderer_string, sizeof(sscreen->renderer_string),
|
snprintf(sscreen->renderer_string, sizeof(sscreen->renderer_string),
|
||||||
"%s (%sDRM %i.%i.%i%s, LLVM %i.%i.%i)",
|
"%s (%sDRM %i.%i.%i%s, LLVM " MESA_LLVM_VERSION_STRING ")",
|
||||||
first_name, second_name, sscreen->info.drm_major,
|
first_name, second_name, sscreen->info.drm_major,
|
||||||
sscreen->info.drm_minor, sscreen->info.drm_patchlevel,
|
sscreen->info.drm_minor, sscreen->info.drm_patchlevel,
|
||||||
kernel_version,
|
kernel_version);
|
||||||
(HAVE_LLVM >> 8) & 0xff,
|
|
||||||
HAVE_LLVM & 0xff,
|
|
||||||
MESA_LLVM_VERSION_PATCH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void si_init_screen_get_functions(struct si_screen *sscreen)
|
void si_init_screen_get_functions(struct si_screen *sscreen)
|
||||||
|
Reference in New Issue
Block a user