Commit graph

57 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
13d090b566 vaapisink: rank it as secondary
iHD doesn't provide a full implemention for rendering surfaces and
i965 has problems in wayland. And I suspect this path is followed
by other driver implementations.

This patch demotes the rank of vaapisink to secondary, so it will
not be autoplugged avoiding bad experience of users.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/336>
2020-07-08 10:48:40 +00:00
He Junyan
3b118e2c45 plugin: use register_type to replace get_type for encode init.
xxx_register_type will detect the template sink caps and is needed
to be called at init time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/315>
2020-05-16 19:58:15 +00:00
Víctor Manuel Jáquez Leal
d6bcbe47e9 plugin: don't error if cannot create display
This might generated errors on automatic tools such as CI. Let's
rather just raise a warning and let continue.
2020-03-17 12:49:12 +01:00
Víctor Manuel Jáquez Leal
57e792136c libs: blend: filter: handle finalize() if display isn't assigned
I've just discovered iHD driver in Skylake doesn't have VideoProc
entry point, hence, in this platform, when vaapioverlay is tried to be
registered, critical warnings are raised because blend doesn't have a
display assigned.

As it is possible to have drivers without EntryPointVideoProc it is
required to handle it gracefully. This patch does that: only tries to
register vaapioverlay if the testing display has VPP and finalize()
vmethods, in filter and blend, bail out if display is NULL.
2020-02-21 15:11:31 +00:00
Víctor Manuel Jáquez Leal
9da5196b5a Remove all FEI related
FEI encoders are not actively mantained neither tested, and it is
using infrastructure that is changing and FEI is stopping this
effort.

Also it is required to rethink how FEI can be used in GStreamer.
2020-01-15 07:30:15 +00:00
U. Artie Eoff
d28ffd73c3 plugins: add vaapioverlay plugin
A plugin similar to the base compositor element but
uses VA-API VPP blend functions to accelerate the
overlay/compositing.

Simple example:

 gst-launch-1.0 -vf videotestsrc ! vaapipostproc \
  ! tee name=testsrc ! queue \
  ! vaapioverlay sink_1::xpos=300 sink_1::alpha=0.75 \
  name=overlay ! vaapisink testsrc. ! queue ! overlay.
2020-01-06 19:56:10 +00:00
Haihao Xiang
920b1ec7a8 vaapi: bump the minimum vaapi version requirement to 0.39.0
And reduce unnecessary API version and structures check as well.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/108
2019-01-07 17:46:42 +00:00
Víctor Manuel Jáquez Leal
fb1c4c52cc libs: display: remove gst_vaapi_display_unref()
Use gst_object_unref() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal
c653cb55f9 vaapi: register vaapisink as marginal on wayland
vaapsink, when used with the Intel VA-API driver, tries to display
surfaces with format NV12, which are handled correctly by
Weston. Nonetheless, COGL cannot display YUV surfaces, making fail
pipelines on mutter.

This shall be solved either by COGL or by making the driver to paint
RGB surfaces. In the meanwhile, let's just demote vaapisink as
marginal when the Wayland environment is detected, no matter if it is
Weston.

https://bugzilla.gnome.org/show_bug.cgi?id=775698
2018-02-13 17:13:20 +01:00
Philippe Normand
d897de9738 vaapi: add NULL-sentinel to kernel_names
The array needs to be NULL-terminated according to the
gst_plugin_add_dependency() documentation.
2018-01-30 12:56:49 +00:00
Sebastian Dröge
a8f2309595 vaapidecodebin: Register element if no VPP support is available too
VPP support is only needed for advanced deinterlacing, which is not
enabled by default either. Error out if it is selected but VPP is not
supported, and otherwise just work without VPP support.

https://bugzilla.gnome.org/show_bug.cgi?id=788758
2017-10-20 12:59:10 +02:00
Sebastian Dröge
8a0e22a5bb vaapi: Also register vaapipostproc without VPP support
It can still do simple deinterlacing then.
2017-10-03 13:06:33 +02:00
Sreerenj Balachandran
5750bd7850 FEI: plugin: Add vaapih264feienc element
A new FEI based encoder element for h264 is added: vaapih264feienc

FEI is a an extension to VA-API which is providing low level
advanced control over different stages of encoding.
Extending vaapih264enc with fei support is possible, but it will
make the code too much complicated and will be difficult
to debug. So adding the new encoder element, but keeping
the rank as 0 , vaapih264enc will stay as the primary
encoder for normal use cases.

The vaaih264feienc is mainly useful for customers who want to play
with MotionVectors and Macroblock Predictions. Also user can
do one stage of encoding(eg: only the Motion Vector Calculation)
in software and offload trasformation/entroy-coding etc to
Hardware (which is what PAK module is doing) using FEI element.

vaapih264feienc can work in  different modes using fei-mode properoty

eg: gst-launch-1.0 videotestsrc ! vaapih264feienc fei-mode=ENC+PAK ! filesink location=sample.264

Important Note: ENC only mode won't produce any encoded data which is expected.
But ENC alwys requires the output of PAK in order to do the inter-prediction
over reconstructed frames.
Similary PAK mode alway requires MV and MBCode as input, so unless there is an
upstream element providing those buffers, PAK only won't work as expected.

In a nutshell, ENC_PAK and the ENC+PAK modes are the only options we can verify
with vaapih264feienc. But ideally, EN+PAK mode verification is enough to make sure
that ENC and PAK are working as expected since ENC+PAK mode always invoke ENC and PAK
separately in vaapih264feienc.

People contributed:
        Wang, Yi <yi.a.wang@intel.com>
        Leilei <leilei.shang@intel.com>
        Zhong, Xiaoxia <xiaoxia.zhong@intel.com>
        xiaominc <xiaomin.chen@intel.com>
        Li, Jing B <jing.b.li@intel.com>

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2017-09-01 13:15:05 +02:00
Víctor Manuel Jáquez Leal
2d9547273e Revert "encoders: demote to RANK_NONE since not fit for autoplugging yet"
This reverts commit f182b8be2b.
2016-12-07 16:52:35 +01:00
Víctor Manuel Jáquez Leal
59821a21e9 vaapi: DISPLAY envvar as dependency
In a multiple video cards system, a X11 environment may have different VA
capabilities. This patch tracks the DISPLAY environment variable to
invalidates the GStreamer features cache. Also tracks WAYLAND_DISPLAY.

https://bugzilla.gnome.org/show_bug.cgi?id=770357
2016-09-06 09:49:02 +02:00
Tim-Philipp Müller
f182b8be2b encoders: demote to RANK_NONE since not fit for autoplugging yet
Encoders claim to support a whole bunch of input formats but then
just error out if the format is not actually supported, even if
there's a converter in front. This means they're not fit for
autoplugging in encodebin or camerabin yet and therefore should
not have a rank. People can still use them in custom pipelines.

https://bugzilla.gnome.org/show_bug.cgi?id=769266
2016-08-06 12:54:17 +01:00
Víctor Manuel Jáquez Leal
5beccf5fa0 vaapidecode: register only the available decoders
In order to register only the available decoders, this patch queries the
created test VA display, which uses the currently used back-end (X11, Wayland,
DRM, …) on the used display device.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
eb621c970e vaapi: register only the available encoders
In order to register only the available encoders, this patch queries the
created test VA display, which uses the currently used back-end (X11,
Wayland, DRM, …) on the used display device.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
c60312c78f vaapi: register vaapipostproc only if supported
Query the GstVaapiDisplay to know if the driver supports video
postprocessing. If does, then register vaapipostproc and vaapidecodebin
elements.

This patch will simplify the design of vaapidecodebin.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
90b0ba7e2b vaapi: don't register if VA driver is unsupported
Using the test VA display, the driver name is queried, and if it is not
white-listed, the plugin rejects to register any element.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
e070d3ebed vaapi: instantiate a VA display when registering
This patch tries to instantiate a GstVaapiDisplay when registering the plugin
features, if it fails, no gstreamer-vaapi element is registering.

The purpose of this patch is to avoid a situation where the user has
gstreamer-vaapi installed but their VA-API setup is not functional, which may
lead to unexpected behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
1cba2f3633 vaapi: declare external dependencies
There are two main external dependencies that define the feature set of this
plugin: a) the kernel and b) the VA driver

This patch tracks both dependencies, if any of them change, GStreamer will
re-inspect the plugin.

The kernel is tracked through the device files /dev/dri/card*

The VA driver is tracked through the files VA_DRIVERS_PATH/*_drv_video.so,
where VA_DRIVERS_PATH is the one defined in libva package configuration. Also,
the environment variables LIBVA_DRIVERS_PATH and LIBVA_DRIVER_NAME are tracked
since they modify the driver lookup.

Additionally, the environment variable GST_VAAPI_ALL_DRIVERS is tracked too.

https://bugzilla.gnome.org/show_bug.cgi?id=724352
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
326011af58 vaapi: nest includes under USE_ENCODER macro
This is a missed changeset from commit 1c05c53, since also header includes
should be nested.
2016-06-28 16:33:55 +02:00
Víctor Manuel Jáquez Leal
1c05c53b02 vaapi: nest encoders under USE_ENCODER macro
Though USE_{JPEG,VP8,VP9,H265}_ENCODER macros definition depend on USE_ENCODER
macro, it is clearer to nest them, showing explicitly the dependency relation.
2016-06-28 11:54:33 +02:00
Víctor Manuel Jáquez Leal
fc8fbddc5c vaapi: remove an already included header
gst/gst.h is already included in gstcompat.h
2016-06-17 18:16:09 +02:00
Sreerenj Balachandran
4464d81b6a Add vp9 encode element to "vaapi" plugin
https://bugzilla.gnome.org/show_bug.cgi?id=766048
2016-05-30 11:24:14 +03:00
Víctor Manuel Jáquez Leal
96ac9bee8e vaapidecode: register decoder with internal GType
Don't expose the the vaapidecode GType, instead expose a function
which will register element.

This is the first step to split the decoder by codecs.

https://bugzilla.gnome.org/show_bug.cgi?id=734093
2016-03-11 09:42:37 +01:00
Víctor Manuel Jáquez Leal
77ddde41d9 rename encoders to vaapi{codec}enc
Trying to comply with GStreamer's element names, this patch renames the
encoders using the name format vaapi{codec}enc.

In this way, the plugin documentation is linked correctly.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-02-03 20:23:31 +01:00
Víctor Manuel Jáquez Leal
1c722efe54 Remove old gst version guards
As gstreamer-vaapi now only supports from GStreamer 1.6, this patch removes
all the old GStreamer version guards.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-01-25 12:09:40 +00:00
Víctor Manuel Jáquez Leal
18a8b87975 Revert "Marking rank of vaapidecodebin as GST_RANK_MARGINAL for now."
This reverts commit 3ccb198b51.
2015-08-13 17:34:42 +02:00
Sreerenj Balachandran
3ccb198b51 Marking rank of vaapidecodebin as GST_RANK_MARGINAL for now.
Unfortunately vaapidecodebin element is not seems to be stable
enough for autoplugging ahead of vaapidecode.
Lowering the rank for now (cosidering the immediate 0.6 release).

See this: https://bugzilla.gnome.org/show_bug.cgi?id=749554

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-07 20:57:20 +03: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
eaf57cc90b HEVC_Encode: Add HEVC(h265) Encoder plugin
https://bugzilla.gnome.org/show_bug.cgi?id=748874

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-25 11:58:20 +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
Sreerenj Balachandran
29853f2aae plugins: Disable vaapidecodebin for GStreamer < 1.4
There are autoplugging issues in GStreamer-1.2.
Lets disable vaapidecodebin untill we get some workarounds for this.
2015-03-03 12:31:11 +02:00
Sreerenj Balachandran
8eabe9f377 plugins: Add a vaapidecodebin element
Add a "vaapidecodebin" element to vaapi plugins.

Child Elements: "vaapidecode ! queue ! vaapipostproc"

The Reasons for implementing a new bin element:

-- Help to Autoplug Hardware Accelerated Video Postprocessing element in playbin
with out any dependency to upstream gstreamer.
This is to overcome the *unacceptable* delay in upstream gstreamer to get new
features in. Eg: https://bugzilla.gnome.org/show_bug.cgi?id=687182.
Also customers using older gstreamer versions (1.2 and 1.4) will get the
benefit of autoplugging, hardware accelerated deinterlacing support etc.

-- Help to maintain a single thread implementation in vaapidecode.
This will result a dead-lock free vaapidecode in most of the cases.
More details here: https://bugzilla.gnome.org/show_bug.cgi?id=742605

https://bugzilla.gnome.org/show_bug.cgi?id=745216
2015-03-02 16:51:55 +02:00
Sreerenj Balachandran
a664a479a8 plugins: Add VP8 Encoder 2015-02-13 13:45:32 +02:00
Sreerenj Balachandran
d2e2784a78 plugins: Add JPEG encoder element 2015-02-04 11:18:29 +02:00
Sreerenj Balachandran
0ddf6b21b9 vaapidecode: increase the rank to GST_RANK_PRIMARY + 1
This is for helping decodebin to autoplug the vaapidecode element.

Decodebin is selecting decoder elements only based on rank and caps.
Without overriding the autoplug-* signals there is no way to autoplug
HW decoders inside decodebin. An easier soulution is to raise the
rank of vaapidecode, so that it gets selected first.

https://bugzilla.gnome.org/show_bug.cgi?id=739332
2014-11-18 18:38:33 +01:00
XuGuangxin
2e356b0f7e plugins: add mpeg2 encoder element.
Add GstVaapiEncodeMPEG2 element object. The actual plug-in element
is called "vaapiencode_mpeg2".

Valid properties:
- rate-control: rate control mode (default: cqp - constant QP)
- bitrate: desired bitrate in kbps (default: auto-calculated)
- key-period: maximal distance between two key frames (default: 30)
- max-bframes: number of B-frames between I and P (default: 2)
- quantizer: constant quantizer (default: 8)

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Wind Yuan
f1c33feef9 plugins: add h264 encoder element.
Add GstVaapiEncodeH264 element object. The actual plug-in element
is called "vaapiencode_h264".

Valid properties:
- rate-control: rate control mode (default: none)
- bitrate: desired bitrate in kbps (default: auto-calculated)
- key-period: maximal distance between two key frames (default: 30)
- num-slices: number of slices per frame (default: 1)
- max-bframes: number of B-frames between I and P (default: 0)
- min-qp: minimal quantizer (default: 1)
- init-qp: initial quantizer (default: 26)

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Gwenole Beauchesne
c516311a1a legal: update copyright notice dates. 2013-11-22 06:39:20 +01:00
Gwenole Beauchesne
15519ebe3d legal: add per-file authorship information.
Credit original authors on a per-file basis as we cannot expect people
to know all country-specific rules, or bother browsing through the git
history.
2013-11-22 06:39:15 +01:00
Gwenole Beauchesne
9968661ffd vaapipostproc: add initial support for GStreamer 1.2.
Port vaapipostproc element to GStreamer 1.2. Support is quite minimal
right now so that to cope with auto-plugging issues/regressions. e.g.
this happens when the correct set of expected caps are being exposed.
This means that, currently, the proposed caps are not fully accurate.
2013-11-21 23:08:02 +01:00
Víctor Manuel Jáquez Leal
f75762d910 plugins: initial port to GStreamer 1.2.
Port vaapidecode and vaapisink plugins to GStreamer API >= 1.2. This
is rather minimalistic so that to test the basic functionality.

Disable vaapipostproc plugin for now as further polishing is needed.
Also disable GstVideoContext interface support since this API is now
gone in 1.2.x. This is preparatory work for GstContext support.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-09-27 14:15:51 +02:00
Gwenole Beauchesne
945516c9c7 vaapipostproc: port to GStreamer 1.0.
Add support for interlaced streams with GStreamer 1.0 too. Basically,
this enables vaapipostproc, though it is not auto-plugged yet. We also
make sure to reply to CAPS queries, and happily handle CAPS events.
2013-04-17 10:18:45 +02:00
Gwenole Beauchesne
9b981dd244 plugins: fix description for gst-inspect.
Fix the name of the plug-in element reported to gst-inspect-1.0. i.e. we
need an explicit definition for GStreamer >= 1.0 because the GST_PLUGIN_DEFINE
incorrectly uses #name for creating the plug-in name, instead of using macro
expansion (and let further expansion of macros) through e.g. G_STRINGIFY().
2013-04-12 13:44:52 +02:00
Gwenole Beauchesne
1b500dee54 Allow build against either GStreamer API (0.10 or 1.0).
Introduce a new configure option --with-gstreamer-api that determines
the desired GStreamer API to use. By default, GStreamer 1.0 is selected.
Also integrate more compatibility glue into gstcompat.h and plugins.
2013-04-10 14:58:17 +02:00
Sreerenj Balachandran
38d84d968e plugins: initial port to GStreamer 1.0.
Port vaapidecode and vaapisink plugins to GStreamer API >= 1.0. This
is rather minimalistic so that to test the basic functionality.

Disable vaapiupload, vaapidownload and vaapipostproc plugins. The latter
needs polishing wrt. to GStreamer 1.x functionality and the former are
totally phased out in favor of GstVaapiVideoMemory map/unmap facilities,
which are yet to be implemented.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00