summaryrefslogtreecommitdiff
path: root/freedreno/kgsl
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/kgsl
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/kgsl')
-rw-r--r--freedreno/kgsl/kgsl_bo.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c
index 0d019cb1..585851c7 100644
--- a/freedreno/kgsl/kgsl_bo.c
+++ b/freedreno/kgsl/kgsl_bo.c
@@ -80,9 +80,24 @@ static int kgsl_bo_offset(struct fd_bo *bo, uint64_t *offset)
static int kgsl_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op)
{
uint32_t timestamp = kgsl_bo_get_timestamp(to_kgsl_bo(bo));
- if (timestamp) {
- fd_pipe_wait(pipe, timestamp);
+
+ if (op & DRM_FREEDRENO_PREP_NOSYNC) {
+ uint32_t current;
+ int ret;
+
+ ret = kgsl_pipe_timestamp(to_kgsl_pipe(pipe), &current);
+ if (ret)
+ return ret;
+
+ if (timestamp > current)
+ return -EBUSY;
+
+ return 0;
}
+
+ if (timestamp)
+ fd_pipe_wait(pipe, timestamp);
+
return 0;
}