[Mesa-dev] shader cache backward compatibility

Alexander Larsson alexl at redhat.com
Fri Aug 31 12:47:06 UTC 2018

On Fri, Aug 31, 2018 at 11:57 AM Timothy Arceri <tarceri at itsqueeze.com> wrote:
> On 31/08/18 19:40, Bas Nieuwenhuizen wrote:

> We depend on build timestamps of the mesa/llvm binaries when generating
> the sha for cache items. So if flatpak results in two versions of mesa
> having the same timestamp then there is likely going to be issues.
> static inline bool
> disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
> {
>     Dl_info info;
>     struct stat st;
>     if (!dladdr(ptr, &info) || !info.dli_fname) {
>        return false;
>     }
>     if (stat(info.dli_fname, &st)) {
>        return false;
>     }
>     *timestamp = st.st_mtime;
>     return true;
> }

Then i understand the problem. Flatpak stores all binaries in ostree,
and for technical reasons[1] all files stored in ostree have a mtime
of 0. This means the versioining will not work at all inside the
flatpak (nor will it when ostree stores the host OS in e.g. fedora
atomic). Is there no other unique id you can use?

[1] In ostree, all files are stored content-addressed. I.e. the
content + the some of the file metadata are checksummed. In order to
ensure files are shared more, the mtime is *not* part of the content
that is checksummed, so the ostree object has no mtime, which is
handled by using 0 for mtime in the repo.

More information about the mesa-dev mailing list