_mesa_align_malloc and friends.
OPT_FLAGS = -O2
PIC_FLAGS = -fPIC
-DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM -DHZ=100
+DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM \
+ -DHZ=100 -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = -I/usr/X11R6/include
EXPAT_INCLUDES = -I/usr/local/include
X11_INCLUDES = -I/usr/X11R6/include
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
- -DGLX_DIRECT_RENDERING -DHAVE_ALIAS
+ -DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
CFLAGS = -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math \
$(ASM_FLAGS) $(X11_INCLUDES) $(DEFINES)
ARCH_FLAGS ?=
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
- -D_BSD_SOURCE -DPTHREADS -DUSE_XSHM
+ -D_BSD_SOURCE -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = -I/usr/X11R6/include
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
- -DGLX_DIRECT_RENDERING -DHAVE_ALIAS
+ -DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = -I/usr/X11R6/include
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
- -DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DUSE_XCB
+ -DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DUSE_XCB -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = `pkg-config --cflags-only-I x11` `pkg-config --cflags-only-I xcb` `pkg-config --cflags-only-I xcb-glx`
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
- -DPTHREADS -DHAVE_ALIAS
+ -DPTHREADS -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = -I/usr/X11R6/include
ARCH_FLAGS ?=
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
- -D_BSD_SOURCE -D_GNU_SOURCE \
+ -D_BSD_SOURCE -D_GNU_SOURCE -DHAVE_POSIX_MEMALIGN \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC -DIN_DRI_DRIVER
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
OPT_FLAGS = -O2
PIC_FLAGS = -fPIC
-DEFINES = -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM
+DEFINES = -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = -I/usr/X11R6/include
void *
_mesa_align_malloc(size_t bytes, unsigned long alignment)
{
+#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+ void *mem;
+
+ (void) posix_memalign(& mem, alignment, bytes);
+ return mem;
+#else
uintptr_t ptr, buf;
ASSERT( alignment > 0 );
#endif
return (void *) buf;
+#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
}
/**
void *
_mesa_align_calloc(size_t bytes, unsigned long alignment)
{
+#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+ void *mem;
+
+ mem = _mesa_align_malloc(bytes, alignment);
+ if (mem != NULL) {
+ (void) memset(mem, 0, bytes);
+ }
+
+ return mem;
+#else
uintptr_t ptr, buf;
ASSERT( alignment > 0 );
#endif
return (void *)buf;
+#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
}
/**
void
_mesa_align_free(void *ptr)
{
-#if 0
- _mesa_free( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) );
+#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+ free(ptr);
#else
void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
void *realAddr = *cubbyHole;
_mesa_free(realAddr);
-#endif
+#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
}
/**