On Wed, Jun 22, 2016 at 11:25 AM, Emil Velikov <emil.l.veli...@gmail.com> wrote:
> 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). > > Cc: Jason Ekstrand <ja...@jlekstrand.net> > Cc: mesa-sta...@lists.freedesktop.org > Signed-off-by: Emil Velikov <emil.veli...@collabora.com> > --- > Strictly speaking v2 _could_ make a difference if one has a machine > powerful enough to have `make' and `make install' each this Makefile > within the same second. That sounds pretty much impossible though :-) > > If people prefer we could drop the header all together and provide the > define via the Makefile. It would be a bit unusual (in mesa at least) > but it should work. > That would be bad because a change in #defines would cause lots of stuff to get recompiled when it isn't needed. Using the header means only anv_device.c gets recompiled which is much nicer. > --- > src/intel/vulkan/.gitignore | 1 + > src/intel/vulkan/Makefile.am | 9 ++++++++- > src/intel/vulkan/anv_device.c | 4 ++-- > 3 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/src/intel/vulkan/.gitignore b/src/intel/vulkan/.gitignore > index a496146..ce6f23f 100644 > --- a/src/intel/vulkan/.gitignore > +++ b/src/intel/vulkan/.gitignore > @@ -2,3 +2,4 @@ > /anv_entrypoints.c > /anv_entrypoints.h > /dev_icd.json > +/anv_timestamp.h > diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am > index 4d9ff90..5f68f29 100644 > --- a/src/intel/vulkan/Makefile.am > +++ b/src/intel/vulkan/Makefile.am > @@ -131,7 +131,14 @@ anv_entrypoints.c : anv_entrypoints_gen.py > $(vulkan_include_HEADERS) > $(AM_V_GEN) cat $(vulkan_include_HEADERS) |\ > $(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code > $@ > > -BUILT_SOURCES = $(VULKAN_GENERATED_FILES) > + > +.PHONY: anv_timestamp.h > + > +anv_timestamp.h: > + @echo "Updating anv_timestamp.h" > + $(AM_V_GEN) echo "#define ANV_TIMESTAMP `date +%s`" > $@ > + > +BUILT_SOURCES = $(VULKAN_GENERATED_FILES) anv_timestamp.h > Should this really go in anv? Timothy is going to need it for the shader cache for GL so it might be good to put it some place more generic. Or Timothy can just move it when he needs it. I don't care much either way. Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net> > CLEANFILES = $(BUILT_SOURCES) dev_icd.json > EXTRA_DIST = \ > $(top_srcdir)/include/vulkan/vk_icd.h \ > diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c > index 97300c3..e395b1c 100644 > --- a/src/intel/vulkan/anv_device.c > +++ b/src/intel/vulkan/anv_device.c > @@ -28,7 +28,7 @@ > #include <fcntl.h> > > #include "anv_private.h" > -#include "git_sha1.h" > +#include "anv_timestamp.h" > #include "util/strtod.h" > #include "util/debug.h" > > @@ -426,7 +426,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); > In a few hundred years or so, this might hit 16 characters... meh > } > > void anv_GetPhysicalDeviceProperties( > -- > 2.8.2 > >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev