1*61046927SAndroid Build Coastguard Worker /*
2*61046927SAndroid Build Coastguard Worker * Copyright © 2014 Intel Corporation
3*61046927SAndroid Build Coastguard Worker *
4*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a
5*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the "Software"),
6*61046927SAndroid Build Coastguard Worker * to deal in the Software without restriction, including without limitation
7*61046927SAndroid Build Coastguard Worker * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*61046927SAndroid Build Coastguard Worker * and/or sell copies of the Software, and to permit persons to whom the
9*61046927SAndroid Build Coastguard Worker * Software is furnished to do so, subject to the following conditions:
10*61046927SAndroid Build Coastguard Worker *
11*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice (including the next
12*61046927SAndroid Build Coastguard Worker * paragraph) shall be included in all copies or substantial portions of the
13*61046927SAndroid Build Coastguard Worker * Software.
14*61046927SAndroid Build Coastguard Worker *
15*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*61046927SAndroid Build Coastguard Worker * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18*61046927SAndroid Build Coastguard Worker * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*61046927SAndroid Build Coastguard Worker * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20*61046927SAndroid Build Coastguard Worker * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21*61046927SAndroid Build Coastguard Worker * IN THE SOFTWARE.
22*61046927SAndroid Build Coastguard Worker */
23*61046927SAndroid Build Coastguard Worker
24*61046927SAndroid Build Coastguard Worker #ifndef DISK_CACHE_H
25*61046927SAndroid Build Coastguard Worker #define DISK_CACHE_H
26*61046927SAndroid Build Coastguard Worker
27*61046927SAndroid Build Coastguard Worker #ifdef HAVE_DLFCN_H
28*61046927SAndroid Build Coastguard Worker #include <dlfcn.h>
29*61046927SAndroid Build Coastguard Worker #include <stdio.h>
30*61046927SAndroid Build Coastguard Worker #include "util/build_id.h"
31*61046927SAndroid Build Coastguard Worker #endif
32*61046927SAndroid Build Coastguard Worker #include <assert.h>
33*61046927SAndroid Build Coastguard Worker #include <stdint.h>
34*61046927SAndroid Build Coastguard Worker #include <stdbool.h>
35*61046927SAndroid Build Coastguard Worker #include <sys/stat.h>
36*61046927SAndroid Build Coastguard Worker #include "util/mesa-sha1.h"
37*61046927SAndroid Build Coastguard Worker #include "util/detect_os.h"
38*61046927SAndroid Build Coastguard Worker
39*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
40*61046927SAndroid Build Coastguard Worker extern "C" {
41*61046927SAndroid Build Coastguard Worker #endif
42*61046927SAndroid Build Coastguard Worker
43*61046927SAndroid Build Coastguard Worker /* Size of cache keys in bytes. */
44*61046927SAndroid Build Coastguard Worker #define CACHE_KEY_SIZE 20
45*61046927SAndroid Build Coastguard Worker
46*61046927SAndroid Build Coastguard Worker #define CACHE_DIR_NAME "mesa_shader_cache"
47*61046927SAndroid Build Coastguard Worker #define CACHE_DIR_NAME_SF "mesa_shader_cache_sf"
48*61046927SAndroid Build Coastguard Worker #define CACHE_DIR_NAME_DB "mesa_shader_cache_db"
49*61046927SAndroid Build Coastguard Worker
50*61046927SAndroid Build Coastguard Worker typedef uint8_t cache_key[CACHE_KEY_SIZE];
51*61046927SAndroid Build Coastguard Worker
52*61046927SAndroid Build Coastguard Worker /* WARNING: 3rd party applications might be reading the cache item metadata.
53*61046927SAndroid Build Coastguard Worker * Do not change these values without making the change widely known.
54*61046927SAndroid Build Coastguard Worker * Please contact Valve developers and make them aware of this change.
55*61046927SAndroid Build Coastguard Worker */
56*61046927SAndroid Build Coastguard Worker #define CACHE_ITEM_TYPE_UNKNOWN 0x0
57*61046927SAndroid Build Coastguard Worker #define CACHE_ITEM_TYPE_GLSL 0x1
58*61046927SAndroid Build Coastguard Worker
59*61046927SAndroid Build Coastguard Worker typedef void
60*61046927SAndroid Build Coastguard Worker (*disk_cache_put_cb) (const void *key, signed long keySize,
61*61046927SAndroid Build Coastguard Worker const void *value, signed long valueSize);
62*61046927SAndroid Build Coastguard Worker
63*61046927SAndroid Build Coastguard Worker typedef signed long
64*61046927SAndroid Build Coastguard Worker (*disk_cache_get_cb) (const void *key, signed long keySize,
65*61046927SAndroid Build Coastguard Worker void *value, signed long valueSize);
66*61046927SAndroid Build Coastguard Worker
67*61046927SAndroid Build Coastguard Worker struct cache_item_metadata {
68*61046927SAndroid Build Coastguard Worker /**
69*61046927SAndroid Build Coastguard Worker * The cache item type. This could be used to identify a GLSL cache item,
70*61046927SAndroid Build Coastguard Worker * a certain type of IR (tgsi, nir, etc), or signal that it is the final
71*61046927SAndroid Build Coastguard Worker * binary form of the shader.
72*61046927SAndroid Build Coastguard Worker */
73*61046927SAndroid Build Coastguard Worker uint32_t type;
74*61046927SAndroid Build Coastguard Worker
75*61046927SAndroid Build Coastguard Worker /** GLSL cache item metadata */
76*61046927SAndroid Build Coastguard Worker cache_key *keys; /* sha1 list of shaders that make up the cache item */
77*61046927SAndroid Build Coastguard Worker uint32_t num_keys;
78*61046927SAndroid Build Coastguard Worker };
79*61046927SAndroid Build Coastguard Worker
80*61046927SAndroid Build Coastguard Worker struct disk_cache;
81*61046927SAndroid Build Coastguard Worker
82*61046927SAndroid Build Coastguard Worker #ifdef HAVE_DLADDR
83*61046927SAndroid Build Coastguard Worker static inline bool
disk_cache_get_function_timestamp(void * ptr,uint32_t * timestamp)84*61046927SAndroid Build Coastguard Worker disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
85*61046927SAndroid Build Coastguard Worker {
86*61046927SAndroid Build Coastguard Worker Dl_info info;
87*61046927SAndroid Build Coastguard Worker struct stat st;
88*61046927SAndroid Build Coastguard Worker if (!dladdr(ptr, &info) || !info.dli_fname) {
89*61046927SAndroid Build Coastguard Worker return false;
90*61046927SAndroid Build Coastguard Worker }
91*61046927SAndroid Build Coastguard Worker if (stat(info.dli_fname, &st)) {
92*61046927SAndroid Build Coastguard Worker return false;
93*61046927SAndroid Build Coastguard Worker }
94*61046927SAndroid Build Coastguard Worker
95*61046927SAndroid Build Coastguard Worker if (!st.st_mtime) {
96*61046927SAndroid Build Coastguard Worker fprintf(stderr, "Mesa: The provided filesystem timestamp for the cache "
97*61046927SAndroid Build Coastguard Worker "is bogus! Disabling On-disk cache.\n");
98*61046927SAndroid Build Coastguard Worker return false;
99*61046927SAndroid Build Coastguard Worker }
100*61046927SAndroid Build Coastguard Worker
101*61046927SAndroid Build Coastguard Worker *timestamp = st.st_mtime;
102*61046927SAndroid Build Coastguard Worker
103*61046927SAndroid Build Coastguard Worker return true;
104*61046927SAndroid Build Coastguard Worker }
105*61046927SAndroid Build Coastguard Worker
106*61046927SAndroid Build Coastguard Worker static inline bool
disk_cache_get_function_identifier(void * ptr,struct mesa_sha1 * ctx)107*61046927SAndroid Build Coastguard Worker disk_cache_get_function_identifier(void *ptr, struct mesa_sha1 *ctx)
108*61046927SAndroid Build Coastguard Worker {
109*61046927SAndroid Build Coastguard Worker uint32_t timestamp;
110*61046927SAndroid Build Coastguard Worker
111*61046927SAndroid Build Coastguard Worker #ifdef HAVE_DL_ITERATE_PHDR
112*61046927SAndroid Build Coastguard Worker const struct build_id_note *note = NULL;
113*61046927SAndroid Build Coastguard Worker if ((note = build_id_find_nhdr_for_addr(ptr))) {
114*61046927SAndroid Build Coastguard Worker _mesa_sha1_update(ctx, build_id_data(note), build_id_length(note));
115*61046927SAndroid Build Coastguard Worker } else
116*61046927SAndroid Build Coastguard Worker #endif
117*61046927SAndroid Build Coastguard Worker if (disk_cache_get_function_timestamp(ptr, ×tamp)) {
118*61046927SAndroid Build Coastguard Worker _mesa_sha1_update(ctx, ×tamp, sizeof(timestamp));
119*61046927SAndroid Build Coastguard Worker } else
120*61046927SAndroid Build Coastguard Worker return false;
121*61046927SAndroid Build Coastguard Worker return true;
122*61046927SAndroid Build Coastguard Worker }
123*61046927SAndroid Build Coastguard Worker #elif DETECT_OS_WINDOWS
124*61046927SAndroid Build Coastguard Worker bool
125*61046927SAndroid Build Coastguard Worker disk_cache_get_function_identifier(void *ptr, struct mesa_sha1 *ctx);
126*61046927SAndroid Build Coastguard Worker #else
127*61046927SAndroid Build Coastguard Worker static inline bool
disk_cache_get_function_identifier(void * ptr,struct mesa_sha1 * ctx)128*61046927SAndroid Build Coastguard Worker disk_cache_get_function_identifier(void *ptr, struct mesa_sha1 *ctx)
129*61046927SAndroid Build Coastguard Worker {
130*61046927SAndroid Build Coastguard Worker return false;
131*61046927SAndroid Build Coastguard Worker }
132*61046927SAndroid Build Coastguard Worker #endif
133*61046927SAndroid Build Coastguard Worker
134*61046927SAndroid Build Coastguard Worker /* Provide inlined stub functions if the shader cache is disabled. */
135*61046927SAndroid Build Coastguard Worker
136*61046927SAndroid Build Coastguard Worker #ifdef ENABLE_SHADER_CACHE
137*61046927SAndroid Build Coastguard Worker
138*61046927SAndroid Build Coastguard Worker /**
139*61046927SAndroid Build Coastguard Worker * Create a new cache object.
140*61046927SAndroid Build Coastguard Worker *
141*61046927SAndroid Build Coastguard Worker * This function creates the handle necessary for all subsequent cache_*
142*61046927SAndroid Build Coastguard Worker * functions.
143*61046927SAndroid Build Coastguard Worker *
144*61046927SAndroid Build Coastguard Worker * This cache provides two distinct operations:
145*61046927SAndroid Build Coastguard Worker *
146*61046927SAndroid Build Coastguard Worker * o Storage and retrieval of arbitrary objects by cryptographic
147*61046927SAndroid Build Coastguard Worker * name (or "key"). This is provided via disk_cache_put() and
148*61046927SAndroid Build Coastguard Worker * disk_cache_get().
149*61046927SAndroid Build Coastguard Worker *
150*61046927SAndroid Build Coastguard Worker * o The ability to store a key alone and check later whether the
151*61046927SAndroid Build Coastguard Worker * key was previously stored. This is provided via disk_cache_put_key()
152*61046927SAndroid Build Coastguard Worker * and disk_cache_has_key().
153*61046927SAndroid Build Coastguard Worker *
154*61046927SAndroid Build Coastguard Worker * The put_key()/has_key() operations are conceptually identical to
155*61046927SAndroid Build Coastguard Worker * put()/get() with no data, but are provided separately to allow for
156*61046927SAndroid Build Coastguard Worker * a more efficient implementation.
157*61046927SAndroid Build Coastguard Worker *
158*61046927SAndroid Build Coastguard Worker * In all cases, the keys are sequences of 20 bytes. It is anticipated
159*61046927SAndroid Build Coastguard Worker * that callers will compute appropriate SHA-1 signatures for keys,
160*61046927SAndroid Build Coastguard Worker * (though nothing in this implementation directly relies on how the
161*61046927SAndroid Build Coastguard Worker * names are computed). See mesa-sha1.h and _mesa_sha1_compute for
162*61046927SAndroid Build Coastguard Worker * assistance in computing SHA-1 signatures.
163*61046927SAndroid Build Coastguard Worker */
164*61046927SAndroid Build Coastguard Worker struct disk_cache *
165*61046927SAndroid Build Coastguard Worker disk_cache_create(const char *gpu_name, const char *timestamp,
166*61046927SAndroid Build Coastguard Worker uint64_t driver_flags);
167*61046927SAndroid Build Coastguard Worker
168*61046927SAndroid Build Coastguard Worker /**
169*61046927SAndroid Build Coastguard Worker * Destroy a cache object, (freeing all associated resources).
170*61046927SAndroid Build Coastguard Worker */
171*61046927SAndroid Build Coastguard Worker void
172*61046927SAndroid Build Coastguard Worker disk_cache_destroy(struct disk_cache *cache);
173*61046927SAndroid Build Coastguard Worker
174*61046927SAndroid Build Coastguard Worker /* Wait for all previous disk_cache_put() calls to be processed (used for unit
175*61046927SAndroid Build Coastguard Worker * testing).
176*61046927SAndroid Build Coastguard Worker */
177*61046927SAndroid Build Coastguard Worker void
178*61046927SAndroid Build Coastguard Worker disk_cache_wait_for_idle(struct disk_cache *cache);
179*61046927SAndroid Build Coastguard Worker
180*61046927SAndroid Build Coastguard Worker /**
181*61046927SAndroid Build Coastguard Worker * Remove the item in the cache under the name \key.
182*61046927SAndroid Build Coastguard Worker */
183*61046927SAndroid Build Coastguard Worker void
184*61046927SAndroid Build Coastguard Worker disk_cache_remove(struct disk_cache *cache, const cache_key key);
185*61046927SAndroid Build Coastguard Worker
186*61046927SAndroid Build Coastguard Worker /**
187*61046927SAndroid Build Coastguard Worker * Store an item in the cache under the name \key.
188*61046927SAndroid Build Coastguard Worker *
189*61046927SAndroid Build Coastguard Worker * The item can be retrieved later with disk_cache_get(), (unless the item has
190*61046927SAndroid Build Coastguard Worker * been evicted in the interim).
191*61046927SAndroid Build Coastguard Worker *
192*61046927SAndroid Build Coastguard Worker * Any call to disk_cache_put() may cause an existing, random item to be
193*61046927SAndroid Build Coastguard Worker * evicted from the cache.
194*61046927SAndroid Build Coastguard Worker */
195*61046927SAndroid Build Coastguard Worker void
196*61046927SAndroid Build Coastguard Worker disk_cache_put(struct disk_cache *cache, const cache_key key,
197*61046927SAndroid Build Coastguard Worker const void *data, size_t size,
198*61046927SAndroid Build Coastguard Worker struct cache_item_metadata *cache_item_metadata);
199*61046927SAndroid Build Coastguard Worker
200*61046927SAndroid Build Coastguard Worker /**
201*61046927SAndroid Build Coastguard Worker * Store an item in the cache under the name \key without copying the data param.
202*61046927SAndroid Build Coastguard Worker *
203*61046927SAndroid Build Coastguard Worker * The item can be retrieved later with disk_cache_get(), (unless the item has
204*61046927SAndroid Build Coastguard Worker * been evicted in the interim).
205*61046927SAndroid Build Coastguard Worker *
206*61046927SAndroid Build Coastguard Worker * Any call to disk_cache_put() may cause an existing, random item to be
207*61046927SAndroid Build Coastguard Worker * evicted from the cache.
208*61046927SAndroid Build Coastguard Worker *
209*61046927SAndroid Build Coastguard Worker * @p data will be freed
210*61046927SAndroid Build Coastguard Worker */
211*61046927SAndroid Build Coastguard Worker void
212*61046927SAndroid Build Coastguard Worker disk_cache_put_nocopy(struct disk_cache *cache, const cache_key key,
213*61046927SAndroid Build Coastguard Worker void *data, size_t size,
214*61046927SAndroid Build Coastguard Worker struct cache_item_metadata *cache_item_metadata);
215*61046927SAndroid Build Coastguard Worker
216*61046927SAndroid Build Coastguard Worker /**
217*61046927SAndroid Build Coastguard Worker * Retrieve an item previously stored in the cache with the name <key>.
218*61046927SAndroid Build Coastguard Worker *
219*61046927SAndroid Build Coastguard Worker * The item must have been previously stored with a call to disk_cache_put().
220*61046927SAndroid Build Coastguard Worker *
221*61046927SAndroid Build Coastguard Worker * If \size is non-NULL, then, on successful return, it will be set to the
222*61046927SAndroid Build Coastguard Worker * size of the object.
223*61046927SAndroid Build Coastguard Worker *
224*61046927SAndroid Build Coastguard Worker * \return A pointer to the stored object if found. NULL if the object
225*61046927SAndroid Build Coastguard Worker * is not found, or if any error occurs, (memory allocation failure,
226*61046927SAndroid Build Coastguard Worker * filesystem error, etc.). The returned data is malloc'ed so the
227*61046927SAndroid Build Coastguard Worker * caller should call free() it when finished.
228*61046927SAndroid Build Coastguard Worker */
229*61046927SAndroid Build Coastguard Worker void *
230*61046927SAndroid Build Coastguard Worker disk_cache_get(struct disk_cache *cache, const cache_key key, size_t *size);
231*61046927SAndroid Build Coastguard Worker
232*61046927SAndroid Build Coastguard Worker /**
233*61046927SAndroid Build Coastguard Worker * Store the name \key within the cache, (without any associated data).
234*61046927SAndroid Build Coastguard Worker *
235*61046927SAndroid Build Coastguard Worker * Later this key can be checked with disk_cache_has_key(), (unless the key
236*61046927SAndroid Build Coastguard Worker * has been evicted in the interim).
237*61046927SAndroid Build Coastguard Worker *
238*61046927SAndroid Build Coastguard Worker * Any call to disk_cache_put_key() may cause an existing, random key to be
239*61046927SAndroid Build Coastguard Worker * evicted from the cache.
240*61046927SAndroid Build Coastguard Worker */
241*61046927SAndroid Build Coastguard Worker void
242*61046927SAndroid Build Coastguard Worker disk_cache_put_key(struct disk_cache *cache, const cache_key key);
243*61046927SAndroid Build Coastguard Worker
244*61046927SAndroid Build Coastguard Worker /**
245*61046927SAndroid Build Coastguard Worker * Test whether the name \key was previously recorded in the cache.
246*61046927SAndroid Build Coastguard Worker *
247*61046927SAndroid Build Coastguard Worker * Return value: True if disk_cache_put_key() was previously called with
248*61046927SAndroid Build Coastguard Worker * \key, (and the key was not evicted in the interim).
249*61046927SAndroid Build Coastguard Worker *
250*61046927SAndroid Build Coastguard Worker * Note: disk_cache_has_key() will only return true for keys passed to
251*61046927SAndroid Build Coastguard Worker * disk_cache_put_key(). Specifically, a call to disk_cache_put() will not cause
252*61046927SAndroid Build Coastguard Worker * disk_cache_has_key() to return true for the same key.
253*61046927SAndroid Build Coastguard Worker */
254*61046927SAndroid Build Coastguard Worker bool
255*61046927SAndroid Build Coastguard Worker disk_cache_has_key(struct disk_cache *cache, const cache_key key);
256*61046927SAndroid Build Coastguard Worker
257*61046927SAndroid Build Coastguard Worker /**
258*61046927SAndroid Build Coastguard Worker * Compute the name \key from \data of given \size.
259*61046927SAndroid Build Coastguard Worker */
260*61046927SAndroid Build Coastguard Worker void
261*61046927SAndroid Build Coastguard Worker disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
262*61046927SAndroid Build Coastguard Worker cache_key key);
263*61046927SAndroid Build Coastguard Worker
264*61046927SAndroid Build Coastguard Worker void
265*61046927SAndroid Build Coastguard Worker disk_cache_set_callbacks(struct disk_cache *cache, disk_cache_put_cb put,
266*61046927SAndroid Build Coastguard Worker disk_cache_get_cb get);
267*61046927SAndroid Build Coastguard Worker
268*61046927SAndroid Build Coastguard Worker #else
269*61046927SAndroid Build Coastguard Worker
270*61046927SAndroid Build Coastguard Worker static inline struct disk_cache *
disk_cache_create(const char * gpu_name,const char * timestamp,uint64_t driver_flags)271*61046927SAndroid Build Coastguard Worker disk_cache_create(const char *gpu_name, const char *timestamp,
272*61046927SAndroid Build Coastguard Worker uint64_t driver_flags)
273*61046927SAndroid Build Coastguard Worker {
274*61046927SAndroid Build Coastguard Worker return NULL;
275*61046927SAndroid Build Coastguard Worker }
276*61046927SAndroid Build Coastguard Worker
277*61046927SAndroid Build Coastguard Worker static inline void
disk_cache_destroy(struct disk_cache * cache)278*61046927SAndroid Build Coastguard Worker disk_cache_destroy(struct disk_cache *cache)
279*61046927SAndroid Build Coastguard Worker {
280*61046927SAndroid Build Coastguard Worker }
281*61046927SAndroid Build Coastguard Worker
282*61046927SAndroid Build Coastguard Worker static inline void
disk_cache_put(struct disk_cache * cache,const cache_key key,const void * data,size_t size,struct cache_item_metadata * cache_item_metadata)283*61046927SAndroid Build Coastguard Worker disk_cache_put(struct disk_cache *cache, const cache_key key,
284*61046927SAndroid Build Coastguard Worker const void *data, size_t size,
285*61046927SAndroid Build Coastguard Worker struct cache_item_metadata *cache_item_metadata)
286*61046927SAndroid Build Coastguard Worker {
287*61046927SAndroid Build Coastguard Worker }
288*61046927SAndroid Build Coastguard Worker
289*61046927SAndroid Build Coastguard Worker static inline void
disk_cache_put_nocopy(struct disk_cache * cache,const cache_key key,void * data,size_t size,struct cache_item_metadata * cache_item_metadata)290*61046927SAndroid Build Coastguard Worker disk_cache_put_nocopy(struct disk_cache *cache, const cache_key key,
291*61046927SAndroid Build Coastguard Worker void *data, size_t size,
292*61046927SAndroid Build Coastguard Worker struct cache_item_metadata *cache_item_metadata)
293*61046927SAndroid Build Coastguard Worker {
294*61046927SAndroid Build Coastguard Worker }
295*61046927SAndroid Build Coastguard Worker
296*61046927SAndroid Build Coastguard Worker static inline void
disk_cache_remove(struct disk_cache * cache,const cache_key key)297*61046927SAndroid Build Coastguard Worker disk_cache_remove(struct disk_cache *cache, const cache_key key)
298*61046927SAndroid Build Coastguard Worker {
299*61046927SAndroid Build Coastguard Worker }
300*61046927SAndroid Build Coastguard Worker
301*61046927SAndroid Build Coastguard Worker static inline uint8_t *
disk_cache_get(struct disk_cache * cache,const cache_key key,size_t * size)302*61046927SAndroid Build Coastguard Worker disk_cache_get(struct disk_cache *cache, const cache_key key, size_t *size)
303*61046927SAndroid Build Coastguard Worker {
304*61046927SAndroid Build Coastguard Worker return NULL;
305*61046927SAndroid Build Coastguard Worker }
306*61046927SAndroid Build Coastguard Worker
307*61046927SAndroid Build Coastguard Worker static inline void
disk_cache_put_key(struct disk_cache * cache,const cache_key key)308*61046927SAndroid Build Coastguard Worker disk_cache_put_key(struct disk_cache *cache, const cache_key key)
309*61046927SAndroid Build Coastguard Worker {
310*61046927SAndroid Build Coastguard Worker }
311*61046927SAndroid Build Coastguard Worker
312*61046927SAndroid Build Coastguard Worker static inline bool
disk_cache_has_key(struct disk_cache * cache,const cache_key key)313*61046927SAndroid Build Coastguard Worker disk_cache_has_key(struct disk_cache *cache, const cache_key key)
314*61046927SAndroid Build Coastguard Worker {
315*61046927SAndroid Build Coastguard Worker return false;
316*61046927SAndroid Build Coastguard Worker }
317*61046927SAndroid Build Coastguard Worker
318*61046927SAndroid Build Coastguard Worker static inline void
disk_cache_compute_key(struct disk_cache * cache,const void * data,size_t size,cache_key key)319*61046927SAndroid Build Coastguard Worker disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
320*61046927SAndroid Build Coastguard Worker cache_key key)
321*61046927SAndroid Build Coastguard Worker {
322*61046927SAndroid Build Coastguard Worker }
323*61046927SAndroid Build Coastguard Worker
324*61046927SAndroid Build Coastguard Worker static inline void
disk_cache_set_callbacks(struct disk_cache * cache,disk_cache_put_cb put,disk_cache_get_cb get)325*61046927SAndroid Build Coastguard Worker disk_cache_set_callbacks(struct disk_cache *cache, disk_cache_put_cb put,
326*61046927SAndroid Build Coastguard Worker disk_cache_get_cb get)
327*61046927SAndroid Build Coastguard Worker {
328*61046927SAndroid Build Coastguard Worker }
329*61046927SAndroid Build Coastguard Worker
330*61046927SAndroid Build Coastguard Worker #endif /* ENABLE_SHADER_CACHE */
331*61046927SAndroid Build Coastguard Worker
332*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
333*61046927SAndroid Build Coastguard Worker }
334*61046927SAndroid Build Coastguard Worker #endif
335*61046927SAndroid Build Coastguard Worker
336*61046927SAndroid Build Coastguard Worker #endif /* CACHE_H */
337