diff options
author | Russell King <rmk@arm.linux.org.uk> | 2014-10-12 19:28:51 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2014-10-12 20:19:53 +0100 |
commit | bca50fc025636b481a3a1a2b95a1634955d1eb62 (patch) | |
tree | 3c9694af4988b6e3b9e9f49a07c04e5d8f65c0f6 /armada_bufmgr.c | |
parent | a6eafa1b0bb627d67892ff5fabb6e87ea11afa82 (diff) |
Add drm_armada_cache_reap()
Provide an API to allow libdrm-armada's internal BO cache to be reaped.
This API returns TRUE if there are still BOs in the cache which may be
reaped at a later time, which allows users to schedule further reaps.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Diffstat (limited to 'armada_bufmgr.c')
-rw-r--r-- | armada_bufmgr.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/armada_bufmgr.c b/armada_bufmgr.c index 99eddbf..938138f 100644 --- a/armada_bufmgr.c +++ b/armada_bufmgr.c @@ -595,6 +595,19 @@ int drm_armada_bo_subdata(struct drm_armada_bo *dbo, unsigned long offset, return drmIoctl(fd, DRM_IOCTL_ARMADA_GEM_PWRITE, &arg); } +int drm_armada_cache_reap(struct drm_armada_bufmgr *mgr) +{ + struct timespec time; + + if (!DRMLISTEMPTY(&mgr->cache.head)) { + clock_gettime(CLOCK_MONOTONIC, &time); + + armada_bo_cache_clean(&mgr->cache, time.tv_sec); + } + + return !DRMLISTEMPTY(&mgr->cache.head); +} + int drm_armada_init(int fd, struct drm_armada_bufmgr **mgrp) { struct drm_armada_bufmgr *mgr; |