Mesa (r300-bufmgr): radeon: align up the allocations for vram

Dave Airlie airlied at kemper.freedesktop.org
Mon Oct 13 05:45:06 UTC 2008


Module: Mesa
Branch: r300-bufmgr
Commit: 5184c412b17e5319aefbc61ccdfd060608d1d6bd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5184c412b17e5319aefbc61ccdfd060608d1d6bd

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Oct 13 15:44:52 2008 +1000

radeon: align up the allocations for vram

The blits later on assume a 4k alignment without ever enforcing it.
the kernel was producing wierd debug messages

---

 src/mesa/drivers/dri/r300/r300_mem.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_mem.c b/src/mesa/drivers/dri/r300/r300_mem.c
index cb5ca23..46dab34 100644
--- a/src/mesa/drivers/dri/r300/r300_mem.c
+++ b/src/mesa/drivers/dri/r300/r300_mem.c
@@ -591,6 +591,9 @@ static dri_bo *vram_alloc(radeon_bufmgr_classic *bufmgr, const char *name,
 		unsigned long size, unsigned int alignment)
 {
 	radeon_bo_vram* bo = (radeon_bo_vram*)calloc(1, sizeof(radeon_bo_vram));
+	uint32_t pgsize = getpagesize() - 1;
+
+	size = (size + pgsize) & ~pgsize;
 
 	bo->base.functions = &vram_bo_functions;
 	bo->base.base.virtual = malloc(size);




More information about the mesa-commit mailing list