From: Emil Velikov <emil.veli...@collabora.com> Do not rely on the git sha1: - its current truncated form makes it less unique - it does not attribute for local (Vulkand or otherwise) changes
Use a timestamp produced at the time of build. It's perfectly unique, unless someone explicitly thinkers with their system clock. Even then chances of producing the exact same one are very small, if not zero. v2: Remove .tmp rule. Its not needed since we want for the header to be regenerated on each time we call make (Eric). v3: - Honour SOURCE_DATE_EPOCH, to make the build reproducible (Michel) - Replace the generated header with a define, to prevent needless builds on consecutive `make' and/or `make install' calls. (Dave) Cc: Michel Dänzer <mic...@daenzer.net> Cc: Dave Airlie <airl...@gmail.com> Cc: Jason Ekstrand <ja...@jlekstrand.net> Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Emil Velikov <emil.veli...@collabora.com> --- Hopefully platforms implementing SOURCE_DATE_EPOCH will ensure that things are sane. If one is really paranoid we could annotate the symbol to distinguish between the envvar and normal date +%s. I'll leave that one for later, if needed. --- configure.ac | 2 ++ src/intel/vulkan/Makefile.am | 1 + src/intel/vulkan/anv_device.c | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index cc9bc47..e4e090f 100644 --- a/configure.ac +++ b/configure.ac @@ -2593,6 +2593,8 @@ AC_SUBST([XA_MINOR], $XA_MINOR) AC_SUBST([XA_TINY], $XA_TINY) AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY") +AC_SUBST([BUILD_TIMESTAMP], ${SOURCE_DATE_EPOCH:-$(date +%s)}) + AC_ARG_ENABLE(valgrind, [AS_HELP_STRING([--enable-valgrind], [Build mesa with valgrind support (default: auto)])], diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am index 4d9ff90..90cf338 100644 --- a/src/intel/vulkan/Makefile.am +++ b/src/intel/vulkan/Makefile.am @@ -46,6 +46,7 @@ AM_CPPFLAGS = \ $(INTEL_CFLAGS) \ $(VALGRIND_CFLAGS) \ $(DEFINES) \ + -DANV_TIMESTAMP=$(BUILD_TIMESTAMP) \ -I$(top_srcdir)/include \ -I$(top_builddir)/src \ -I$(top_srcdir)/src \ diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index ea8e875..b463d44 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -28,7 +28,6 @@ #include <fcntl.h> #include "anv_private.h" -#include "git_sha1.h" #include "util/strtod.h" #include "util/debug.h" @@ -426,7 +425,7 @@ void anv_device_get_cache_uuid(void *uuid) { memset(uuid, 0, VK_UUID_SIZE); - snprintf(uuid, VK_UUID_SIZE, "anv-%s", MESA_GIT_SHA1 + 4); + snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP); } void anv_GetPhysicalDeviceProperties( -- 2.8.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev