[Mesa-dev] [PATCH 4/7] gallium/radeon: Delete uppermost virtual address space hole if it's at the top.

Michel Dänzer michel at daenzer.net
Wed Aug 15 08:40:15 PDT 2012


From: Michel Dänzer <michel.daenzer at amd.com>

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 43fa7b2..998dcd8 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -287,11 +287,22 @@ static void radeon_bomgr_force_va(struct radeon_bomgr *mgr, uint64_t va, uint64_
 
 static void radeon_bomgr_free_va(struct radeon_bomgr *mgr, uint64_t va, uint64_t size)
 {
+    struct radeon_bo_va_hole *hole;
+
     pipe_mutex_lock(mgr->bo_va_mutex);
     if ((va + size) == mgr->va_offset) {
         mgr->va_offset = va;
+        /* Delete uppermost hole if it reaches the new top */
+        LIST_FOR_EACH_ENTRY_FROM(hole, mgr->va_holes.next,
+                                 mgr->va_holes.next->next, list) {
+            if ((hole->offset + hole->size) == va) {
+                mgr->va_offset = hole->offset;
+                list_del(&hole->list);
+                FREE(hole);
+            }
+        }
     } else {
-        struct radeon_bo_va_hole *hole, *next;
+        struct radeon_bo_va_hole *next;
 
         hole = container_of(&mgr->va_holes, hole, list);
         LIST_FOR_EACH_ENTRY(next, &mgr->va_holes, list) {
-- 
1.7.10.4



More information about the mesa-dev mailing list