diff options
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer/pb_cache.h')
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_cache.h | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.h b/src/gallium/auxiliary/pipebuffer/pb_cache.h index 4afa0c804ec..2fa50e1a20f 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_cache.h +++ b/src/gallium/auxiliary/pipebuffer/pb_cache.h @@ -30,8 +30,9 @@ #define PB_CACHE_H #include "pb_buffer.h" +#include "util/simple_mtx.h" #include "util/list.h" -#include "os/os_thread.h" +#include "util/u_thread.h" /** * Statically inserted into the driver-specific buffer structure. @@ -39,9 +40,7 @@ struct pb_cache_entry { struct list_head head; - struct pb_buffer *buffer; /**< Pointer to the structure this is part of. */ - struct pb_cache *mgr; - int64_t start, end; /**< Caching time interval */ + unsigned start_ms; /**< Cached start time */ unsigned bucket_index; }; @@ -52,33 +51,35 @@ struct pb_cache */ struct list_head *buckets; - mtx_t mutex; + simple_mtx_t mutex; void *winsys; uint64_t cache_size; uint64_t max_cache_size; unsigned num_heaps; - unsigned usecs; + unsigned msecs; + int64_t msecs_base_time; unsigned num_buffers; unsigned bypass_usage; float size_factor; + unsigned offsetof_pb_cache_entry; /* offsetof(driver_bo, pb_cache_entry) */ - void (*destroy_buffer)(void *winsys, struct pb_buffer *buf); - bool (*can_reclaim)(void *winsys, struct pb_buffer *buf); + void (*destroy_buffer)(void *winsys, struct pb_buffer_lean *buf); + bool (*can_reclaim)(void *winsys, struct pb_buffer_lean *buf); }; -void pb_cache_add_buffer(struct pb_cache_entry *entry); -struct pb_buffer *pb_cache_reclaim_buffer(struct pb_cache *mgr, pb_size size, +void pb_cache_add_buffer(struct pb_cache *mgr, struct pb_cache_entry *entry); +struct pb_buffer_lean *pb_cache_reclaim_buffer(struct pb_cache *mgr, pb_size size, unsigned alignment, unsigned usage, unsigned bucket_index); -void pb_cache_release_all_buffers(struct pb_cache *mgr); +unsigned pb_cache_release_all_buffers(struct pb_cache *mgr); void pb_cache_init_entry(struct pb_cache *mgr, struct pb_cache_entry *entry, - struct pb_buffer *buf, unsigned bucket_index); -void pb_cache_init(struct pb_cache *mgr, uint num_heaps, - uint usecs, float size_factor, + struct pb_buffer_lean *buf, unsigned bucket_index); +void pb_cache_init(struct pb_cache *mgr, unsigned num_heaps, + unsigned usecs, float size_factor, unsigned bypass_usage, uint64_t maximum_cache_size, - void *winsys, - void (*destroy_buffer)(void *winsys, struct pb_buffer *buf), - bool (*can_reclaim)(void *winsys, struct pb_buffer *buf)); + unsigned offsetof_pb_cache_entry, void *winsys, + void (*destroy_buffer)(void *winsys, struct pb_buffer_lean *buf), + bool (*can_reclaim)(void *winsys, struct pb_buffer_lean *buf)); void pb_cache_deinit(struct pb_cache *mgr); #endif |