From 07d788ea1e7787c07ab5d3a4ac1c873e409bd50b Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 12 Oct 2014 19:47:43 +0100 Subject: Better tracking of re-usable bos Whether a bo can be re-used or not depends whether we have flink'd it, whether it was imported from a global name, or imported from a fd. Signed-off-by: Russell King --- armada_bufmgr.c | 6 +++++- debian/changelog | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/armada_bufmgr.c b/armada_bufmgr.c index 938138f..0803309 100644 --- a/armada_bufmgr.c +++ b/armada_bufmgr.c @@ -74,6 +74,7 @@ struct armada_bo { size_t alloc_size; /* Allocated size */ uint32_t ref; /* Reference count */ uint32_t name; /* Global name */ + uint8_t reusable; }; #define to_armada_bo(_bo) container_of(_bo, struct armada_bo, bo) @@ -326,6 +327,7 @@ struct drm_armada_bo *drm_armada_bo_create(struct drm_armada_bufmgr *mgr, bo->alloc_size = alloc_size; bo->ref = 1; bo->mgr = mgr; + bo->reusable = 1; /* Add it to the handle hash table */ assert(drmHashInsert(mgr->handle_hash, bo->bo.handle, bo) == 0); @@ -383,6 +385,7 @@ struct drm_armada_bo *drm_armada_bo_create_size(struct drm_armada_bufmgr *mgr, bo->alloc_size = alloc_size; bo->ref = 1; bo->mgr = mgr; + bo->reusable = 1; /* Add it to the handle hash table */ assert(drmHashInsert(mgr->handle_hash, bo->bo.handle, bo) == 0); @@ -492,7 +495,7 @@ void drm_armada_bo_put(struct drm_armada_bo *dbo) if (bo->ref-- == 1) { int ret; - if (bo->bo.type == DRM_ARMADA_BO_SHMEM) + if (bo->reusable) armada_bo_cache_put(bo); else armada_bo_free(bo); @@ -514,6 +517,7 @@ int drm_armada_bo_flink(struct drm_armada_bo *dbo, uint32_t *name) if (ret) return ret; bo->name = flink.name; + bo->reusable = 0; assert(drmHashInsert(bo->mgr->name_hash, bo->name, bo) == 0); } diff --git a/debian/changelog b/debian/changelog index c6aa895..3c0c83a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ libdrm-armada (2.0.3-1) unstable; urgency=low * Add drm_armada_bo_create_size() * Add drm_armada_cache_reap() + * Better tracking of re-usable BOs - -- Russell King Sat, 12 Oct 2014 19:31:04 +0100 + -- Russell King Sat, 12 Oct 2014 19:50:35 +0100 libdrm-armada (2.0.2-1) unstable; urgency=low -- cgit