[Mesa-dev] [PATCH v3 2/4] anv: use cache uuid based on the build timestamp.

Jason Ekstrand jason at jlekstrand.net
Fri Jun 24 17:17:56 UTC 2016


On Fri, Jun 24, 2016 at 10:15 AM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:

> From: Emil Velikov <emil.velikov at 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 <michel at daenzer.net>
> Cc: Dave Airlie <airlied at gmail.com>
> Cc: Jason Ekstrand <jason at jlekstrand.net>
> Cc: mesa-stable at lists.freedesktop.org
> Signed-off-by: Emil Velikov <emil.velikov at 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)})
>

Sorry to throw in more wrenches, but what happens if you don't
reconfigure?  This has the potential to cause massive problems on
incremental builds.


> +
>  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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160624/f912e99b/attachment-0001.html>


More information about the mesa-dev mailing list