Commit graph

853 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
242e801818 plugins: log the GstVaapiDisplay name
Now that GstVaapiDisplay is descendant of GstObject, it has a human-friendly
name. Log it instead of the memory address.
2016-11-03 08:27:57 +01:00
Hyunjun Ko
185da3d1a4 libs: display: GstVaapiDisplay as GstObject descendant
This patch is to change the inheritance of GstVaapiDisplay to GstObject,
instead of GstVaapiMiniObject. In this way we can use all the available
infrastructure for GObject/GstObject such as GstTracer, GIR, etc.

In addition, a new debug category for GstVaapiDisplay is created to make it
easier to trace debug messages. It is named "vaapidisplay" and it transverse
all the VA display backends (DRM, GLX, EGL, Wayland, ...)

This patch is a step forward to expose GstVaapiDisplay for users in a future
library.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-11-03 08:24:59 +01:00
Víctor Manuel Jáquez Leal
af0c2fab0d vaapidecodebin: resurrect disable-vpp property
https://bugzilla.gnome.org/show_bug.cgi?id=773589
2016-10-27 17:35:33 +02:00
Víctor Manuel Jáquez Leal
4100e8d5c2 vaapidecodebin: name the internal queue
https://bugzilla.gnome.org/show_bug.cgi?id=773589
2016-10-27 17:35:33 +02:00
Víctor Manuel Jáquez Leal
0db3e14989 vaapidecodebin: remove unused variables
Since vaapipostproc is only registered if the driver supports it, all the
support for dynamic loading were removed. Though some leftovers remained.

https://bugzilla.gnome.org/show_bug.cgi?id=773589
2016-10-27 17:35:33 +02:00
Víctor Manuel Jáquez Leal
74a9f76d32 docs: replace vaapidecode with each codec
In the spirit of the codec split, this patch removes the documentation of
vaapidecode and adds a page per each possible decoder.

Nonetheless, only those available in the compilation system are going to be
instrospected, because the rest are not registered.
2016-10-27 13:04:37 +02:00
Víctor Manuel Jáquez Leal
0b46da2a8f docs: add missing long descriptions 2016-10-27 11:06:06 +02: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
Víctor Manuel Jáquez Leal
c258343243 vaapidecode: rename member to allowed_sinkpad_caps
vaapidecode has a member named allowed_caps, but this name is not enough
explicit. This patch renames allowed_caps to allowed_sinkpad_caps.

No functional changes were included.

https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:38:26 +02:00
Víctor Manuel Jáquez Leal
0f938be7a4 plugins: fix code style for errors
https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:38:26 +02:00
Víctor Manuel Jáquez Leal
34e8579238 vaapivideomemory: comment style
https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:38:26 +02:00
Víctor Manuel Jáquez Leal
289a8e5b87 vaapivideomemory: rename input parameter
In order to clarify the use of flag as input parameter, it is renamed to
surface_alloc_flag, since it is used when creating a VA surface with certain
properties.

https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:38:26 +02:00
Víctor Manuel Jáquez Leal
039e8c0d56 vaapidecode: rename element description
So encoders and decoders have similar descriptions.

https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:36:07 +02:00
Víctor Manuel Jáquez Leal
43dd4b7452 vaapiencode: h264, h265: rename codec name
So encoder and decoders have the same codec name.

https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:24:34 +02:00
Víctor Manuel Jáquez Leal
4f4e0a8f36 plugins: simplify code
Merge two lines of variable declarations.

https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:04:31 +02:00
Julien Isorce
84f7a3ec51 vaapivideomemory: add explanation about the call 'dup (dmabuf_fd)'
In short GstFdMemory is configured to call close when using
GstDmabufMemory.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2016-10-19 19:45:08 +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
Hyunjun Ko
5a4540e654 plugins: reset textures at negotiation/shutdown
When caps reconfiguration is called, the new downstream frame size might be
different. Thus, if the downstream caps change,the display's texture map is
reset.

In addition, during pipeline shutdown, textures in texture map have to be
released, since each one have a reference to the GstVaapiDisplay object, which
is a dangerous circular reference.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-09-22 17:01:59 +02:00
Hyunjun Ko
a80e10ac5c libs: display{egl,glx}: cache GstVaapiTextures
instances when created and reuse

This patch improves performance when glimagesink uploads a GL texture.

It caches the GStVaapiTexture instances in GstVaapiDisplay{GLX,EGL}, using an
instance of GstVaapiTextureMap, so our internal texture structure can be found
by matching the GL texture id for each frame upload process, avoiding the
internal texture structure creation and its following destruction.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-09-22 17:01:59 +02:00
Víctor Manuel Jáquez Leal
99d404f1df vaapidecode: reset decoder hard when set_format()
set_format() is called by upstream when the stream capabilites has changed.
Before, if the new stream is compatible with the old one the VA decoder was
not destroyed. Nonetheless, with this behavoir, the VA decoder ignores
when the upstreamer parsers gets more details of the stream, such as the
framerate. Hence, when the src caps are negotiates, the further sink caps
updates are ignored.

This patch forces the VA decoder destroying and recreation when set_format()
is called.

https://bugzilla.gnome.org/show_bug.cgi?id=770921
2016-09-15 10:38:08 +02:00
Víctor Manuel Jáquez Leal
abffbfc71f Revert "vaapivideomemory: load VA Image when mapping to write"
This reverts commit c67edea4ab.
2016-09-12 12:45:01 +02:00
Hyunjun Ko
de233c137f plugins: set allocator's image size to sinkpad bufferpool
Otherwise the buffer is always ditched by the bufferpool, losing performance.

https://bugzilla.gnome.org/show_bug.cgi?id=771035
2016-09-08 17:09:55 +02:00
Hyunjun Ko
c67edea4ab vaapivideomemory: load VA Image when mapping to write
When calling gst_video_frame_map() with GST_MAP_WRITE flag, it doesn't call
ensure_image_is_current(), which means it doesn't guarentee VAImage is valid
in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=766978
2016-09-08 16:38:52 +02:00
Víctor Manuel Jáquez Leal
5ed967088f vaapidecode: merge vc1 and wmv3 elements
This patch merges vaapivc1dec and vaapiwmv3dec into a single
vaapivc1dec. Also, removed the WMVA format, since it is not
supported by libva.

https://bugzilla.gnome.org/show_bug.cgi?id=734093
2016-09-06 12:39:22 +02: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
020cb8badb plugins: check dmabuf-import for sink pad allocator
Check earlier if upstream video source has activated the dmabuf-import
io-mode (hack to disappear soon), thus we can avoid the re-assignation of a
new allocator.
2016-07-29 15:54:50 +02:00
Víctor Manuel Jáquez Leal
773eea0db0 plugins: reset allocators if video info changed
If the frame size or format, change, the allocators are reset, so a new ones
can be created with the new video info.
2016-07-29 15:54:50 +02:00
Víctor Manuel Jáquez Leal
01b5ed3edb plugins: remove sink pad allocator if caps change
If the negotiated sinkpad caps change, destroy the assignated allocator,
because it is not valid anymore.
2016-07-29 15:25:09 +02:00
Víctor Manuel Jáquez Leal
0541ef4510 pluginutil: const params to gst_video_info_changed()
Since they are not modified, we should mark them as const.
2016-07-29 15:25:09 +02:00
Víctor Manuel Jáquez Leal
892b6d3822 gstvaapivideomemory: allocator's image size getter
Add the method gst_allocator_get_vaapi_image_size() for the
GstVaapiVideoAllocator, which gets the size of the allocated images with the
current video info.

This method replaces the direct call to the allocator's image info when the
pool is configured.
2016-07-29 15:13:29 +02:00
Hyunjun Ko
d0ee0b4e72 plugins: update buffer pool size with new allocator's image size
Depends on media, video size is sometimes updated with new allocator.
It leads to dismatch between bufferpool's set size and real allocated buffer size.

In this case, it causes every buffer is freed during release in bufferpool,
which should be reused. This affects performance.

https://bugzilla.gnome.org/show_bug.cgi?id=769248
2016-07-29 13:46:52 +02: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
55daedf514 vaapidecode: split all the codecs
Split the vaapidecode to all the supported codecs with the format
vaapi{codec}dec.

vaapidecode is stil registered as a GObject type, but not as a
GStreamer feature, so it can be used internally by vaapidecodebin without
changing its code too much.

https://bugzilla.gnome.org/show_bug.cgi?id=734093
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
ca0c3fd627 vaapidecodebin: simplify the code
Since the elements dependant of the VA video processor are now only registered
if it is available, vaapidecodebin code can be simplified a lot, removing all
the code required to check if the VA video processor was available.

https://bugzilla.gnome.org/show_bug.cgi?id=768899
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
cc6c2d23ce vaapidecode: delay the GstVaapiDisplay instantiating
Delay the GstVaapiDisplay instantiating until when changing the state from
READY to PAUSE. In this way the element has more chances to find an already
created GstVaapiDisplay, or a GL context, in the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=766206
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
0faff37e73 pluginutil: set GLX display type
The function gst_vaapi_create_display_from_gl_context() cretes a
GstVaapiDisplay given a GstGLContext. But it didn't created a GLX VA display
when the GL platform was GLX, but a plain X11 VA display.

This patch fixes that, by querying the GL platform earlier.

https://bugzilla.gnome.org/show_bug.cgi?id=766206
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
604986749e plugins: add gst_vaapi_plugin_base_find_gl_context()
Using the GstContext mechanism, it is possible to find if the pipeline
shares a GstGLContext, even if we are not to negotiating GLTextureUpload
meta. This is interesting because we could negotiate system memory caps
feature, but enable DMABuf if the GstGLContext is EGL with some extensions.

https://bugzilla.gnome.org/show_bug.cgi?id=766206
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
fabcb4dc06 plugins: remove gst_vaapi_plugin_base_driver_is_whitelisted()
Since nobody is calling gst_vaapi_plugin_base_driver_is_whitelisted(),
it is deleted.
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
dcb0de8532 plugins: remove common change_state() vmethod
Remove the common change_state() vmethod for all the plugins, since no one is
using it.
2016-07-22 17:23:23 +02:00
Víctor Manuel Jáquez Leal
4a9b204652 vaapidecode: remove change_state() vmethod
Since the driver checkup is done at registering, there is no need to do it
when changing the element state from NULL to READY. This patch remove this
vmethod from vaapidecode.
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
a9e7eac108 plugins: add gst_vaapi_driver_is_whitelisted()
Move some of the logic in gst_vaapi_plugin_base_driver_is_whitelisted() to a
new function gst_vaapi_driver_is_whitelisted(), in this way, it can be used
when registering the plugin's feature set with the test VA display.

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
024d540195 vaapidecode: remove unneeded initializations
GObject's memory is set to zero, so there is no need to initialize to zero or
NULL it's class variables.
2016-07-22 17:18:16 +02:00
Víctor Manuel Jáquez Leal
955cdb84e6 plugins: remove undefined macros 2016-07-22 17:18:09 +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