Commit eda44fbc authored by Wim Taymans's avatar Wim Taymans

memory: fix memory alignment

Fix compilation when POSIX_MEMALIGN is not set.
Debug the configured alignment.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=660300
parent 422d1245
...@@ -65,10 +65,10 @@ ...@@ -65,10 +65,10 @@
/* buffer alignment in bytes - 1 /* buffer alignment in bytes - 1
* an alignment of 7 would be the same as malloc() guarantees * an alignment of 7 would be the same as malloc() guarantees
*/ */
#ifdef HAVE_POSIX_MEMALIGN
#if defined(MEMORY_ALIGNMENT_MALLOC) #if defined(MEMORY_ALIGNMENT_MALLOC)
size_t gst_memory_alignment = 7; size_t gst_memory_alignment = 7;
#elif defined(MEMORY_ALIGNMENT_PAGESIZE) #elif defined(MEMORY_ALIGNMENT_PAGESIZE)
/* we fill this in in the _init method */
size_t gst_memory_alignment = 0; size_t gst_memory_alignment = 0;
#elif defined(MEMORY_ALIGNMENT) #elif defined(MEMORY_ALIGNMENT)
size_t gst_memory_alignment = MEMORY_ALIGNMENT - 1; size_t gst_memory_alignment = MEMORY_ALIGNMENT - 1;
...@@ -76,7 +76,6 @@ size_t gst_memory_alignment = MEMORY_ALIGNMENT - 1; ...@@ -76,7 +76,6 @@ size_t gst_memory_alignment = MEMORY_ALIGNMENT - 1;
#error "No memory alignment configured" #error "No memory alignment configured"
size_t gst_memory_alignment = 0; size_t gst_memory_alignment = 0;
#endif #endif
#endif /* HAVE_POSIX_MEMALIGN */
struct _GstAllocator struct _GstAllocator
{ {
...@@ -330,6 +329,8 @@ _priv_gst_memory_initialize (void) ...@@ -330,6 +329,8 @@ _priv_gst_memory_initialize (void)
#endif #endif
#endif #endif
GST_DEBUG ("memory alignment: %" G_GSIZE_FORMAT, gst_memory_alignment);
_default_mem_impl = gst_allocator_register (GST_ALLOCATOR_SYSMEM, &_mem_info); _default_mem_impl = gst_allocator_register (GST_ALLOCATOR_SYSMEM, &_mem_info);
_default_allocator = _default_mem_impl; _default_allocator = _default_mem_impl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment