Name of this allocator, to be used for example with gst_allocator_find() and
gst_memory_is_type().
Constant that defines the caps feature name for DMA buffer sharing.
It has to be used for non-mappable dma-buf only, i.e. when the underlying
memory is not mappable to user space. Or when the mapped memory contains
non meaningful data. It can be the case for protected content or when the
user wants explicitly avoid any software post processing.
In these cases all elements between the exported and the importer has to work
in passthrough mode. This is done by adding this caps feature.
When the memory is mappable for read and write requests then it is assumes
to be a fast path and so this caps feature should not be used. Though
according to the dma-buf protocol, while it is mapped it prevents the
exporter to migrate the buffer.
This caps feature should not serve at all the purpose of selecting the
@GST_ALLOCATOR_DMABUF allocator during caps negotiation.
When the exporter is the upstream element from the importer point of view,
the exporter should try to map the dma buffer at runtime (preferably during
decide_allocation phase). When it succeeds for #GST_MAP_READWRITE this caps
feature should not be used. This allows scalers, color converts and any image
processing filters to work directly on the dma buffer.
In this case the importer element should check all incoming memory using
gst_is_dmabuf_memory().
Private intance object for #GstDRMDumbAllocator.
Creates a new #GstDRMDumbAllocator for the specific device path. This
function can fail if the path does not exist, is not a DRM device or if
the DRM device doesnot support DUMB allocation.
a new DRM Dumb allocator. Use gst_object_unref()
to release the allocator after usage.
path to the DRM device to open
Creates a new #GstDRMDumbAllocator for the specific file desciptor. This
function can fail if the file descriptor is not a DRM device or if
the DRM device does not support DUMB allocation.
a new DRM Dumb allocator. Use gst_object_unref()
to release the allocator after usage.
file descriptor of the DRM device
Allocated a DRM buffer object for the specific @drm_fourcc, @width and
@height. Note that the DRM Dumb allocation interface is agnostic to the
pixel format. This @drm_fourcc is converted into a bpp (bit-per-pixel)
number and the height is scaled according to the sub-sampling.
a new DRM Dumb #GstMemory. Use gst_memory_unref()
to release the memory after usage.
the allocator instance
the DRM format to allocate for
padded width for this allocation
padded height for this allocation
the pitch as returned by the driver
This function allow verifying if the driver support dma-buf exportation.
%TRUE if the allocator support exporting dma-buf.
the #GstAllocator
Parent Class.
Base class for allocators with dmabuf-backed memory
Return a new dmabuf allocator.
a new dmabuf allocator. Use gst_object_unref() to
release the allocator after usage
Return a %GstMemory that wraps a dmabuf file descriptor.
a GstMemory based on @allocator.
When the buffer will be released dmabuf allocator will close the @fd.
The memory is only mmapped on gst_buffer_map() request.
allocator to be used for this memory
dmabuf file descriptor
memory size
Return a %GstMemory that wraps a dmabuf file descriptor.
a GstMemory based on @allocator.
When the buffer will be released the allocator will close the @fd unless
the %GST_FD_MEMORY_FLAG_DONT_CLOSE flag is specified.
The memory is only mmapped on gst_buffer_mmap() request.
allocator to be used for this memory
dmabuf file descriptor
memory size
extra #GstFdMemoryFlags
Base class for allocators with fd-backed memory
Return a new fd allocator.
a new fd allocator. Use gst_object_unref() to
release the allocator after usage
Return a %GstMemory that wraps a generic file descriptor.
a GstMemory based on @allocator.
When the buffer will be released the allocator will close the @fd unless
the %GST_FD_MEMORY_FLAG_DONT_CLOSE flag is specified.
The memory is only mmapped on gst_buffer_map() request.
allocator to be used for this memory
file descriptor
memory size
extra #GstFdMemoryFlags
Various flags to control the operation of the fd backed memory.
no flag
once the memory is mapped,
keep it mapped until the memory is destroyed.
do a private mapping instead of
the default shared mapping.
don't close the file descriptor when
the memory is freed. Since: 1.10
Implementations shall return the physicall memory address
that is backing the provided memory, or 0 if none.
Marker interface for allocators with physical address backed memory
Implementations shall return the physicall memory address
that is backing the provided memory, or 0 if none.
This is a subclass of #GstFdAllocator that implements the
gst_allocator_alloc() method using `memfd_create()` when available, POSIX
`shm_open()` otherwise. Platforms not supporting any of those (Windows) will
always return %NULL.
Note that allocating new shared memories has a significant performance cost,
it is thus recommended to keep a pool of pre-allocated #GstMemory, using
#GstBufferPool. For that reason, this allocator has the
%GST_ALLOCATOR_FLAG_NO_COPY flag set.
Get the #GstShmAllocator singleton previously registered with
gst_shm_allocator_init_once().
a #GstAllocator or %NULL if
gst_shm_allocator_init_once() has not been previously called.
Register a #GstShmAllocator using gst_allocator_register() with the name
%GST_ALLOCATOR_SHM. This is no-op after the first call.
Parent Class.
Return the file descriptor associated with @mem.
the file descriptor associated with the memory, or -1. The file
descriptor is still owned by the GstMemory. Use dup to take a copy
if you intend to use it beyond the lifetime of this GstMemory.
the memory to get the file descriptor
Exports a DMABuf from the DRM Bumb buffer object. One can check if this
feature is supported using gst_drm_dumb_allocator_has_prime_export();
a #GstMemory from #GstDmaBufAllocator wrapping the exported dma-buf
file descriptor.
the memory to export from
Return the DRM buffer object handle associated with @mem.
the DRM buffer object handle associated with the memory, or 0.
The handle is still owned by the GstMemory and cannot be used
beyond the lifetime of this GstMemory unless it is being passed
to DRM driver, which does handle a refcount internally.
the memory to get the handle from
Get the fd from @mem. Call gst_is_fd_memory() to check if @mem has
an fd.
the fd of @mem or -1 when there is no fd on @mem
#GstMemory
Check if @mem is dmabuf memory.
%TRUE if @mem is dmabuf memory, otherwise %FALSE
the memory to be check
%TRUE if @mem is DRM Dumb memory, otherwise %FALSE
the memory to be checked
Check if @mem is memory backed by an fd
%TRUE when @mem has an fd that can be retrieved with
gst_fd_memory_get_fd().
#GstMemory
whether the memory at @mem is backed by physical memory
a #GstMemory
Physical memory address that is backing @mem, or 0 if none
a #GstMemory