projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util/ra: fix memory leak
[mesa.git]
/
src
/
util
/
disk_cache.h
diff --git
a/src/util/disk_cache.h
b/src/util/disk_cache.h
index 8b6fc0ddcbf0b5d29c6aee584c64bf3c3b33d193..9aade16a9ee9fad773e301830541a2ccb82e80bf 100644
(file)
--- a/
src/util/disk_cache.h
+++ b/
src/util/disk_cache.h
@@
-24,7
+24,10
@@
#ifndef DISK_CACHE_H
#define DISK_CACHE_H
#ifndef DISK_CACHE_H
#define DISK_CACHE_H
+#ifdef ENABLE_SHADER_CACHE
#include <dlfcn.h>
#include <dlfcn.h>
+#endif
+#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/stat.h>
@@
-43,16
+46,20
@@
struct disk_cache;
static inline bool
disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
{
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_mtim.tv_sec;
- return true;
+#ifdef ENABLE_SHADER_CACHE
+ 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;
+#else
+ return false;
+#endif
}
/* Provide inlined stub functions if the shader cache is disabled. */
}
/* Provide inlined stub functions if the shader cache is disabled. */
@@
-86,7
+93,8
@@
disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
* assistance in computing SHA-1 signatures.
*/
struct disk_cache *
* assistance in computing SHA-1 signatures.
*/
struct disk_cache *
-disk_cache_create(const char *gpu_name, const char *timestamp);
+disk_cache_create(const char *gpu_name, const char *timestamp,
+ uint64_t driver_flags);
/**
* Destroy a cache object, (freeing all associated resources).
/**
* Destroy a cache object, (freeing all associated resources).
@@
-98,7
+106,7
@@
disk_cache_destroy(struct disk_cache *cache);
* Remove the item in the cache under the name \key.
*/
void
* Remove the item in the cache under the name \key.
*/
void
-disk_cache_remove(struct disk_cache *cache, cache_key key);
+disk_cache_remove(struct disk_cache *cache, c
onst c
ache_key key);
/**
* Store an item in the cache under the name \key.
/**
* Store an item in the cache under the name \key.
@@
-110,7
+118,7
@@
disk_cache_remove(struct disk_cache *cache, cache_key key);
* evicted from the cache.
*/
void
* evicted from the cache.
*/
void
-disk_cache_put(struct disk_cache *cache, cache_key key,
+disk_cache_put(struct disk_cache *cache, c
onst c
ache_key key,
const void *data, size_t size);
/**
const void *data, size_t size);
/**
@@
-127,7
+135,7
@@
disk_cache_put(struct disk_cache *cache, cache_key key,
* caller should call free() it when finished.
*/
void *
* caller should call free() it when finished.
*/
void *
-disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size);
+disk_cache_get(struct disk_cache *cache, c
onst c
ache_key key, size_t *size);
/**
* Store the name \key within the cache, (without any associated data).
/**
* Store the name \key within the cache, (without any associated data).
@@
-135,11
+143,11
@@
disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size);
* Later this key can be checked with disk_cache_has_key(), (unless the key
* has been evicted in the interim).
*
* Later this key can be checked with disk_cache_has_key(), (unless the key
* has been evicted in the interim).
*
- * Any call to
cache_record
() may cause an existing, random key to be
+ * Any call to
disk_cache_put_key
() may cause an existing, random key to be
* evicted from the cache.
*/
void
* evicted from the cache.
*/
void
-disk_cache_put_key(struct disk_cache *cache, cache_key key);
+disk_cache_put_key(struct disk_cache *cache, c
onst c
ache_key key);
/**
* Test whether the name \key was previously recorded in the cache.
/**
* Test whether the name \key was previously recorded in the cache.
@@
-152,12
+160,20
@@
disk_cache_put_key(struct disk_cache *cache, cache_key key);
* disk_cache_has_key() to return true for the same key.
*/
bool
* disk_cache_has_key() to return true for the same key.
*/
bool
-disk_cache_has_key(struct disk_cache *cache, cache_key key);
+disk_cache_has_key(struct disk_cache *cache, const cache_key key);
+
+/**
+ * Compute the name \key from \data of given \size.
+ */
+void
+disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
+ cache_key key);
#else
static inline struct disk_cache *
#else
static inline struct disk_cache *
-disk_cache_create(const char *gpu_name, const char *timestamp)
+disk_cache_create(const char *gpu_name, const char *timestamp,
+ uint64_t driver_flags)
{
return NULL;
}
{
return NULL;
}
@@
-168,36
+184,43
@@
disk_cache_destroy(struct disk_cache *cache) {
}
static inline void
}
static inline void
-disk_cache_put(struct disk_cache *cache, cache_key key,
+disk_cache_put(struct disk_cache *cache, c
onst c
ache_key key,
const void *data, size_t size)
{
return;
}
static inline void
const void *data, size_t size)
{
return;
}
static inline void
-disk_cache_remove(struct disk_cache *cache, cache_key key)
+disk_cache_remove(struct disk_cache *cache, c
onst c
ache_key key)
{
return;
}
static inline uint8_t *
{
return;
}
static inline uint8_t *
-disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size)
+disk_cache_get(struct disk_cache *cache, c
onst c
ache_key key, size_t *size)
{
return NULL;
}
static inline void
{
return NULL;
}
static inline void
-disk_cache_put_key(struct disk_cache *cache, cache_key key)
+disk_cache_put_key(struct disk_cache *cache, c
onst c
ache_key key)
{
return;
}
static inline bool
{
return;
}
static inline bool
-disk_cache_has_key(struct disk_cache *cache, cache_key key)
+disk_cache_has_key(struct disk_cache *cache, c
onst c
ache_key key)
{
return false;
}
{
return false;
}
+static inline void
+disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
+ const cache_key key)
+{
+ return;
+}
+
#endif /* ENABLE_SHADER_CACHE */
#ifdef __cplusplus
#endif /* ENABLE_SHADER_CACHE */
#ifdef __cplusplus