summaryrefslogtreecommitdiff
path: root/freedreno/freedreno_priv.h
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2013-12-13 12:48:30 -0500
committerRob Clark <robclark@freedesktop.org>2013-12-13 15:48:10 -0500
commit068ea68b3f7ebd5efcfcc2f6ae417651423c8382 (patch)
treee094e44e8d01c33ab8e5d74aa489308f267d3eea /freedreno/freedreno_priv.h
parent1489811a805fb6b5b19d61fa99b9b962cc06bd22 (diff)
freedreno: add bo cache
Workloads which create many transient buffers cause significant CPU overhead in buffer allocation, zeroing, cache maint, and mmap setup. By caching and re-using existing buffers, the CPU overhead drops significantly. See: http://bloggingthemonkey.blogspot.com/2013/09/freedreno-update-moar-fps.html A simple time based policy is used for purging the cache. Once the kernel supports it, we could use madvise style API to handle memory pressure scenarios a bit better. Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno/freedreno_priv.h')
-rw-r--r--freedreno/freedreno_priv.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 69256f51..061d807e 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -59,6 +59,11 @@ struct fd_device_funcs {
void (*destroy)(struct fd_device *dev);
};
+struct fd_bo_bucket {
+ uint32_t size;
+ struct list_head list;
+};
+
struct fd_device {
int fd;
atomic_t refcnt;
@@ -75,8 +80,17 @@ struct fd_device {
void *handle_table, *name_table;
struct fd_device_funcs *funcs;
+
+ struct fd_bo_bucket cache_bucket[14 * 4];
+ int num_buckets;
+ time_t time;
};
+void fd_cleanup_bo_cache(struct fd_device *dev, time_t time);
+
+/* for where @table_lock is already held: */
+void fd_device_del_locked(struct fd_device *dev);
+
struct fd_pipe_funcs {
struct fd_ringbuffer * (*ringbuffer_new)(struct fd_pipe *pipe, uint32_t size);
int (*get_param)(struct fd_pipe *pipe, enum fd_param_id param, uint64_t *value);
@@ -120,6 +134,10 @@ struct fd_bo {
void *map;
atomic_t refcnt;
struct fd_bo_funcs *funcs;
+
+ int bo_reuse;
+ struct list_head list; /* bucket-list entry */
+ time_t free_time; /* time when added to bucket-list */
};
struct fd_bo *fd_bo_from_handle(struct fd_device *dev,