VA allocators
source link: https://gstreamer.freedesktop.org/documentation/valib/gstvaallocator.html?gi-language=c
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
VA allocators
There are two types of VA allocators:
VaAllocator
A pooled memory allocator backed by VASurfaceID.
Since : 1.22
Constructors
gst_va_allocator_new
GstAllocator * gst_va_allocator_new (GstVaDisplay * display, GArray * surface_formats)
Instanciate a new pooled GstAllocator backed by VASurfaceID.
Parameters:
display
–
surface_formats
(
[element-typeguint][transfer: full])
–
a GArray of valid GstVideoFormat for surfaces in current VA context.
Since : 1.22
Functions
gst_va_allocator_alloc
GstMemory * gst_va_allocator_alloc (GstAllocator * allocator)
Allocate a new VASurfaceID backed GstMemory.
Parameters:
allocator
–
Since : 1.22
gst_va_allocator_flush
gst_va_allocator_flush (GstAllocator * allocator)
Removes all the memories in allocator's pool.
Parameters:
allocator
–
Since : 1.22
gst_va_allocator_get_format
gboolean gst_va_allocator_get_format (GstAllocator * allocator, GstVideoInfo * info, guint * usage_hint, gboolean * use_derived)
Gets current internal configuration of allocator.
Parameters:
allocator
–
info
(
[out][optional])
–
usage_hint
(
[out][optional])
–
VA usage hint
use_derived
(
[out][optional])
–
whether derived images are used for buffer mapping.
Since : 1.22
gst_va_allocator_peek_display
GstVaDisplay * gst_va_allocator_peek_display (GstAllocator * allocator)
Parameters:
allocator
–
the display which this allocator belongs to. The reference of the display is unchanged.
Since : 1.22
gst_va_allocator_prepare_buffer
gboolean gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer)
This method will populate buffer with pooled VASurfaceID memories. It doesn't allocate new VASurfacesID.
Since : 1.22
gst_va_allocator_set_format
gboolean gst_va_allocator_set_format (GstAllocator * allocator, GstVideoInfo * info, guint usage_hint, GstVaFeature feat_use_derived)
Sets the configuration defined by info, usage_hint and use_derived for allocator, and it tries the configuration, if allocator has not allocated memories yet.
If allocator has memory allocated already, and frame size and format in info are the same as currently configured in allocator, the rest of info parameters are updated internally.
Parameters:
allocator
–
info
(
[inout])
–
usage_hint
–
VA usage hint
feat_use_derived
–
Since : 1.22
gst_va_allocator_set_hacks
gst_va_allocator_set_hacks (GstAllocator * allocator, guint32 hacks)
Internal method to set allocator specific logic changes.
Since : 1.22
gst_va_allocator_setup_buffer
gboolean gst_va_allocator_setup_buffer (GstAllocator * allocator, GstBuffer * buffer)
Populates an empty buffer with a VASuface backed GstMemory.
Since : 1.22
VaDmabufAllocator
A pooled memory allocator backed by the DMABufs exported from a VASurfaceID. Also it is possible to import DMAbufs into a VASurfaceID.
Since : 1.22
Constructors
gst_va_dmabuf_allocator_new
GstAllocator * gst_va_dmabuf_allocator_new (GstVaDisplay * display)
Instanciate a new pooled allocator backed with both DMABuf and VASurfaceID.
Parameters:
display
–
a new allocated GstAllocator
Since : 1.22
Functions
gst_va_dmabuf_allocator_flush
gst_va_dmabuf_allocator_flush (GstAllocator * allocator)
Removes all the memories in allocator's pool.
Parameters:
allocator
–
Since : 1.22
gst_va_dmabuf_allocator_get_format
gboolean gst_va_dmabuf_allocator_get_format (GstAllocator * allocator, GstVideoInfoDmaDrm * info, guint * usage_hint)
Gets current internal configuration of allocator.
Parameters:
allocator
–
info
(
[out][optional])
–
usage_hint
(
[out][optional])
–
VA usage hint
Since : 1.22
gst_va_dmabuf_allocator_prepare_buffer
gboolean gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer)
This method will populate buffer with pooled VASurfaceID/DMABuf memories. It doesn't allocate new VASurfacesID.
Since : 1.22
gst_va_dmabuf_allocator_set_format
gboolean gst_va_dmabuf_allocator_set_format (GstAllocator * allocator, GstVideoInfoDmaDrm * info, guint usage_hint)
Sets the configuration defined by info and usage_hint for allocator, and it tries the configuration, if allocator has not allocated memories yet.
If allocator has memory allocated already, and frame size, format and modifier in info are the same as currently configured in allocator, the rest of info parameters are updated internally.
Parameters:
allocator
–
info
(
[in][out][not nullable])
–
usage_hint
–
VA usage hint
Since : 1.22
gst_va_dmabuf_allocator_setup_buffer
gboolean gst_va_dmabuf_allocator_setup_buffer (GstAllocator * allocator, GstBuffer * buffer)
This function creates a new VASurfaceID and exposes its DMABufs, later it populates the buffer with those DMABufs.
Return: TRUE if buffer is populated correctly; FALSE otherwise.
Since : 1.22
Functions
gst_va_buffer_peek_display
GstVaDisplay * gst_va_buffer_peek_display (GstBuffer * buffer)
Parameters:
buffer
–
the display which this buffer belongs to. The reference of the display is unchanged.
Since : 1.22
gst_va_dmabuf_get_modifier_for_format
guint64 gst_va_dmabuf_get_modifier_for_format (GstVaDisplay * display, GstVideoFormat format, guint usage_hint)
Get the underlying modifier for specified format and usage_hint.
the underlying modifier.
Since : 1.24
gst_va_dmabuf_memories_setup
gboolean gst_va_dmabuf_memories_setup (GstVaDisplay * display, GstVideoInfoDmaDrm * drm_info, GstMemory ** mem, uintptr_t* fds, gsize * offset, guint usage_hint)
It imports the array of mem, representing a single frame, into a VASurfaceID and it's attached into every mem.
Parameters:
display
–
drm_info
–
mem
(
[arrayfixed-size=4][element-typeGstMemory])
–
Memories. One per plane.
fds
(
[arrayfixed-size=4][element-typeuintptr_t])
–
array of DMABuf file descriptors.
offset
(
[arrayfixed-size=4][element-typegsize])
–
array of memory offsets.
usage_hint
–
VA usage hint.
Since : 1.22
gst_va_memory_peek_display
GstVaDisplay * gst_va_memory_peek_display (GstMemory * mem)
Parameters:
mem
–
the display which this mem belongs to. The reference of the display is unchanged.
Since : 1.22
Constants
GST_ALLOCATOR_VASURFACE
#define GST_ALLOCATOR_VASURFACE "VAMemory"
Since : 1.22
GST_MAP_VA
#define GST_MAP_VA (GST_MAP_FLAG_LAST << 1)
Flag indicating that we should map the VASurfaceID instead of to system memory, so users can use libva primitives to operate with that surface.
Since : 1.22
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK