diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2012-04-26 11:44:11 +0200 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2012-08-16 11:58:23 +0200 |
commit | f5fe81daea622f8f043edc19fb61ba367b6958aa (patch) | |
tree | 9baf9eea82ed9ec4ce1ea3192c3af5774d2c3623 | |
parent | 206d07625c9fd69c7d00a8722bd7390c5215bfe2 (diff) |
gallium/radeon: Fix losing holes when allocating virtual address space.
If a hole exactly matches the allocated size plus alignment, we would fail to
preserve the alignment as a hole. This would result in never being able to use
the alignment area for an allocation again.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index f09e7e819cb..a01cc15b1ca 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -221,7 +221,7 @@ static uint64_t radeon_bomgr_find_va(struct radeon_bomgr *mgr, uint64_t size, ui pipe_mutex_unlock(mgr->bo_va_mutex); return offset; } - if ((hole->size - waste) >= size) { + if ((hole->size - waste) > size) { if (waste) { n = CALLOC_STRUCT(radeon_bo_va_hole); n->size = waste; @@ -233,6 +233,11 @@ static uint64_t radeon_bomgr_find_va(struct radeon_bomgr *mgr, uint64_t size, ui pipe_mutex_unlock(mgr->bo_va_mutex); return offset; } + if ((hole->size - waste) == size) { + hole->size = waste; + pipe_mutex_unlock(mgr->bo_va_mutex); + return offset; + } } offset = mgr->va_offset; |