mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 06:30:10 +01:00
radeon: Fix legacy bo not to reuse dma buffers before refcount is 1.
This should help detecting possible memory leaks with dma buffers and prevent possible visual corruption if data would be overwriten too early.
This commit is contained in:
parent
7e3b8b0d8f
commit
284a7af274
1 changed files with 7 additions and 2 deletions
|
|
@ -207,7 +207,6 @@ again_alloc:
|
|||
counter on unused buffers for later freeing them from
|
||||
begin of list */
|
||||
dma_bo = last_elem(&rmesa->dma.free);
|
||||
assert(dma_bo->bo->cref == 1);
|
||||
remove_from_list(dma_bo);
|
||||
insert_at_head(&rmesa->dma.reserved, dma_bo);
|
||||
}
|
||||
|
|
@ -307,6 +306,10 @@ static int radeon_bo_is_idle(struct radeon_bo* bo)
|
|||
WARN_ONCE("Your libdrm or kernel doesn't have support for busy query.\n"
|
||||
"This may cause small performance drop for you.\n");
|
||||
}
|
||||
/* Protect against bug in legacy bo handling that causes bos stay
|
||||
* referenced even after they should be freed */
|
||||
if (bo->cref != 1)
|
||||
return 0;
|
||||
return ret != -EBUSY;
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +346,9 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
|
|||
foreach_s(dma_bo, temp, &rmesa->dma.wait) {
|
||||
if (dma_bo->expire_counter == time) {
|
||||
WARN_ONCE("Leaking dma buffer object!\n");
|
||||
radeon_bo_unref(dma_bo->bo);
|
||||
/* force free of buffer so we don't realy start
|
||||
* leaking stuff now*/
|
||||
while ((dma_bo->bo = radeon_bo_unref(dma_bo->bo))) {}
|
||||
remove_from_list(dma_bo);
|
||||
FREE(dma_bo);
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue