summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-04-04 12:40:14 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2015-04-03 11:15:55 +0100
commit3fd184da7811ba7073016316cfaa2d0a21d8c1c7 (patch)
treeef864a02df27bfa22fd102983937107e42fe93c9 /sys
parentcca103296d3e1c2754f1b629754c93c1dd9035c9 (diff)
downloadgst-plugins-base-3fd184da7811ba7073016316cfaa2d0a21d8c1c7.tar.gz
gst-plugins-base-3fd184da7811ba7073016316cfaa2d0a21d8c1c7.tar.xz
ximage: do not allocate extra alignment slack for shared memory
A previous patch increased allocations by 15 bytes in order to ensure 16 byte alignment for g_malloc blocks. However, shared memory is already block aligned, and this extra 15 bytes is not needed. Since shared memory limits are low compared to RAM, we remove this waste. https://bugzilla.gnome.org/show_bug.cgi?id=727236
Diffstat (limited to 'sys')
-rw-r--r--sys/ximage/ximagepool.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/ximage/ximagepool.c b/sys/ximage/ximagepool.c
index 6a0d12361..64d468763 100644
--- a/sys/ximage/ximagepool.c
+++ b/sys/ximage/ximagepool.c
@@ -213,7 +213,7 @@ ximage_memory_alloc (GstXImageBufferPool * xpool)
int (*handler) (Display *, XErrorEvent *);
gboolean success = FALSE;
GstXContext *xcontext;
- gint width, height, align = 15, offset;
+ gint width, height, align, offset;
GstXImageMemory *mem;
ximagesink = xpool->sink;
@@ -276,6 +276,7 @@ ximage_memory_alloc (GstXImageBufferPool * xpool)
mem->size, width, mem->ximage->bytes_per_line);
/* get shared memory */
+ align = 0;
mem->SHMInfo.shmid =
shmget (IPC_PRIVATE, mem->size + align, IPC_CREAT | 0777);
if (mem->SHMInfo.shmid == -1)
@@ -330,6 +331,8 @@ ximage_memory_alloc (GstXImageBufferPool * xpool)
allocsize =
GST_ROUND_UP_4 (mem->ximage->bytes_per_line) * mem->ximage->height;
+ /* we want 16 byte aligned memory, g_malloc may only give 8 */
+ align = 15;
mem->ximage->data = g_malloc (allocsize + align);
GST_LOG_OBJECT (ximagesink,
"non-XShm image size is %" G_GSIZE_FORMAT " (alloced: %u), width %d, "