Commit graph

126 commits

Author SHA1 Message Date
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
Víctor Manuel Jáquez Leal
757833230b vaapipostproc: don't set caps change at first set
When the source caps change, the filter is destroyed and recreated.
Nonetheless, this happens every time the vaapipostproc starts, since the caps
change detection algorithm does not take in consideration when the caps are
set by first time.

This patch intents to be an optimization, to avoid a useless filter
destroy-creation cycle when the sources caps are set for first time.

The new helper function video_info_update() is a refactorization to avoid
duplicated code.

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

https://bugzilla.gnome.org/show_bug.cgi?id=758007
2015-11-19 12:23:22 +01:00
Víctor Manuel Jáquez Leal
fc958520c3 vaapipostproc: params video_info_changed() callers
The signature is video_info_changed(old_vip, new_vip). Nonetheless the callers
swapped the the order. This didn't raise problems since the comparison of both
structures were not affected by its semantics.

But still it would be better to fix this to keep the coherence of the code.

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

https://bugzilla.gnome.org/show_bug.cgi?id=758007
2015-11-19 12:23:22 +01:00
Víctor Manuel Jáquez Leal
b2707c8eec plugins: fix context query handling
The current context query handling design is flawed: the function
gst_vaapi_reply_to_query() returns FALSE either if the query is not a
GST_CONTEXT_QUERY of if the query could not be handled correctly. But the
pad query function should handle differently each case.

This patch changes the gst_vaapi_reply_to_query() for
gst_vaapi_handle_context_query() and changes it usage in all the vaapi plugins
to match the correct context query handling.

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

https://bugzilla.gnome.org/show_bug.cgi?id=757598
2015-11-09 16:18:19 +01:00
Víctor Manuel Jáquez Leal
66f05af288 refactor vaapi caps strings for pad templates
Refactor the main vaapi caps strings into three macros:
GST_VAAPI_MAKE_SURFACE_CAPS, GST_VAAPI_MAKE_ENC_SURFACE_CAPS and
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS.

Those are in gstvaapipluginutil.h so all the elements could use them, instead
of re-declaring them every time.

No functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-08-05 14:26:37 +02:00
Víctor Manuel Jáquez Leal
343739e281 gstvaapipostproc: fix code style
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-08-05 14:26:00 +02:00
Víctor Manuel Jáquez Leal
954037cd24 vaapipostroc: GLTextureUploadMeta in sink template
Advertise GLTextureUploadMeta in sink caps template.

https://bugzilla.gnome.org/show_bug.cgi?id=752130
2015-08-04 19:37:33 +02:00
Víctor Manuel Jáquez Leal
001a5c637d remove gstvaapiuploader
Working on bug #744042 I realized that the gstvaapiuploader is practically not
used.

This patch removes the gstvaapiuploader and add the method
gst_vaapi_plugin_base_get_allowed_raw_caps () that returns the raw caps that
the system can handle, which is used by vaapisink and vaapipostproc.

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

https://bugzilla.gnome.org/show_bug.cgi?id=752777
2015-08-04 19:32:40 +02:00
Víctor Manuel Jáquez Leal
9984678398 vaapipostproc: no format convert on GL tex upload meta
When GL texture upload meta is negotiated, vaapipostproc shall not modify the
color format of the buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=748184
2015-07-03 13:31:47 +02:00
Sreerenj Balachandran
b4154ac85c gst/vaapi: Switch to upstreram like indentation.
gst-indent for all gst/vaapi/*.c source files
2015-06-30 09:44:18 +03:00
Sreerenj Balachandran
d14a201699 vaapipostproc: Fix wrong selection of passthrough mode.
The Current code path is falling back to passthorugh mode if there is no
vpp property set by the user explictily. But we should not use the
passthrough mode if the negotiated src pad caps have a differnt color space
format than sink pad caps (Even though the user didn't set the format property
explicitly).

https://bugzilla.gnome.org/show_bug.cgi?id=748184

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-06-29 13:35:59 +03:00
Sreerenj Balachandran
a1eef1c355 vaapipostproc: prevent advanced-deinterlacing of non-native video formats.
This is a workaround to deal with the va-intel-driver for non-native
formats while doing advanced deinterlacing. The format of reference surfaces must
be same as the format used by the driver internally for motion adaptive
deinterlacing and motion compensated deinterlacing.

A permanent solution could be to do the color space conversion internally
for reference surfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=730925

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-06-29 13:20:28 +03:00
Víctor Manuel Jáquez Leal
eb510e23ce vaapipostproc: log negotiated caps 2015-06-22 17:15:50 +02:00
Víctor Manuel Jáquez Leal
700f010766 vaapipostproc: remove useless debug message 2015-06-22 17:13:00 +02:00
Víctor Manuel Jáquez Leal
cbc2d15bec vaapipostproc: add color balance interface
https://bugzilla.gnome.org/show_bug.cgi?id=720376
2015-06-12 19:22:01 +02:00
Víctor Manuel Jáquez Leal
1ef8c10aa8 vaapipostproc: add skin tone enhancement
Added the 'skin-tone-enhancement' property to vaapostproc.

https://bugzilla.gnome.org/show_bug.cgi?id=744088
2015-06-08 18:00:05 +02:00
Víctor Manuel Jáquez Leal
28b4fc4dd9 vaapipostproc: tune up a couple of log messages
In order to reduce the noise, the query type log was downgrade from INFO to
DEBUG, and the shared display address log message is assigned to the object.
2015-04-29 12:39:50 +02:00
Olivier Crete
6f298f6182 vaapipostproc: Don't create filter on caps query
The problem with this is that creating the filter causes the display to
be selected, and the caps query happens while linking the element. So,
if the downstream or upstream element is using a specific display
object, it won't be propagated correctly to the postproc as it already
has a display at this point.

https://bugzilla.gnome.org/show_bug.cgi?id=747945
2015-04-16 12:36:28 +02:00
Víctor Manuel Jáquez Leal
8b36e25f47 Removal of gstreamer-1.0 support
The support for GStreamer 1.0 has been obsoleted in 0.5.10 release.
GStreamer 1.2 is the a minimal requirement for building the gstreamer-vaapi.

This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-1.0.

Thus, all the video converters were removed too.

https://bugzilla.gnome.org/show_bug.cgi?id=745728

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-03 17:09:08 +03:00
Víctor Manuel Jáquez Leal
c561b8da8a update and move gstcompat.h
The purpose of gstcompat.h is to couple the API differences among
gstreamer-1.0 and gstreamer-0.10. Since gstreamer-0.10 is obsolete, the code
in this compatibility layer shall be removed.

Nevertheless, the gstcompat.h header should be kept, if new incompatibilites
appear in the future, but it shall live in gst/vaapi, not in gst-libs.

This patch removes the crumbs defined gstcompat.h and moves it to gst/vaapi.
In order to avoid layer violations, gstcompat.h includes sysdeps.h and all
the includes in gst/vaapi of sysdeps.h are replaced with gstcompat.h

https://bugzilla.gnome.org/show_bug.cgi?id=745728

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-03 17:08:30 +03:00
Víctor Manuel Jáquez Leal
d256f1d283 Removal of gstreamer-0.10 support
This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-0.10.

https://bugzilla.gnome.org/show_bug.cgi?id=745728
https://bugzilla.gnome.org/show_bug.cgi?id=732666

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 16:55:27 +03:00
Víctor Manuel Jáquez Leal
98655a195f vaapipostproc: always activate buffer pool
The vaapipostproc has a proxy flag to know if the the buffer pool is
already active. But this fails in some situations where it is needed
to renegotiate the buffer pool.

This patch removes that flag so the renegotiation is done whenever is
required.

https://bugzilla.gnome.org/show_bug.cgi?id=745535
2015-03-06 12:16:17 +02:00
Gwenole Beauchesne
8c93c842ef plugins: add support for BGRA textures.
Some frameworks (EFL) expect BGRA textures for storage. However,
adding support for that broadly into GStreamer framework  implies
two kinds of hacks: (i) libgstgl helpers currently do not support
BGRA textures correctly, (ii) we need to better parse downstream
suggested caps and intersect them with what the VA plugin elements
can offer to them for GL texturing.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
96ce1bc761 videopool: add optional flags for surface pool allocation.
Reword surface pool allocation helpers so that to allow for a simple
form, e.g. gst_vaapi_surface_pool_new(format, width, height); and a
somewhat more elaborated/flexible form with optional allocation flags
and precise GstVideoInfo specification.

This is an API/ABI change, and SONAME version needs to be bumped.
2015-01-27 18:11:45 +01:00
Michael Olbrich
22d1acb6d2 vaapipostproc: clear state on stop
Otherwise restarting may fail because the state of vaapipluginbase and
vaapipostproc don't match. e.g. gst_vaapipostproc_set_caps() will skip
initailization and not call gst_vaapi_plugin_base_set_caps()
2015-01-27 16:06:02 +02:00
Gwenole Beauchesne
4be370f9ed vaapipostproc: fix out caps for GLMemory.
If the best downstream capsfeature turns out to be GLMemory, then make
sure to propagate RGBA video format in caps to that element. This fixes
the following pipeline: ... ! vaapipostproc ! glimagesink.
2014-11-24 15:28:36 +01:00
Gwenole Beauchesne
0525f56ac5 vaapipostproc: fix check for compatible src pad capsfilters.
When an explicit output video format is selected, from an src pad
capsfilter, make sure that the downstream element actually supports
that format. In particular, fix crash with the following pipelines:
... ! vaapipostproc ! video/x-raw,format=XXX ! xvimagesink ; where
XXX is a format not supported by xvimagesink.

While doing so, also reduce the set of src pad filter caps to the
actual set of allowed src pad caps.
2014-11-24 15:28:20 +01:00
Gwenole Beauchesne
9c888b8b8e plugins: re-indent all video processing related source code. 2014-11-24 14:11:35 +01:00
Gwenole Beauchesne
a4d88db0fd plugins: preserve framerate when updating src caps video format.
In the current implementation, gst_video_info_set_format() would reset
the whole GstVideoInfo structure first, prior to setting video format
and size. So, coleteral information like framerate or pixel-aspect-
ratio are lost.

Provide and use a unique gst_video_info_change_format() for overcome
this issue, i.e. only have it change the format and video size, and
copy over the rest of the fields.

https://bugzilla.gnome.org/show_bug.cgi?id=734665
2014-11-18 18:39:32 +01:00
Sreerenj Balachandran
08bbab889b vaapipostproc: Add string representation of VPP functions to ElementFactoy Klass
Added the same Klass specifications used in other upstream
video postprocessing elements like videoconvert, videoscale,
videobalance and deinterlace.
An example use case is for this is to help the playsink
to autoplug the hardware accelerated deinterlacer.
2014-11-12 09:45:50 +01:00
Sreerenj Balachandran
626e180fef vaapipostproc: Tweak the output video format setting to enable the autoplugging
This is a workaround until auto-plugging is fixed when
format=ENCODED + memory:VASurface caps feature are provided.

Use the downstream negotiated video format as the output video format
if the user didn't ask for the colorspace conversion explicitly.
Usecase: This will help to connect elements like videoscale, videorate etc
to vaapipostproc.

https://bugzilla.gnome.org/show_bug.cgi?id=739443
2014-11-12 09:45:50 +01:00
Gwenole Beauchesne
eeb43989c1 vaapipostproc: allow user defined scaling mode.
Add new "scale-method" property to expose the scaling mode to use during
video processing. Note that this is only a hint, and the actual behaviour
may differ from implementation (VA driver) to implementation.
2014-10-29 17:33:48 +01:00
Gwenole Beauchesne
b61d993e7d vaapipostproc: add support for GLTextureUploadMeta output.
This allows for vaapipostproc to be chained to the glimagesink element
for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=735231
2014-08-22 18:52:23 +02:00
Gwenole Beauchesne
493337c4b1 vaapipostproc: add support for "download" capability.
Allow implicit conversions to raw video formats, while still keeping
VA surfaces underneath. This allows for chaining the vaapipostproc
element to a software-only element that takes care of maps/unmaps.
e.g. xvimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=720174
2014-08-22 18:20:46 +02:00
Gwenole Beauchesne
9ee46ab32e vaapipostproc: use pooled vaapi video meta.
Use pooled GstVaapiVideoMeta information, i.e. always allocate that on
video buffer allocation. Also optimize copy of additional metadata info
into the resulting video buffer: only copy the video cropping info and
the source surface proxy.

https://bugzilla.gnome.org/show_bug.cgi?id=720311

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
[fixed proxy leak, fixed double free on error, optimized meta copy]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-08-22 18:15:31 +02:00
Gwenole Beauchesne
92fcb38ba6 vaapipostproc: fix passthrough mode.
If no explicit output surface format is supplied try to keep the one
supplied through the sink pad caps. This avoids a useless copy, even
if things are kept in GPU memory.

This is a performance regression from git commit dfa70b9.
2014-08-22 15:54:32 +02:00
Sreerenj Balachandran
db111fe72a vaapipostproc: fix output buffer to have a GstVaapiVideoMemory.
https://bugzilla.gnome.org/show_bug.cgi?id=720311

[used new infrastructure through base decide_allocation() impl]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
bc8e7a6734 vaapipostproc: enable advanced deinterlacing with same format.
If only advanced deinterlacing is requested, i.e. deinterlacing is
the only active algorithm to apply with source and output surface
formats being the same, then make sure to enable VPP processing.

Otherwise, allow fallback to bob-deinterlacing with simple rendering
flags alteration.
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
dfa70b9e85 vaapipostproc: fix detection of output surface format changes.
Default to I420 format for output surfaces so that to match the usual
GStreamer pipelines. Though, internally, we could still opt for NV12
surface formats, i.e. default format=ENCODED is a hint for that, thus
delegating the decision to the VA driver.
2014-08-21 09:40:06 +02:00