<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 22, 2016 at 11:25 AM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">From: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>><br>
<br>
Do not rely on the git sha1:<br>
- its current truncated form makes it less unique<br>
- it does not attribute for local (Vulkand or otherwise) changes<br>
<br>
Use a timestamp produced at the time of build. It's perfectly unique,<br>
unless someone explicitly thinkers with their system clock. Even then<br>
chances of producing the exact same one are very small, if not zero.<br>
<br>
</span>v2: Remove .tmp rule. Its not needed since we want for the header to be<br>
regenerated on each time we call make (Eric).<br>
<span class=""><br>
Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a><br>
Signed-off-by: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>><br>
---<br>
</span>Strictly speaking v2 _could_ make a difference if one has a machine<br>
powerful enough to have `make' and `make install' each this Makefile<br>
within the same second. That sounds pretty much impossible though :-)<br>
<br>
If people prefer we could drop the header all together and provide the<br>
define via the Makefile. It would be a bit unusual (in mesa at least)<br>
but it should work.<br></blockquote><div><br></div><div>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.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/intel/vulkan/.gitignore | 1 +<br>
src/intel/vulkan/Makefile.am | 9 ++++++++-<br>
src/intel/vulkan/anv_device.c | 4 ++--<br>
3 files changed, 11 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/.gitignore b/src/intel/vulkan/.gitignore<br>
index a496146..ce6f23f 100644<br>
--- a/src/intel/vulkan/.gitignore<br>
+++ b/src/intel/vulkan/.gitignore<br>
@@ -2,3 +2,4 @@<br>
/anv_entrypoints.c<br>
/anv_entrypoints.h<br>
/dev_icd.json<br>
<span class="">+/anv_timestamp.h<br>
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am<br>
</span>index 4d9ff90..5f68f29 100644<br>
--- a/src/intel/vulkan/Makefile.am<br>
+++ b/src/intel/vulkan/Makefile.am<br>
@@ -131,7 +131,14 @@ anv_entrypoints.c : anv_entrypoints_gen.py $(vulkan_include_HEADERS)<br>
<span class=""> $(AM_V_GEN) cat $(vulkan_include_HEADERS) |\<br>
$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code > $@<br>
<br>
-BUILT_SOURCES = $(VULKAN_GENERATED_FILES)<br>
+<br>
+.PHONY: anv_timestamp.h<br>
</span>+<br>
+anv_timestamp.h:<br>
+ @echo "Updating anv_timestamp.h"<br>
<span class="im HOEnZb">+ $(AM_V_GEN) echo "#define ANV_TIMESTAMP `date +%s`" > $@<br>
+<br>
</span><div class="HOEnZb"><div class="h5">+BUILT_SOURCES = $(VULKAN_GENERATED_FILES) anv_timestamp.h<br></div></div></blockquote><div><br></div><div>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.<br><br></div><div>I don't care much either way.<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
CLEANFILES = $(BUILT_SOURCES) dev_icd.json<br>
EXTRA_DIST = \<br>
$(top_srcdir)/include/vulkan/vk_icd.h \<br>
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c<br>
index 97300c3..e395b1c 100644<br>
--- a/src/intel/vulkan/anv_device.c<br>
+++ b/src/intel/vulkan/anv_device.c<br>
@@ -28,7 +28,7 @@<br>
#include <fcntl.h><br>
<br>
#include "anv_private.h"<br>
-#include "git_sha1.h"<br>
+#include "anv_timestamp.h"<br>
#include "util/strtod.h"<br>
#include "util/debug.h"<br>
<br>
@@ -426,7 +426,7 @@ void<br>
anv_device_get_cache_uuid(void *uuid)<br>
{<br>
memset(uuid, 0, VK_UUID_SIZE);<br>
- snprintf(uuid, VK_UUID_SIZE, "anv-%s", MESA_GIT_SHA1 + 4);<br>
+ snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);<br></div></div></blockquote><div><br></div><div>In a few hundred years or so, this might hit 16 characters... meh<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
}<br>
<br>
void anv_GetPhysicalDeviceProperties(<br>
--<br>
2.8.2<br>
<br>
</div></div></blockquote></div><br></div></div>