- /* 1 thread was chosen because we don't really care about getting things
- * to disk quickly just that it's not blocking other tasks.
- *
- * The queue will resize automatically when it's full, so adding new jobs
- * doesn't stall.
- */
- util_queue_init(&cache->cache_queue, "disk_cache", 32, 1,
- UTIL_QUEUE_INIT_RESIZE_IF_FULL |
- UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY);
-
- ralloc_free(local);
-
- return true;
-
- fail:
- if (fd != -1)
- close(fd);
-
- if (local)
- ralloc_free(local);
-
- cache->path_init_failed = true;
-
- return false;
-}
-
-#define DRV_KEY_CPY(_dst, _src, _src_size) \
-do { \
- memcpy(_dst, _src, _src_size); \
- _dst += _src_size; \
-} while (0);
-
-struct disk_cache *
-disk_cache_create(const char *gpu_name, const char *timestamp,
- uint64_t driver_flags)
-{
- struct disk_cache *cache = NULL;
- char *max_size_str;
- uint64_t max_size;
-
- /* If running as a users other than the real user disable cache */
- if (geteuid() != getuid())
- return NULL;
-
- /* At user request, disable shader cache entirely. */
- if (env_var_as_boolean("MESA_GLSL_CACHE_DISABLE", false))
- return NULL;
-
- cache = rzalloc(NULL, struct disk_cache);
- if (cache == NULL)
- return NULL;
-