Commit graph

164 commits

Author SHA1 Message Date
Michael Tretter
aed4088967 vaapipostproc: lock ensure_filter with postproc_lock
gst_vaapipostproc_ensure_filter might free the allowed_srcpad_caps
and allowed_sinkpad_caps. This can race with copying these caps in
gst_vaapipostproc_transform_caps and lead to segfaults.

The gst_vaapipostproc_transform_caps function already locks
postproc_lock before copying the caps. Make sure that calls to
gst_vaapipostproc_ensure_filter also acquire this lock.

https://bugzilla.gnome.org/show_bug.cgi?id=791404
2018-01-12 19:10:35 +01:00
Sebastian Dröge
76e9ad8646 vaapipostproc: Allow running without VPP support
We returned FALSE from ::start() if VPP support is not available, but it
is only really needed for complex filters and during transform we check
for that. For simple deinterlacing it is not needed.
2017-10-03 12:04:42 +02:00
Víctor Manuel Jáquez Leal
bedaa13d7c vaapipostproc: use scoped variable for return value
Instead of reusing a parameter variable for the return value of
gst_vaapipostproc_transform_caps(), this patch uses the function
scoped pointer. Thus, the code is cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=785706
2017-09-28 13:56:13 +02:00
Víctor Manuel Jáquez Leal
d3732a7cf8 vaapipostproc: removed unused parameter
Removed caps parameter from gst_vaapipostproc_transform_caps_impl()
helper function since the it is not used.

https://bugzilla.gnome.org/show_bug.cgi?id=785706
2017-09-28 13:56:13 +02:00
Víctor Manuel Jáquez Leal
f6fc1774b9 vaapipostproc: use scoped variable for return value
Instead of reusing a parameter variable for the return value of
gst_vaapipostproc_fixate_caps(), this patch uses the function scoped
pointer. Thus, the code is cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=785706
2017-09-28 13:56:13 +02:00
Hyunjun Ko
8a04f390c8 postproc: reconfigure when width or height changes
https://bugzilla.gnome.org/show_bug.cgi?id=754885
2017-07-18 17:17:11 +02:00
Julien Isorce
e7dd25ffc1 vaapipostproc: add support for DMABuf caps feature
https://bugzilla.gnome.org/show_bug.cgi?id=755072

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
2017-06-23 18:44:42 +02:00
Víctor Manuel Jáquez Leal
152217064f plugins: when debug disabled, default category is NULL
As in gstreamer-vaapi a common base class is used, the specific
default category is passed to the base-plugin initializator, thus
the log messages are categorized with the used plugin.

Nonetheless, when the gst-debug is disabled in compilation time,
it is needed to pass NULL to the base-plugin initializator. This
patch does that.

https://bugzilla.gnome.org/show_bug.cgi?id=780302
2017-03-20 19:15:39 +01:00
Julien Isorce
8d86b3f40a vaapipostproc: texture upload if driver supports GL
Removes GstVideoGLTextureUploadMeta caps feature if the driver
doesn't support opengl.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=772838
2017-03-03 20:01:33 +01:00
Julien Isorce
bc97987ffb vaapipostproc: don't GLTextureUpload if dmabuf
Do not add the meta:GstVideoGLTextureUploadMeta feature if the render
element can handle dmabuf-based buffers, avoiding its negotiation.

Similar as "vaapidecode: do not add meta:GstVideoGLTextureUploadMeta
feature if can dmabuf"

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Hyunjun Ko
a01c0bc352 vaapipostproc: set GST_VAAPI_POSTPROC_FLAG_SIZE according to src caps
A value of width/height property should be set to out caps,
if negotiation had been going properly.
So we can use srcpad_info when making decision of scaling.

https://bugzilla.gnome.org/show_bug.cgi?id=778010
2017-02-01 15:42:21 +01:00
Víctor Manuel Jáquez Leal
c9bd45f05d plugins: handle GL params through context query
If the element instantiated the GL display and context, they should
handle them too through the context query.

https://bugzilla.gnome.org/show_bug.cgi?id=777409
2017-01-27 13:35:40 +01:00
Víctor Manuel Jáquez Leal
d8abbd7652 vaapipostproc: set interlace mode
if the vaapipostproc is configured to not do deinterlacing, the
interlace-mode in the src caps should be the same as the input caps.

https://bugzilla.gnome.org/show_bug.cgi?id=777395
2017-01-20 19:22:39 +01:00
Víctor Manuel Jáquez Leal
7fd41c4263 plugins: avoid log flood when activating pool
Every time a new buffer is allocated, the pool is activated. This
doesn't impact in performance since gst_buffer_pool_set_active()
checks the current state of the pool. Nonetheless it logs out a
message if the state is the same, and it floods the logging subsystem
if it is enabled.

To avoid this log flooding first the pool state is checked before
changing it.
2017-01-18 17:25:44 +01:00
Hyunjun Ko
b23640fb27 vaapipostproc: notify if src pad caps changed
If src pad caps have changed, it needs to notify it downstream. In
addition, do not set passthrough if they have changed.

Otherwise, transform sometimes starts processing before caps change.
The passthrough value will be set in fixate later in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=775204
2017-01-06 12:15:50 +01:00
Víctor Manuel Jáquez Leal
0d3e1d9072 vaapipostproc: enhance debug message
"gst_pad_push" is not a good description of the event.
2016-11-08 09:35:00 +01:00
Hyunjun Ko
cbce9b8e49 postproc: honor gst_pad_push() return value
Returning GST_FLOW_ERROR always when gst_pad_push fails might lead to
deadlock during seek.

This patch returns the same error of gst_pad_push() and log out the
return value.

https://bugzilla.gnome.org/show_bug.cgi?id=774030
2016-11-08 08:27:41 +01:00
Víctor Manuel Jáquez Leal
bb0abb1a18 vaapipostproc: use GST_*_OBJECT when possible
Since we can have several vaapipostproc operating in a pipeline, it is useful
to know which one is generating the logging message.

https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:38:26 +02:00
Vineeth TM
57313f3f70 vaapi: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763083

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-09-23 12:33:58 +02:00
Víctor Manuel Jáquez Leal
6cbb607ec9 vaapipostproc: update filters at color balance
This is a fix for a regression of previous commit, which updates the filters
only when the property is set, because it is also required to update the
filter when the color balance interface change its values.
2016-07-22 16:55:59 +02:00
Hyunjun Ko
73d4da2e79 vaapipostproc: make it enable/disable pass-through mode
In case that sink caps and src caps are same, and no filtering parameter set,
pass-through mode is enabled.
If new filtering parameter is set during playback, it makes it reconfiguring,
so that pass-through mode is changed

In addition, updating filter is performed during reconfiguration, if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=751876
2016-07-22 12:08:20 +02:00
Hyunjun Ko
cc6df605a1 vaapipostproc: checking and updating filter parameter only when it's set
This patch is to avoid checking filter value at every frame.

https://bugzilla.gnome.org/show_bug.cgi?id=751876
2016-07-22 12:08:20 +02:00
Víctor Manuel Jáquez Leal
649c00d3c7 vaapipostproc: return caps template if no display
This patch is a fix for my bad review of commit 6d73ca8d. The element should
be able to return the available raw caps handled by the VA display, but that
only should happen when there a VA display. If there's none, the element
should use the caps template.

https://bugzilla.gnome.org/show_bug.cgi?id=768161
2016-06-29 14:05:18 +02:00
Matthew Waters
6d73ca8da2 vaapipostproc: don't require a vaapi display for all caps queries
This delays the requirement of having a GstVaapiDisplay until later

https://bugzilla.gnome.org/show_bug.cgi?id=768161
2016-06-29 21:35:06 +10:00
Hyunjun Ko
2fb05613a0 vaapi: fix minor leaks
https://bugzilla.gnome.org/show_bug.cgi?id=767868
2016-06-21 11:08:48 +03:00
Víctor Manuel Jáquez Leal
2562cd51be pluginutil: add gst_video_info_changed() helper
This function is shared among different elements, so let factorized it.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Scott D Phillips
4791e9f2ea vaapipostproc: add postproc_lock to protect data members
Add a mutex to postproc to protect concurrent access to data members.
Previously set_caps() could release the allowed_srcpad_caps while
transform_caps was in the middle of using it.

Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=766940
2016-06-08 10:03:59 +02:00
Víctor Manuel Jáquez Leal
9da69fa3a2 vaapipostproc: handle if gst_video_info_from_caps() fails
Return FALSE is the received caps cannot be transformed into a GstVideoInfo
structure.
2016-05-23 18:04:47 +02:00
Víctor Manuel Jáquez Leal
d69917ecca remove spurious gst_video_info_init()
gst_video_info_set_format() and gst_video_info_from_caps() call, internally,
gst_video_info_init(), hence it is not required to call it before them. This
patch removes these spurious calls.
2016-05-20 19:33:39 +02:00
Víctor Manuel Jáquez Leal
1901e2231b vaapipostproc: move gst_vaapipostproc_fixate_srccaps()
Move gst_vaapipostproc_fixate_srccaps() to gstvaapiposptprocutil.

No functional changes.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 16:56:10 +02:00
Víctor Manuel Jáquez Leal
d9b09b623e vaapipostproc: simplify code
Change a convoluted snippet to find the preferred color format in the peer
caps.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 16:56:10 +02:00
Víctor Manuel Jáquez Leal
bde3b072da vaapipostproc: use othercaps for preferred caps
Instead of the allowed_srcpad_caps variable, this patch uses the othercaps
from fixate_caps() vmethod to find the preferred caps feature and color
format.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 16:56:10 +02:00
Scott D Phillips
8de7faafdc vaapipostproc: add fixate_caps() vmethod
Instead of fixating the srcpad caps in transform_caps() vmethod, this patch
implements the fixate_caps() vmethod and moves code around.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 16:55:53 +02:00
Víctor Manuel Jáquez Leal
606d166b56 vaapipostproc: set early properties restrictions
When running transform_caps() vmethod, returning the srcpad caps, the caps are
early restricted to the element properties set: width, height, format and
force keep aspect.

A new file was added gstvaapipostprocutil.{c,h} where the utilities functions
are stored.

https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 14:56:03 +02:00
Víctor Manuel Jáquez Leal
54a2d9fb77 vaapipostproc: log the caps transformation
https://bugzilla.gnome.org/show_bug.cgi?id=758548
2016-05-09 14:56:03 +02:00
Víctor Manuel Jáquez Leal
ebf0d94534 vaapipostproc: no GLTextureUpload in sinkpad
As the vaapipostproc does not process frames with the VideoGLTextureUpload
meta, the feature is removed from the sink pad template.

https://bugzilla.gnome.org/show_bug.cgi?id=765931
2016-05-09 14:55:38 +02:00
Julien Isorce
910bacc55c vaapipostproc: already have a surface proxy if dmabuf
https://bugzilla.gnome.org/show_bug.cgi?id=755072
2016-04-26 16:05:50 +01:00
Julien Isorce
8a443f0a18 various gst-indent 2016-04-25 22:22:56 +02:00
Víctor Manuel Jáquez Leal
bccdda84b7 plugins: rework set_context() vmethod definition
In bug 757598 was added the set_context() vmethod chain up in
GstVaapiPluginBase. But it is buggy, since the parent_class address is
assigned to the last element which called gst_vaapi_plugin_base_class_init().

No error has shown up since none of the element's base classes redefined
set_context() vmethod from GstElement, so always the correct function was
called. Still this code is wrong and this patch make it right.

Since set_context() is the same code, a macro is used to implement that code
in all the gst-vaapi elements.

https://bugzilla.gnome.org/show_bug.cgi?id=765368
2016-04-22 17:18:18 +02:00
Víctor Manuel Jáquez Leal
e519f2ea79 vaapipostproc: resize if negotiated and allocation caps are different
Since commit 859a2b2, in vaapidecode, allocation query can be different from
the negotiated caps.

When connecting the vaapidecoder to the vaapipostprocessor, the last one will
resize the frame to the negotiated, if and only if, some other parameter is
activated to avoid the passthrough. If it is not, the surface won't be mapped
into a image. If not, the image won't be resized and the output buffer would be
mapped.

This patch will break the passthrough if the allocation query is different
from the negotiation caps, forcing the resizing.

https://bugzilla.gnome.org/show_bug.cgi?id=765095
2016-04-22 17:07:53 +02:00
Víctor Manuel Jáquez Leal
c5c60e2a33 plugins: remove param in gst_vaapi_plugin_base_decide_allocation() 2016-04-18 19:07:55 +02:00
Víctor Manuel Jáquez Leal
8d42c95b0f plugin: use allowed caps filter from element
Instead of using the srcpad template caps for filtering the peer caps, the
function gst_vaapi_find_preferred_caps_feature(), now receives a new parameter
for the element's allowed caps.

With this modification, the vaapipostproc element simplifies a bit its code.

https://bugzilla.gnome.org/show_bug.cgi?id=765223
2016-04-18 18:28:43 +02:00
Víctor Manuel Jáquez Leal
2d7d38cb9c plugin: remove function parameter
The native format parameter in gst_vaapi_find_preferred_caps_feature() can be
saved if the out format is used for both: in and out. Thus the code is more
readable.

https://bugzilla.gnome.org/show_bug.cgi?id=765223
2016-04-18 18:28:43 +02:00
Víctor Manuel Jáquez Leal
8169c6afb1 remove custom allocation query
When resolving bug 753914, a custom allocation query was added, overlapping
the responsibilities of GstVideoDecoder.

But with the merge of the patches from bug 764421 this overlapping was not
required anymore. This patch restores this situation setting the
allocation_caps in the GstVideoCodecState when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
6ec2a09729 plugins: disable GL_TEXTURE_UPLOAD if no EGL/GLX
The plugins should not expose the feature meta:GstVideoGLTextureUploadMeta in
their caps templates if they were not compiled either with GLX or EGL support.
2016-04-13 20:35:59 +02:00
Sreerenj Balachandran
859a2b2f4f Make vaapidecode to advertise the cropped values in srcpad, but negotiate pool only if needed
-- Maintaing decoded surface resoluton and actual display resoultion separately
-- Before pushing every frames downstream, check for the requirement of pool negoation and
output_state negotiation: This is needed to avoid multiple issuses with cropping,
multi-resoluton video handling, more complex multi resolution decode scenarios for vp9decode,
possible wrong behaviour from upstream element to report uncropped values etc. Due to these reasons,
We can't just reliably use the resolution change notification from libgstvaapi for pool renegotiation too.
This is slight overhead, but safe enough. Optimization could be possible though.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2016-03-24 15:08:50 +02:00
Víctor Manuel Jáquez Leal
9b8fb25b8c docs: update plugin documentation
Update all the documentation of elements of the vaapi plugin.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-02-03 20:03:47 +01:00
Tim-Philipp Müller
24168a2093 vaapi: fix 'ISO C90 forbids mixed declarations and code' compiler warnings
Declare variables at the beginning of a code block, which
is how it's done in GStreamer.

https://bugzilla.gnome.org/show_bug.cgi?id=759192
2016-02-02 16:17:43 +01:00
Víctor Manuel Jáquez Leal
b8da44bdea vaapipostproc: check ANY caps at transform_caps()
When transforming downstream caps we should check for ANY caps from peer pad,
otherwise we get a segmentation fault.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=759893
2016-01-14 17:40:12 +01:00
Sreerenj Balachandran
0f3e813956 vaapipostproc: Correctly detect the caps change
This is a quick fix for regression introuduced by the
commit 757833230b

With out this, the gst_vaapipostproc_create() will
never get invoked.

https://bugzilla.gnome.org/show_bug.cgi?id=758543
2015-11-23 17:21:23 +02:00