summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/xlib
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-12-11 08:58:39 -0700
committerBrian <[email protected]>2007-12-11 09:00:01 -0700
commit5b8b542cb2f10c5c39b9db18cd95e553ad06061b (patch)
tree0d05e0a8dda867ec268b1af25990df81a751bb8b /src/mesa/pipe/xlib
parent9f0e5642d80d746aa757a1e67dec15b0fd404e5d (diff)
Move align_malloc(), align_free() to p_util.h
Diffstat (limited to 'src/mesa/pipe/xlib')
-rw-r--r--src/mesa/pipe/xlib/xm_winsys.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c
index a03c9835a59..42c43387afe 100644
--- a/src/mesa/pipe/xlib/xm_winsys.c
+++ b/src/mesa/pipe/xlib/xm_winsys.c
@@ -35,11 +35,11 @@
#include "glxheader.h"
#include "xmesaP.h"
-#include "main/macros.h"
#include "pipe/p_winsys.h"
#include "pipe/p_format.h"
#include "pipe/p_context.h"
+#include "pipe/p_util.h"
#include "pipe/softpipe/sp_winsys.h"
#ifdef GALLIUM_CELL
@@ -49,47 +49,6 @@
#include "xm_winsys_aub.h"
-/** XXX from Mesa core */
-static void *
-align_malloc(size_t bytes, unsigned long alignment)
-{
-#if defined(HAVE_POSIX_MEMALIGN)
- void *mem;
-
- (void) posix_memalign(& mem, alignment, bytes);
- return mem;
-#else
- uintptr_t ptr, buf;
-
- assert( alignment > 0 );
-
- ptr = (uintptr_t) malloc(bytes + alignment + sizeof(void *));
- if (!ptr)
- return NULL;
-
- buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
- *(uintptr_t *)(buf - sizeof(void *)) = ptr;
-
- return (void *) buf;
-#endif /* defined(HAVE_POSIX_MEMALIGN) */
-}
-
-
-/** XXX from Mesa core */
-static void
-align_free(void *ptr)
-{
-#if defined(HAVE_POSIX_MEMALIGN)
- free(ptr);
-#else
- void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
- void *realAddr = *cubbyHole;
- free(realAddr);
-#endif /* defined(HAVE_POSIX_MEMALIGN) */
-}
-
-
-
/**
* Low-level OS/window system memory buffer
*/