Mesa (gallium-0.2): gallium: fix alignment parameter passed to u_mmAllocMem ()

Brian Paul brianp at kemper.freedesktop.org
Wed Oct 29 20:56:38 UTC 2008


Module: Mesa
Branch: gallium-0.2
Commit: 8828d52348d81e1b9ec985200a430554873b5f4e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8828d52348d81e1b9ec985200a430554873b5f4e

Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Wed Oct 29 14:28:57 2008 -0600

gallium: fix alignment parameter passed to u_mmAllocMem()

Was 32, now 5.  The param is expressed as a power of two exponent.
The net effect is that the alignment was a no-op on X86 but on PPC we
always got the same memory address everytime rtasm_exec_malloc() was called.

---

 src/gallium/auxiliary/rtasm/rtasm_execmem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index df35363..be7433b 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@ -83,8 +83,8 @@ rtasm_exec_malloc(size_t size)
    init_heap();
 
    if (exec_heap) {
-      size = (size + 31) & ~31;
-      block = u_mmAllocMem( exec_heap, size, 32, 0 );
+      size = (size + 31) & ~31;  /* next multiple of 32 bytes */
+      block = u_mmAllocMem( exec_heap, size, 5, 0 ); /* 5 -> 32-byte alignment */
    }
 
    if (block)




More information about the mesa-commit mailing list