Víctor Manuel Jáquez Leal
dcc4557dd6
va: allocator: refactor flush methods for both allocators
...
Since the logic is the same, it can be generalized in a single common
function.
Also the methods run the common function with a lock and signal the
buffers' conditional.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
37fa6df57d
va: allocator: refactor GstVaDmabufAllocator
...
Move code down to group it.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
9c56c1b3e8
va: allocator: refactor GstVaBuffersurface
...
Move code up and add namespace to methods, and renaming
_creating_buffer_surface() to the canonical
gst_va_buffer_surface_new()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
734e2a74c4
va: implement pooled allocators
...
1. Allocators don't implement memory free() methods since all the memories will
implement dispose() returning FALSE
2. Memory/miniobject dispose() will act as memory release, enqueueing the
release memory
3. A new allocator's method prepare_buffer() which queries the released memory
queue and will add the requiered memories to the buffer.
4. Allocators added a GCond to synchronize dispose() and prepare_buffer()
5. A new allocator's method flush() which will free for real the memories.
While the bufferpool will
1. Remove all the memories at reset_buffer()
2. Implement acquire_buffer() calling allocator's prepare_buffer()
3. Implement flush_start() calling allocator's flush()
4. start() is disabled since it pre-allocs buffers but also calls
our reset_buffer() which will drop the memories and later the
buffers are ditched, something we don't want. This approach avoids
buffer pre-allocation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
d6f9cfc159
va: allocator: user gst_clear_object() for _buffer_surface_unref()
...
Event if this function is only used by gst_va_dmabuf_memories_setup(), it might
get reused later by GstVaDmabufAllocator's functions. This change makes the
function less fragile.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
10b3250175
va: allocator: renamed gst_va_dmabuf_memory_release()
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
1617dcbe9e
va: allocator: renamed available_mems queue
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
303b1ea350
va: allocator: rename gst_va_dmabuf_allocator_setup_buffer()
...
Since it's related with GstVaDmabufAllocator.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
bb586b227f
va: allocator: calculated surface frame internally
...
Instead of using gst_buffer_get_size() just add the memory sizes reported by
exported fd.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
864f0c2ede
va: allocator: make GstVaMemory shareable
...
Renamed the first variable member of GstVaMemory from parent to mem in
order to avoid confusion with GstMemory's parent.
When freeing the structure, memory's parent is check in order to
decide if surfaces has to be destroyed or not, since only the parent
class have to destroy it.
Removed GST_MEMORY_FLAG_NO_SHARE in memory initialization, since it is
deprecated.
Implemented allocator's share virtual method which creates a new
shallow GstVaMemory structure based on the passed one which will be
it's parent.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
0b6d8e73ec
va: allocator: remove copy method for GstVaMemory
...
Since the memory has to be shareable. That will be address in the next
commits.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
43b950b252
va: allocator: remove va allocator mem_is_span() vmethod
...
Since it is the default by base class.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626 >
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
666eedc215
va: caps: centralize caps feature discovering
...
These function were repeated in the different implemented
elements. This patch centralize them.
The side effect is dmabuf memory type is no longer checked with the
current VAContext, but assuming that dmabuf is a consequence of caps
negotiation from dynamic generated caps templates, where the context's
memory types are validated, there's no need to validate them twice.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1644 >
2020-10-04 15:22:04 +00:00
Víctor Manuel Jáquez Leal
3653c19de3
va: filter: fix counter variable reuse
...
There was a bug reusing the counter variable i in nested loops. Also
the patch makes the code cleaner.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1643 >
2020-10-04 16:05:03 +02:00
Víctor Manuel Jáquez Leal
cd618f19b9
va: simplify VPP detection
...
Also the previous code failed if VPP was not present blacklisting the
plugin.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1619 >
2020-09-30 10:49:39 +02:00
He Junyan
709bec8f07
va: Implement the VA vp8 decoder.
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587 >
2020-09-25 17:07:30 +08:00
He Junyan
ae8f97ae34
va: codestyle: Clear all tabs in header files
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587 >
2020-09-25 17:07:10 +08:00
He Junyan
410938a069
va: util: make the _format_changed a common decoder function.
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587 >
2020-09-25 17:07:05 +08:00
Víctor Manuel Jáquez Leal
00b73cfddd
va: h264dec: allocate output buffers according DPB size
...
Instead of allocating the maximal number of references for output
buffers, this patch reduces the memory foot print in many cases by
just allocating the output buffers required for the DPB.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1595 >
2020-09-24 20:35:49 +02:00
Víctor Manuel Jáquez Leal
755d769045
va: decoder: store output buffer rather than surface
...
GstVaDecodePicture stored the processed VASurfaceID, under the
assumption that the bufferpool with keep the referenced buffers, but
this approach is fragil.
This patch changes GstVaDecodePicture to store the output buffer,
which already contains its VASurfaceID, and provides a new method to
retrieve the VASurfaceID directly from picture.
Based on He Junyan <junyan.he@intel.com> patches for
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1594 >
2020-09-24 15:36:06 +02:00
Víctor Manuel Jáquez Leal
990d1bfbce
va: vpp: global lock to handle shared buffers
...
Add a global mutex to exclusive access to shared stream buffers, such
as DMABufs or VASurfaces after a tee:
LIBVA_DRIVER_NAME=iHD \
gst-launch-1.0 v4l2src ! tee name=t t. ! queue ! \
vapostproc skin-tone=9 ! xvimagesink \
t. ! queue ! vapostproc ! xvimagesink
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
9845ec68dc
va: add vapostproc element
...
Video postprocessor for VA-API
Funcionalities: resize frames, change format, import buffers, apply
filters (such as denoise, sharpen, orientation, if driver offers them).
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
117453b947
va: allocator: export composed layer for YUY2 and UYVY
...
This is a result of an error reported by i965 driver which only can
export composed layer for these formats. This seems to work too with
iHD. These formats are not exposed as native surfaces in Gallium.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
a4e535d5c1
va: allocator: add gst_va_dmabuf_buffer_setup()
...
This function will take an array of DMABuf GstMemory and an array of
fd, and create a VASurfaceID with those fds. Later that VASurfaceID is
attached to each DMABuf through GstVaBufferSurface.
In order to free the surface GstVaBufferSurface now have GstVaDisplay
member, and _buffer_surface_unref() were added.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
6ac4e79b21
va: allocator: try to get VASurfaceID from every DMABuf allocator
...
Relax the check of the allocator type, because now the qdata can be
attached for other DMABuf allocators.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
20e493981b
va: allocator: try to create surface without fourcc but chroma only
...
There are, in VPP, surfaces that doesn't support 4:2:2 fourccs but it
supports the chroma. So this patch gives that opportunity to the
driver.
This patch also simplifiies
gst_va_video_surface_format_from_image_format() to just an iterator
for surfaces available formats.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
482a7d7d7e
va: allocator: create surfaces with VASurfaceAttribExternalBuffers
...
Add a new parameter to _create_surfaces(): a pointer to
VASurfaceAttribExternalBuffers.
If it's defined the memory type is changed to DRM_PRIME, also a new item is
added to the VASurfaceAttrib array with
VASurfaceAttribExternalBufferDescriptor.
Also, the VASurfaceAttrib for pixel format is not mandatory anymore. If fourcc
parameter is 0, is not added in the array, relying on the chroma. This is
useful when creating surfaces for uploading or downloading images.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
f306b1e0fe
va: pool: use gst_object_replace() for allocator
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
f6a623d565
va: device: use gst_clear_object()
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
6af7ec3c0f
va: caps: expose gst_caps_set_format_array()
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529 >
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
b1a1e2d841
va: vah264dec: fix documentation
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1591 >
2020-09-23 15:14:21 +00:00
Víctor Manuel Jáquez Leal
9ed141734e
va: utils: use GstObject for GstVaDisplay in context
...
Thus application could fetch the GstVaDisplay through the sync bus
without knowning the specific implementation, and sharing it or
extract properties.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1586 >
2020-09-21 17:07:51 +00:00
Víctor Manuel Jáquez Leal
ed80aa5d6b
va: utils: fix code style and wrong log message
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1586 >
2020-09-21 17:07:51 +00:00
Víctor Manuel Jáquez Leal
9e9e5c72d5
va: h264dec: add documentation
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1585 >
2020-09-20 09:21:08 +02:00
Víctor Manuel Jáquez Leal
467618f8ac
va: decoder: render picture only if data
...
Call vaRenderPicture() only if buffer or slice data is available.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1584 >
2020-09-19 14:32:13 +02:00
Víctor Manuel Jáquez Leal
ad019a1d01
va: decoder: warn if decode fails on a surface
...
Instead of logging error if a step fails, it logs a warning message
reducing the noise and obeying the rule for errors since the program
doesn't end
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1584 >
2020-09-19 14:32:13 +02:00
Víctor Manuel Jáquez Leal
ad839ada5b
va: h264dec: check is pad has fixed caps at caps query
...
Otherwise it will always reply with the possible driver caps, which
generates problems with Web MSE players.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1583 >
2020-09-19 13:00:49 +02:00
Seungha Yang
2fe1afeafa
va: h264dec: Don't need to set pts/dts/duration on outputting frame
...
It will be handled by videodecoder baseclass
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1582 >
2020-09-18 23:50:54 +00:00
Víctor Manuel Jáquez Leal
261d6e463a
Revert "va: h264dec: set latency"
...
This reverts commit 3aedef4c86
.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1531 >
2020-09-14 16:48:31 +00:00
Víctor Manuel Jáquez Leal
7c696b67be
va: allocator: remove parameter from _create_buffer_surface()
...
Don't the allocator to _create_buffer_surface() since it's not used.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516 >
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
80de32b017
va: utils: free allocated string
...
and fix a memleak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516 >
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
69a00541dd
va: utils: fix log category initialization
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516 >
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
c905f6131d
va: h264dec: check va allocator at decide allocation
...
And some code cleanups
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516 >
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
f755730b20
va: decoder: improve locks for member variable access
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516 >
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
3aedef4c86
va: h264dec: set latency
...
The min latency is calculated with the maximum number of frames that
precede any frame, if available, and it is lower than the maximum
number of frames in DBP.
The max latency is calculated with the maxium size of frames in DBP.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1500 >
2020-08-17 09:32:41 +00:00
Víctor Manuel Jáquez Leal
122a3cc40c
va: h264dec: remove spurious comment
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1499 >
2020-08-10 15:36:47 +00:00
Víctor Manuel Jáquez Leal
159562faf7
va: h264dec: check return value of gst_va_handle_set_context()
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1499 >
2020-08-10 15:36:47 +00:00
Víctor Manuel Jáquez Leal
6cf03b21f6
va: h264dec: log if upstream pool is kept
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1489 >
2020-08-04 10:39:05 +02:00
Víctor Manuel Jáquez Leal
f332c35ec0
va: utils: fix precondition check for handle_context_query()
...
display paramater can be NULL, but if it's not, it has to be a
GstVaDisplay.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1489 >
2020-08-04 10:39:05 +02:00
Víctor Manuel Jáquez Leal
62dacfd89a
va: allocator: support for GST_MAP_VA map flag
...
This flag will return the VASurface value at mapping
2020-08-03 19:33:01 +02:00