Mesa (7.8): radeon: Fix buffer object unmap to be called only once for dma buffers.

Pauli Nieminen suokko at kemper.freedesktop.org
Tue Mar 16 08:00:49 PDT 2010


Module: Mesa
Branch: 7.8
Commit: e9c2c4a76466fc1ccfbf4d5de048414f7126b940
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9c2c4a76466fc1ccfbf4d5de048414f7126b940

Author: Pauli Nieminen <suokkos at gmail.com>
Date:   Mon Mar 15 10:30:18 2010 +0200

radeon: Fix buffer object unmap to be called only once for dma buffers.

If flush happens inside radeonRefillCurrentMaRegion the last dma buffer would
be unmapped twice. Unmapping buffer when moving buffer to wait list fixes the
mapping error.

---

 src/mesa/drivers/dri/radeon/radeon_dma.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c
index 22499bc..6b7690c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_dma.c
+++ b/src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -184,9 +184,6 @@ void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size)
 	radeon_print(RADEON_DMA, RADEON_NORMAL, "%s size %d minimum_size %d\n",
 			__FUNCTION__, size, rmesa->dma.minimum_size);
 
-	if (!is_empty_list(&rmesa->dma.reserved))
-		radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo);
-
 	if (is_empty_list(&rmesa->dma.free)
 	      || last_elem(&rmesa->dma.free)->bo->size < size) {
 		dma_bo = CALLOC_STRUCT(radeon_dma_bo);
@@ -336,9 +333,6 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
 		legacy_track_pending(rmesa->radeonScreen->bom, 0);
 	}
 
-	if (!is_empty_list(&rmesa->dma.reserved))
-		radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo);
-
 	/* move waiting bos to free list.
 	   wait list provides gpu time to handle data before reuse */
 	foreach_s(dma_bo, temp, &rmesa->dma.wait) {
@@ -368,6 +362,7 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
 
 	/* move reserved to wait list */
 	foreach_s(dma_bo, temp, &rmesa->dma.reserved) {
+		radeon_bo_unmap(dma_bo->bo);
 		/* free objects that are too small to be used because of large request */
 		if (dma_bo->bo->size < rmesa->dma.minimum_size) {
 		   radeon_bo_unref(dma_bo->bo);



More information about the mesa-commit mailing list