Commit graph

37 commits

Author SHA1 Message Date
Hyunjun Ko
56ab7e0e1d dmabufallocator: adds gst_dmabuf_allocator_alloc_with_flags
If we can guarantee the lifetime of the fd is longer than
the memory, we can use DONT_CLOSE flag not to close when release.
But it's not provided in gstdmabuf yet while gstfdmemory does.

For example, in case of using VA-API or MSDK, we would need this api.
Otherwise we should call dup to duplicate the fd.

https://bugzilla.gnome.org/show_bug.cgi?id=794829
2018-04-26 16:40:54 -04:00
Edward Hervey
22c9e5f7c1 libs: Documentation cleanup
* Fix wrong naming, wrong types and typos
* Add missing sections
* Add missing documentation for entries
* Explicitely mark private structure entries
* Remove items that never existed
2018-04-02 08:53:28 +02:00
Nicolas Dufresne
681f41978a dmabufallocator: Fix build if LINUX_DMA_BUF_H is missing 2018-03-21 18:15:49 -04:00
Nicolas Dufresne
8ee306eb3f allocators: Add DMABuf synchronization
When doing CPU Access, some architecture may require caches to be
synchronize before use. Otherwise, some visual artifact may be
visible, as the CPU modification may still resides in cache.

https://bugzilla.gnome.org/show_bug.cgi?id=794216
2018-03-21 15:58:06 -04:00
Sebastian Dröge
67fb3b12ee gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:52 +03:00
Sebastian Dröge
7185a7ac98 allocators: Annotate constructors with (transfer floating)
GstAllocator is a GstObject and as such uses floating references.

https://bugzilla.gnome.org/show_bug.cgi?id=702960
2017-05-17 10:40:52 +03:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Nicolas Dufresne
c37b1e8c56 dmabuf: Make the allocator sub-classable
This should allos for cleaner code when implement such allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=768794
2016-11-03 13:19:12 -04:00
Aurélien Zanelli
4559feb69e dmabuf: remove 'allow-none' annotation in gst_dmabuf_allocator_alloc() doc
gst_dmabuf_allocator_alloc() ensure that passed allocator is a DMABuf
allocator, so that we can't pass NULL allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=754833
2015-09-23 10:01:41 -04:00
Wim Taymans
7c059b4530 allocators: make GstFdAllocator non-abstract
Make the GstFdAllocator non-abstract because it is perfectly possible
to make memory from a generic fd. Mark the memory as simply "fd".
2015-04-17 09:31:40 +02:00
Wim Taymans
3205e90e83 fdmemory: make a base class for allocating fd-backed memory
Make a base class that can help with allocating fd-backed memory.
Make dmabuf extend from the base class.
We can now make methods to check if memory has an fd and get the fd for
all the different types of fd-backed memory.
2015-03-18 15:12:03 +01:00
Wim Taymans
e6cb520036 fdmemory: add flags to control behaviour
Add some flags to the GstFdMemory to control how memory is mapped and
unmapped.
2015-03-15 17:27:33 +01:00
Wim Taymans
4e6fba8604 fdmemory: add fd backed GstMemory to separate file
Make a separate file for the code to handle the fd backed memory.
This would make it possible later to add other allocators also using
fd backed memory.
2015-03-15 15:26:28 +01:00
William Manley
c97f10d7d8 docs: gst_dmabuf_allocator_alloc: Improve documentation
https://bugzilla.gnome.org/show_bug.cgi?id=739545
2014-11-03 09:02:46 -05:00
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
Sebastian Dröge
26ff0ced15 allocators: Integrate into the documentation 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