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>
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;
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;