summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2014-10-12 19:28:51 +0100
committerRussell King <rmk@arm.linux.org.uk>2014-10-12 20:19:53 +0100
commitbca50fc025636b481a3a1a2b95a1634955d1eb62 (patch)
tree3c9694af4988b6e3b9e9f49a07c04e5d8f65c0f6
parenta6eafa1b0bb627d67892ff5fabb6e87ea11afa82 (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>
-rw-r--r--armada_bufmgr.c13
-rw-r--r--armada_bufmgr.h3
-rw-r--r--debian/changelog3
3 files changed, 18 insertions, 1 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;
diff --git a/armada_bufmgr.h b/armada_bufmgr.h
index 4acc774..f4772fd 100644
--- a/armada_bufmgr.h
+++ b/armada_bufmgr.h
@@ -1,6 +1,8 @@
#ifndef DRM_ARMADA_GEM_H
#define DRM_ARMADA_GEM_H
+#include <stdint.h>
+
enum drm_armada_bo_type {
DRM_ARMADA_BO_DUMB,
DRM_ARMADA_BO_LINEAR,
@@ -18,6 +20,7 @@ struct drm_armada_bo {
enum drm_armada_bo_type type;
};
+int drm_armada_cache_reap(struct drm_armada_bufmgr *mgr);
int drm_armada_init(int fd, struct drm_armada_bufmgr **mgr);
void drm_armada_fini(struct drm_armada_bufmgr *);
diff --git a/debian/changelog b/debian/changelog
index 93c57b8..c6aa895 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
libdrm-armada (2.0.3-1) unstable; urgency=low
* Add drm_armada_bo_create_size()
+ * Add drm_armada_cache_reap()
- -- Russell King <rmk_cubox@arm.linux.org.uk> Sat, 20 Sep 2014 23:07:21 +0100
+ -- Russell King <rmk_cubox@arm.linux.org.uk> Sat, 12 Oct 2014 19:31:04 +0100
libdrm-armada (2.0.2-1) unstable; urgency=low