Commit graph

25 commits

Author SHA1 Message Date
Nicolas Dufresne
f260baf23b dmabuf: Ensure _get_fd() works even for shared memory
Fixes regression introduced by:

commit b60888fd4b
Author: Michael Olbrich <m.olbrich@pengutronix.de>
Date:   Tue May 20 11:18:56 2014 +0200

    dmabuf: share the mapping with shared copies of the memory

https://bugzilla.gnome.org/show_bug.cgi?id=730441
2014-07-11 09:47:04 +02:00
Michael Olbrich
42623c995e dmabuf: fix checking mmap flags
A simple '&' is not sufficiant. With mmapping_flags == PROT_READ and
prot == PROT_READ|PROT_WRITE the check produces the wrong result.
Change the check to make sure that prot is a subset of mmapping_flags.

https://bugzilla.gnome.org/show_bug.cgi?id=730559
2014-06-04 10:01:27 -04:00
Michael Olbrich
b60888fd4b dmabuf: share the mapping with shared copies of the memory
With lots of shared memory instances (e.g. created by a RTP payloader) the
overhead of duplicating the file descriptor and creating extra mappings is
significant. To avoid this, the parent memory maps the whole region and the
shared copies just reuse the same mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=730441
2014-05-20 09:42:02 -04:00
Sebastian Dröge
9f91b2769d dmabuf: Fix compilation if no mmap is available
Also #ifdef some more code paths that don't make sense without mmap.

https://bugzilla.gnome.org/show_bug.cgi?id=708372
2013-09-19 16:34:38 +02:00
Olivier Crête
d6187c00a6 dmabuf: Make it not a singleton
Makes it easier to track how many users there are

Also make it possible to create a dmabuf struct on systems without mmap,
it just won't be possible to map it.

https://bugzilla.gnome.org/show_bug.cgi?id=707793
2013-09-18 15:08:53 -04:00
Michael Olbrich
3c66c2a43d dmabuf: fix mmap counting
A successful gst_dmabuf_mem_map must always increment the mmap count.
Otherwise the first gst_dmabuf_mem_unmap will unmap the memory and all
other user will access unmapped memory.

https://bugzilla.gnome.org/show_bug.cgi?id=706680
2013-08-26 09:29:32 +02:00
Benjamin Gaignard
84a0934883 allocators: dmabuf: allow testing allocator type
In decide_allocation function some element may when to test the proposed allocator.
For example like this:
if (gst_query_get_n_allocation_params (query) > 0) {
	GstAllocator * allocator;
	GstAllocationParams params;
	gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
	if (g_strcmp0(allocator->mem_type, GST_ALLOCATOR_DMABUF) == 0)
		GST_DEBUG("got dmabuf allocator");
	else
		GST_DEBUG("got an other allocator");
}

https://bugzilla.gnome.org/show_bug.cgi?id=703659
2013-07-15 15:43:07 +02:00
Benjamin Gaignard
e90e2bb822 dmabuf: Make sure that memory is unmapped before releasing it
Be sure that memory is unmapped before releasing it.

https://bugzilla.gnome.org/show_bug.cgi?id=700411
2013-05-17 09:50:23 +02:00
Michael Olbrich
ced858fa65 dmabuf: set the initial memory size to the full size
https://bugzilla.gnome.org/show_bug.cgi?id=700427
2013-05-16 11:17:57 +02:00
Michael Olbrich
25dd73521d dmabuf: don't touch the GstMemory size
mem.size is the content size and should not be touch.
Save the mmap size instead.

https://bugzilla.gnome.org/show_bug.cgi?id=699566
2013-05-03 13:13:13 +02:00
Michael Olbrich
a4ba85b151 dmabuf: fix memory initialization
Without this the shared memory is broken

https://bugzilla.gnome.org/show_bug.cgi?id=699565
2013-05-03 13:11:14 +02:00
Michael Olbrich
72e32060b8 dmabuf: fix formating 2013-05-03 13:10:06 +02:00
Michael Olbrich
347898d516 dmabuf: handle mmap failure
Otherwise gstreamer may segfault trying to access MAP_FAILED.

https://bugzilla.gnome.org/show_bug.cgi?id=699470
2013-05-03 11:05:55 +02:00
Sebastian Dröge
c72aefb620 dmabuf: Use the fallback GstMemory copy function instead of our own
dup() on a dmabuf only gives a new handle, not a copy, thus doesn't
do what copy() is supposed to do.
2013-04-25 17:04:50 +02:00
Sebastian Dröge
5d499f1e14 dmabuf: Some code cleanup 2013-03-30 12:08:06 +01:00
Josep Torra
cd1f9ec992 dmabuf: Use correct print format specifier to fix a compiler warning 2013-03-10 18:05:28 +01:00
Sebastian Dröge
354d7ba302 dmabuf: The dmabuf allocator has a custom alloc function, mark it as such 2013-02-22 09:07:40 +01:00
Benjamin Gaignard
9a69f66ed1 dmabuf: Include config.h 2013-02-19 12:41:58 +01:00
Tim-Philipp Müller
1b1bb98256 allocators: add guard and minor clean-ups 2013-02-19 10:45:23 +00:00
Tim-Philipp Müller
4179fe42e0 allocators: add some since markers and misc other doc clean-ups 2013-02-19 09:40:31 +00:00
Tim-Philipp Müller
320c992b94 allocators: header clean-up 2013-02-19 09:35:10 +00:00
Sebastian Dröge
26ff0ced15 allocators: Integrate into the documentation 2013-02-19 10:05:38 +01:00
Sebastian Dröge
37f0067946 allocators: Add single-include header 2013-02-19 10:05:38 +01:00
Sebastian Dröge
76400ef226 dmabuf: Improve documentation and annotations a bit 2013-02-19 10:05:38 +01:00
Benjamin Gaignard
ceecdb8e1d allocators: Add dmabuf-based GstMemory and GstAllocator
Create new GstMemory and GstAllocator base on dmabuf.
Memory is not allocated/freed by userland but mapped/unmmaped
from a dmabuf file descriptor when requested.

This allocator is included in a new lib called libgstallocators

https://bugzilla.gnome.org/show_bug.cgi?id=693826
2013-02-19 10:05:38 +01:00