<div dir="auto">R-b</div><br><div class="gmail_quote"><div dir="ltr">On Thu, 20 Sep 2018, 00:54 Timothy Arceri, <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Timestamp can be zero for example when Flatpak is used. In this<br>
case just disable the cache rather then segfaulting when<br>
incompatible cache items are loaded.<br>
<br>
V2: actually return false when mtime is 0.<br>
---<br>
src/amd/vulkan/radv_device.c | 4 ----<br>
src/util/disk_cache.h | 8 ++++++++<br>
2 files changed, 8 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c<br>
index f9169d9d012..7d915c68aaa 100644<br>
--- a/src/amd/vulkan/radv_device.c<br>
+++ b/src/amd/vulkan/radv_device.c<br>
@@ -61,10 +61,6 @@ radv_get_build_id(void *ptr, struct mesa_sha1 *ctx)<br>
} else<br>
#endif<br>
if (disk_cache_get_function_timestamp(ptr, ×tamp)) {<br>
- if (!timestamp) {<br>
- fprintf(stderr, "radv: The provided filesystem timestamp for the cache is bogus!\n");<br>
- }<br>
-<br>
_mesa_sha1_update(ctx, ×tamp, sizeof(timestamp));<br>
} else<br>
return false;<br>
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h<br>
index 962a26ffc8c..185e05f200e 100644<br>
--- a/src/util/disk_cache.h<br>
+++ b/src/util/disk_cache.h<br>
@@ -101,7 +101,15 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)<br>
if (stat(info.dli_fname, &st)) {<br>
return false;<br>
}<br>
+<br>
+ if (!st.st_mtime) {<br>
+ fprintf(stderr, "Mesa: The provided filesystem timestamp for the cache "<br>
+ "is bogus! Disabling On-disk cache.\n");<br>
+ return false;<br>
+ }<br>
+<br>
*timestamp = st.st_mtime;<br>
+<br>
return true;<br>
}<br>
<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>