3b69b67545
Add a new environment varible MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMICE_LIST that specifies a text file containing a list of RO fossilize caches to load. The list file is modifiable at runtime to allow for loading RO caches after initialization unlike MESA_DISK_CACHE_READ_ONLY_FOZ_DBS. The implementation spawns an updater thread that uses inotify to monitor the list file for modifications, attempting to load new foz dbs added to the list. Removing files from the list will not evict a loaded cache. MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST takes an absolute path. The file must exist at initialization for updating to occur. File names of foz dbs in the list file are new-line separated and take relative paths to the default cache directory like MESA_DISK_CACHE_READ_ONLY_FOZ_DBS. The maximum number of RO foz dbs is kept to 8 and is shared between MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST and MESA_DISK_CACHE_READ_ONLY_FOZ_DBS. The intended use case for this feature is to allow prebuilt caches to be downloaded and loaded asynchronously during app runtime. Prebuilt caches be large (several GB) and depending on network conditions would otherwise present extended wait time for caches to be availible before app launch. This will be used in Chrome OS. Signed-off-by: Juston Li <justonli@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19328>