This can be used as a drop in replacement for disk_cache_get_function_timestamp().
Here we use build-id to generate a driver-id rather than build timestamp if available. This should resolve issues such as distros using reproducable builds and flatpack not having real build timestamps. --- src/util/disk_cache.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h index 50bd9f41ac4..962a26ffc8c 100644 --- a/src/util/disk_cache.h +++ b/src/util/disk_cache.h @@ -26,6 +26,7 @@ #ifdef HAVE_DLFCN_H #include <dlfcn.h> +#include "util/build_id.h" #endif #include <assert.h> #include <stdint.h> @@ -103,6 +104,21 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp) *timestamp = st.st_mtime; return true; } + +static inline bool +disk_cache_get_function_identifier(void *ptr, uint32_t *id) +{ +#ifdef HAVE_DL_ITERATE_PHDR + const struct build_id_note *note = NULL; + if ((note = build_id_find_nhdr_for_addr(ptr))) { + const uint8_t *id_sha1 = build_id_data(note); + assert(id_sha1); + *id = *id_sha1; + return true; + } else +#endif + return disk_cache_get_function_timestamp(ptr, id); +} #endif /* Provide inlined stub functions if the shader cache is disabled. */ -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev