gallium/radeon: Create hole for waste when allocating from va_offset.
authorMichel Dänzer <michel.daenzer@amd.com>
Wed, 15 Aug 2012 13:48:34 +0000 (15:48 +0200)
committerMichel Dänzer <michel@daenzer.net>
Thu, 16 Aug 2012 09:58:24 +0000 (11:58 +0200)
Otherwise, the wasted area could never be used for an allocation again.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c

index 79355af79953f0182e41d201efeaed27f7f1d0c2..9bddcd347c31835d1cd85ac3d559a35edba5b4d3 100644 (file)
@@ -246,6 +246,12 @@ static uint64_t radeon_bomgr_find_va(struct radeon_bomgr *mgr, uint64_t size, ui
         waste = offset % alignment;
         waste = waste ? alignment - waste : 0;
     }
+    if (waste) {
+        n = CALLOC_STRUCT(radeon_bo_va_hole);
+        n->size = waste;
+        n->offset = offset;
+        list_add(&n->list, &mgr->va_holes);
+    }
     offset += waste;
     mgr->va_offset += size + waste;
     pipe_mutex_unlock(mgr->bo_va_mutex);