Commit graph

1322 commits

Author SHA1 Message Date
U. Artie Eoff 9fd020a117 vaapipostproc: handle size and direction together in src events
Mapping a pointer event needs to consider both size and
video-direction operations together, not just one or the other.

This fixes an issue where x,y were not being mapped correctly
for 90r, 90l, ur-ll and ul-lr video-direction. In these directions,
the WxH are swapped and GST_VAAPI_POSTPROC_FLAG_SIZE is set.  Thus,
the first condition in the pointer event handling was entered and
x,y scale factor were incorrectly computed due to srcpad WxH
swap.

This also fixes all cases where both video-direction and scaling
are enabled at the same time.

Test that all pointer events map appropriately:

for i in `seq 0 7`
do
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} width=300 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} width=300 height=200 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} height=200 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} \
  ! vaapisink
done
2019-09-04 16:03:24 -07:00
U. Artie Eoff 6700f642fc vaapipostproc: advertise crop meta is handled
Advertise to upstream that vaapipostproc can handle
crop meta.

When used in conjunction with videocrop plugin, the
videocrop plugin will only do in-place transform on the
crop meta when vaapipostproc advertises the ability to
handle it.  This allows vaapipostproc to apply the crop
meta on the output buffer using vaapi acceleration.
Without this advertisement, the videocrop plugin will
crop the output buffer directly via software methods,
which is not what we desire.

vaapipostproc will not apply the crop meta if downstream
advertises crop meta handling; vaapipostproc will just
forward the crop meta to downstream.  If crop meta is
not advertised by downstream, then vaapipostproc will
apply the crop meta.

Examples:

1. vaapipostproc will forward crop meta to vaapisink
 gst-launch-1.0 videotestsrc \
  ! videocrop left=10 \
  ! vaapipostproc \
  ! vaapisink

2. vaapipostproc will do the cropping
 gst-launch-1.0 videotestsrc \
  ! videocrop left=10 \
  ! vaapipostproc \
  ! identity drop-allocation=1 \
  ! vaapisink
2019-08-30 17:01:55 +00:00
He Junyan 258719e0ed plugin: encode: delete useless init_properties.
Also delete the get_properties function in encode class. We now
use g_object_class_list_properties to get all properties for
internal encoder class.
2019-08-30 21:21:04 +08:00
He Junyan 2ab5e0ef46 plugin: encode: delete set/get_property func in encode class
Use standard gobject's property functions to replace the old way.
2019-08-30 21:21:04 +08:00
He Junyan 46ce4e3054 plugin: encode: delete gst_vaapiencode_init_properties
No need to init the properties got by get_default_properties func
now. The properties are inited correctly in internal encoder class.
2019-08-30 21:21:04 +08:00
He Junyan 1256680486 gst: encode: enable new type of property mechanism. 2019-08-30 21:19:14 +08:00
He Junyan 05643dadb5 gst: encode: add property help functions for encoder properties.
The encoder is a true gstobject now and all the properties are using
gobject's properties mechanism. Add help functions to handle the properties
between encode and encoder class.
The basic idea is mapping the same property between encoder and encode. All
the encoder's properties will have the same name, the same type in encode.
The set/get property function just forward the property setting/getting to
the encoder using the same property name and value. Because the encoder is
created on needed, we need to cache the property setting in encode.
2019-08-30 21:06:47 +08:00
Víctor Manuel Jáquez Leal d671197684 vaapipostproc: check for filter before appending caps
While ensuring the allowed sink pad caps, the filter attributes set
the frame size restriction, but it is not ensured, at that moment,
that the filter is already instantiaded.

In order to silence the glib logs, this patch add only calls
gst_vaapi_filter_append_caps() if the filter is instantiated.
2019-08-29 11:03:30 +00:00
Thibault Saunier 9fe6b621a2 Classify vaapidecodebin as a hardware decoder 2019-08-28 12:49:03 -04:00
He Junyan 70cefdd272 libs: postproc: fix a memory leak point.
filter_ops and filter_formats should already have valid value when
the function gst_vaapipostproc_ensure_filter_caps re-enter
2019-08-27 16:33:34 +00:00
Wangfei 6f8ea02b61 vaapidecode: support transform ROI meta
This will benefit the use case like:

src --->   encode    ---> decode ---> circle ROI ---> sink
     |                |
     --> analyse to -->
         get ROI
2019-08-26 09:36:54 +00:00
Mathieu Duponchelle 0592731715 docstrings: port ulinks to markdown links 2019-08-23 19:10:15 +02:00
Víctor Manuel Jáquez Leal dae057588b libs: remove surface's parent context
In commit 18031dc6 surface's parent context is not assigned because of
circular references. Since then (2013), there's has no issue with
subpictures attached to a context, the current only users of this API.

This patch cleans up all of related code with the unused surface's
parent context.
2019-08-20 17:11:23 +02:00
Víctor Manuel Jáquez Leal e8b52f59f5 vaapidecode: guard if no structure is available in caps 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal f88d18bebe vaapipostproc: append frame size restrictions in caps 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal 6f61252f9d vaapiencode: set frame size restrictions in caps
Fixes: #12
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal 3ba3966fc3 vaapiencode: enhance how the profile is defined
This code doesn't define the profile used by the internal encoder, but
it used to "predict" which is going to be used and to get the caps
restrictions.

Before the profile was predicted by checking the donwstream caps, but
sometimes they are not defined, setting an unknown profile. In order
to enhances this situation, the encoder asks to internal encoder if it
has one. If so, it is used.

To ask the internal encoder's profile a new accessor function was
added: gst_vaapi_encoder_get_profile()
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal f7c1ac036d libs: profilecaps: move caps config into a new file
Implement all the appending of frame size restrictions in caps, for
encoders and decoders, in a new source file.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal 6cb3e741fd vaapipostproc: handle navigation downstream event
When navigation events contains coordiantes those have to be mapped
to the new size and/or orientation.
2019-08-19 16:48:50 +00:00
Víctor Manuel Jáquez Leal bcb29e8399 vaapipostproc: handle image-orientation upstream event
Now that vaapipostproc can possible handle video-direction, it
should also handle the image-orientation event from upstream if
video-direction property is set to auto.
2019-08-19 16:48:50 +00:00
Víctor Manuel Jáquez Leal b8a333e0c3 vaapipostproc: add missing locks when adding flags 2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal bd175f9956 vaapipostproc: update filter before fixate caps
It is requiered to know if postproc is capable to change the video
direction before fixating the source caps.

In order to do it, it'ss required to know if there's a functional VPP,
but that's checked at create() vmethod, which occurs after caps
fixating.

This patch checks for a functional VPP at fixate caps and, if so,
checks for the enabled filtes and later do the caps fixations.
2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal c06b587819 vaapipostproc: element warning if video direction is unsupported
If the video direction is unsupported by the driver, an element
warning is posted in the bus to notify the application.

gst_vaapi_enum_type_get_nick() was added in the library thus it can
be used elsewhere. It retrives the nick from an enum gtype.
2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal e48b0a90f1 vaapivideomemory: demote error message to info
The main reason to demote the message's level is because it is not an
error, it's a possible output of the trial and there's a code path
that handles it.

Secondly, it's very annoying when using gallium driver for radeon.
2019-08-15 12:58:44 +02:00
Víctor Manuel Jáquez Leal 14ea838512 vaapidecodebin: set queue's max size buffers to 1
Otherwise the queue will swallow all the available decoder's surfaces
reaching a dead-lock.

This setting might impact the bin's peformance, but it's a trade-off.
2019-07-26 12:43:17 +02:00
Víctor Manuel Jáquez Leal 1fa172f032 vaapidecodebin: set properties default values 2019-07-26 12:40:01 +02:00
Víctor Manuel Jáquez Leal ec9a2a4b4e vaapidecode: don't error if can't push buffers downtream
When the code path goes to push buffers downstream when no surface
available in decoder context, and it fails the code bails out with a
fatal error.

That behavior is wrong, since it shouldn't be fatal. The use case is
when the video stream is disabled.

This patch just ignores the errors in this situation and demotes the
level of a log message.
2019-07-26 12:40:01 +02:00
U. Artie Eoff 4e4ca03bc1 vaapipostproc: update PAR when rotating
When rotating, swap pixel-aspect-ratio during
negotiation.

Fixes #181
2019-07-15 15:33:15 -07:00
U. Artie Eoff f1aa0cc5e0 vaapipostproc: add rotation support
Adds vpp rotation support to vaapipostproc.  Uses
property video-direction. Default is identity (no
rotation).

Closes #104
2019-07-09 12:26:46 -07:00
Wangfei e4bec306b6 vaapidecode: set initial decode format according surface chroma type
For surfaces with different chroma type, it is prefer to initialize
a format which chroma type should be same with surface chroma type
instead of using fixed NV12.
2019-06-26 10:36:56 +00:00
Wangfei 67ed67515b libs: decoder: jpeg: add support 400/411/422/444 chroma type
When create vaapi surface, it is better to use the chroma type get
from jpeg file instead of using fixed 420 format. And the correct
chroma type can be determined by horizontal_factor/vertical_factor
flags that get from jpegparse.
2019-06-26 10:36:56 +00:00
U. Artie Eoff a6dfb6e5be plugins: remove last negotiated video info if caps are same
If the allocation caps and negotiated caps are the same,
then ensure any previously negotiated video info is also
removed.  This can occur when multi-resolution video
decoding returns to it's original resolution.

Fixes #170
2019-06-10 21:28:13 -07:00
U. Artie Eoff 5f41422215 vaapivideomemory: allow negotiated info to be removed
Allow NULL negotiated_vinfo to be passed into
gst_allocator_set_vaapi_negotiated_video_info to allow
any previously set info to be removed.
2019-06-10 20:39:28 -07:00
Freyr666 53d86ff519 vaapiencode: Fixes deadlock in gst_vaapiencode_change_state function
This fixes a deadlock in gst_vaapiencode_change_state, which was due to
srcpad's chain function was locked waiting for available buffers. Since the
coded buffers in codedbuf_queue become available after sinkpad consume the
encoded frames, Paused -> Ready state change leads to deadlock. Coded buffers
are never consumed and marked free, hence gst_vaapiencode_handle_frame waits for
available buffers and holds the stream_lock of the srcpad.
2019-05-30 07:08:35 +00:00
Mathieu Duponchelle df3989865e doc: remove xml from comments 2019-05-29 23:08:22 +02:00
U. Artie Eoff 3ccf3f3334 vaapipostproc: add mirror support
Adds vpp mirroring support to vaapipostproc.  Use
property video-direction.  Valid values are identity,
horiz or vert.  Default is identity (no mirror).

Closes #89

v2: Use GstVideoOrientationMethod enum
v3: Don't warn for VA_MIRROR_NONE.
    Use GST_TYPE_VIDEO_ORIENTATION_METHOD type.
v4: Query VAAPI caps when setting mirror value
    instead of during per-frame processing.
v5: Return TRUE in warning cases when setting mirror value.
2019-05-29 09:06:27 +00:00
Mathieu Duponchelle 38d25c65c3 doc: fix some incorrect gtk-doc links 2019-05-29 01:41:37 +02:00
Thibault Saunier b0f5a59760 docs: Port to hotdoc 2019-05-13 17:00:00 -04:00
Wangfei 2ee518a988 vaapiencode: handle DMABuf caps feature in sink pad
Add DMABuff caps features in all encoders' sink pad.
2019-05-06 16:54:00 +02:00
Víctor Manuel Jáquez Leal 838045b9e2 vaapipostproc: don't do any color conversion when GL_TEXTURE_UPLOAD
https://bugzilla.gnome.org/show_bug.cgi?id=748184 has resurrected
with commit 3e992d8a

Since gst_vaapi_find_preferred_caps_feature() returns a color format
from caps negotiation, different from the default one (NV12), the
postproc enables the color transformation. But when GL_TEXTURE_UPLOAD
feature is negotiated, no color transformation shall be done.

Nonetheless, with commit 3e992d8a the requested format changes
firstly, because there's no video sink yet, so ANY caps are
negotiated; but later, when there's a video sink and a caps
renegotiation, the GL_TEXTURE_UPLOAD is negotiated though the color
format conversion still ongoing. It is required to reset that
conversion.

This patch force default color format when GL_TEXTURE_UPLOAD is
selected as preferred, thus avoiding the color conversion.

Fixes: #157
2019-05-02 16:47:28 +02:00
Wangfei e88f349c6f plugins: find the preferred format from right caps.
When the downstream has any caps, then raw video feature will
be used. At this situation, the preferred format should be chose
from caps which contains "vide/x-raw" feature instead of from
the fist allowed caps.

Fixes #142
2019-04-11 08:40:38 +00:00
Danilo Spinella f91046bad3 vaapipluginutil: Fix #endif for USE_X11 2019-03-30 18:29:31 +01:00
He Junyan acf10ce164 vaapiencode: gobject's prop_id differ from vaapi encoder
The vaapi internal encoder's property id are negative, thus they are
different from GObject's property ids.

gst_vaapi_encoder_set_property() should map to the internal encoder
property id, assigned in gst_vaapiencode_default_set_property().
2019-03-25 19:15:38 +01:00
Víctor Manuel Jáquez Leal 3e992d8adb plugin: if any caps in downstream, negotiate raw video
When downstream has any caps, vaapi should not shovel vaapi featured
buffers, but rather plain raw video, assuming always the worst case
scenario (downstream cannot handle featured video memory but raw
system memory buffers).

This patch query the peer caps without any filter, to know if
donwstream just ask for any caps, if so jump to the color space
checking, otherwise do the caps intersection and continue with the
feature selection algorithm.

Fixes: #139
2019-02-27 13:13:14 +01:00
He Junyan ee21fd9053 vaapivideomemory: Prefer same format for surface and image
We prefer to use the same format between image and surface for gst
vaapi allocator. The old way may choose different formats between
image and surface. For example, the RGBA image may have a NV12 surface.

So we need to do format conversion when we put/get image to surface.

Some drivers such as iHD can not support such conversion and always
cause a data flow error. There may also have some performance cost
for format conversion when put/get images.

So we prefer to use the same format for image and surface in the
allocator. If the surface can not support that format, we then
fallback to find a best one as the surface format.

Co-authored-by: Víctor Jáquez <vjaquez@igalia.com>
2019-02-21 13:41:46 +01:00
Niels De Graef f84394fa49 libs: wayland: add support for XDG-shell protocol
[wl_shell] is officially [deprecated], so provide support for the
XDG-shell protocol should be provided by all desktop-like compositors.
(In case they don't, we can of course fall back to wl_shell).

Note that the XML file is directly provided by the `wayland-protocols`
dependency and generates the protocol marshalling code.

[wl_shell]: https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/group__iface__wl__shell.html
[deprecated]: 698dde1958
2019-02-16 23:55:42 +01:00
Víctor Manuel Jáquez Leal 7afe5311cc vaapisink: x11: trap WM_DELETE_WINDOW message
Register the WM_DELETE_WINDOW message from window manager and
trap it to stop the pipeline cleanly.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/130
2019-01-24 21:11:54 +01:00
Wangfei 98c32df830 vaapipostproc: before set surface proxy, check if it already been created and exist.
Fix the deinterlace black frame when playing with glimagesink:
gst-launch-1.0 filesrc location=test.264 ! h264parse ! vaapih264dec \
! vaapipostproc deinterlace-mode=1 deinterlace-method=1 ! glimagesink
2019-01-15 14:48:19 +08:00
Haihao Xiang 5b447753da meson: build h264 fei encoder if possible 2019-01-07 17:46:42 +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
He Junyan 7663fa263c plugins: Add more check for allowed raw caps.
The gst_vaapi_plugin_base_get_allowed_raw_caps is used for both sink
pad and src pad, which cause some bugs. For sink pad, we need to verify
vaPutImage() while for the src pad we need to verify vaGetImage().
For vaapidecoderXXX kind of plugins, the case is more complex. We need
to verify whether the decoded result(in some surface, NV12 format most
of the time) can be vaGetImage to some raw image format. Add more check
to fix all these problems.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/123

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2018-12-24 10:46:23 +00:00
Wangfei 63ea81a983 vaapipostproc: fix csc fail when only change width or height. 2018-12-18 10:47:15 +08:00
Wangfei 1513cf774d libs: enc: h264: set max profile idc with correct profile.
Use the highest rank of available profile as the max profile to
set max idc value.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/124
2018-12-15 14:48:03 +08:00
Wangfei 5e7988b2d8 libs: dec: h265: support decode for main-444 10bit streams.
Add 444 10bit yuv format Y410, which can be used to decode
main-444 10bit streams. Currently, this feature is only
supported by media-driver in Icelake.
2018-12-04 13:25:59 +08:00
Jordan Petridis d8b3c0495f
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:56:44 +02:00
He Junyan 176bbce975 plugins: modify image check of extract_allowed_surface_formats.
The extract_allowed_surface_formats function just check whether
we can support some kind of surface/image format pair. We just
need to create a surface, create an image with the same video-format
and putImage from image to surface. All these operations success,
that kind of video-format is supported.
The old manner do not work for some kind of video-format. For example,
the RGBA kind of format will create a NV12 surface and RGBA image,
and the putImage will fail because the format is not same. And so
the RGBA format is not supported but actually it is supported.
2018-11-27 15:11:51 +00:00
Michael Olbrich c1de41b841 vaapipostproc: add some missing locking
gst_vaapi_plugin_base_close() removed the raw caps that are used indirectly
in gst_vaapipostproc_transform_caps(). The usage is already protected by
the mutex.
This is needed when the pipeline is stopped during startup.
2018-11-27 07:13:20 +01:00
Xiang, Haihao c728fb4ff6 Close dmabuf_fd
Otherwise it will result in resource leak when failed to create
dmabuf memory
2018-11-20 16:18:58 +08:00
Michael Olbrich 072f49cdcf vaapiencode: don't start src pad task in set_format
Otherwise the task may be restarted during shutdown. Start the task in
gst_vaapiencode_handle_frame() instead.
2018-11-14 12:55:49 +01:00
Wangfei 5d0878b48a libs: dec: h265: support decode for main-444 8bit streams.
Add 444 8bit yuv format AYUV, which can be used to decode
main-444 8bit streams. Currently, this feature is only
supported by media-driver in Icelake.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/119
2018-11-14 02:29:54 +00:00
Junyan He f25a80bf05 plugins: Fix build error when GL is enabled while EGL is disabled.
gl_platform_type in gst_vaapi_get_display_type_from_gl_env generate
unused-variable warning and may block build when Werror enabled.
Several functions like gst_vaapi_display_egl_new_with_native_display
have no prototype warning and link error when GL is enabled but EGL
is disabled. Fix all these warning and link error.

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

Signed-off-by: Junyan He <junyan.he@intel.com>
2018-11-05 14:28:01 +01:00
Wangfei 638004875b libs: dec: h265: support decode for main-10-422 10bit streams.
Add 422 10bit yuv format Y210, which can be used to decode
main-10-422 10bit streams. Currently, this feature is only
supported by media-driver in Icelake.

https://bugzilla.gnome.org/show_bug.cgi?id=797264
2018-11-01 14:03:23 +01:00
Víctor Manuel Jáquez Leal ce96f2d1fa vaapipostproc: fix classification string
The classification string is splitted by '/' and then looks for the
components.

This patch removes the ';' by unifying all the components.
2018-10-15 17:55:24 +02:00
Philippe Normand 8914ace06a vaapipostproc: Add Hardware classifier to metadata 2018-10-15 16:06:31 +01:00
Philippe Normand 70726aef00 gst: Advertise elements interacting with hardware devices 2018-10-12 15:39:53 +01:00
Soon, Thean Siew ee27377cb3 vaapipostproc: change the way of handling deinterlace
The current vaapipostproc calls driver's video processing
pipeline for deinterlacing only if it is Advance deinterlacing.
Modify in the way that it always tries with driver's video
processing pipeline for deinterlacing, and falls back to software
method of appending picture structure meta data only if it fails
with driver's method.

https://bugzilla.gnome.org/show_bug.cgi?id=797095
2018-10-09 16:19:52 +02:00
Wangfei 619abbdeb4 libs: dec: h265: add 422 chroma format support.
Add main-422-10 profile which support 422 chroma format stream.
Currently, this feature is only supported by media-driver in Icelake.

https://bugzilla.gnome.org/show_bug.cgi?id=797143
2018-09-27 11:55:04 +02:00
Víctor Manuel Jáquez Leal 0152410c97 libs: object: separation of internal API and plugins
Removed exposed macros GST_VAAPI_OBJECT_DISPLAY() and
GST_VAAPI_OBJECT_ID() to plugins, keeping them only for internal
library usage.

The purpose is readability.

https://bugzilla.gnome.org/show_bug.cgi?id=797139
2018-09-25 17:41:55 +02:00
Matteo Valdina 7872d12695 vaapidecode: Requests upstream a key unit at parse or decode error.
This is done to resume decoding after a parse error or decode error.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=797006
2018-09-03 16:11:13 +02:00
Matteo Valdina 2cb795fc77 vaapidecode: sets return value in failure case.
In gst_vaapidecode_handle_frame, when there is a decode error
there is a code path the returns an uninitialized value.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=797006
2018-09-03 15:38:33 +02:00
Nicolas Dufresne 06aa82f989 vaapidecode: Skip unparsable units from adapter
If the unit could not be parsed, just skip this nal and keep parsing
what is left in the adapter. We need to flush the broken unit in the
decoder specific parser because the generic code does not know about
units boundary. This increases error resilliance.

Before this, the broken unit would stay in the adapter and EOS would be
returned. Which stopped the streaming. Just removing the EOS would have
lead to the adapter size growing indefinitely.

https://bugzilla.gnome.org/show_bug.cgi?id=796863
2018-07-25 15:52:54 -04:00
Nicolas Dufresne d07bffb578 vaapidecoder: Don't error out on decode errors
This is problematic on live pipeline where loosing network can
cause an important amount of errors.

https://bugzilla.gnome.org/show_bug.cgi?id=796832
2018-07-25 15:52:54 -04:00
Mathieu Duponchelle b4d6a3b113 pluginutil: downgrade unsupported driver logging
On systems with an Nvidia card, this error is output each time
the registry is rebuilt, which happens pretty often when
using gst-build as a development environment.

https://bugzilla.gnome.org/show_bug.cgi?id=796663
2018-06-26 14:45:10 +02:00
Tim-Philipp Müller 4f32a72675 Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 13:07:20 +02:00
Víctor Manuel Jáquez Leal 6ccd5d6fb2 libs: display: remove gst_vaapi_display_ref()
Replace it with gst_object_ref()

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02: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 b1d8c68921 vaapibufferpool: declare parameter display as object
We have neglected to update this code since GstVaapiDisplay turned
into a GstObject descendant.

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal 19e4769501 plugins: fix compilation
gstvaapipluginutil.c:171:1: error: old-style function definition [-Werror=old-style-definition]
2018-06-12 15:45:44 +02:00
Víctor Manuel Jáquez Leal 94709d49c6 plugins: refactor gst_vaapi_create_display_from_gl_context()
gst_vaapi_create_display_from_gl_context() was a spaghetti mess.

This path refactors it, in order to make the code readable and
easy to follow.

https://bugzilla.gnome.org/show_bug.cgi?id=796564
2018-06-12 12:55:15 +02:00
Víctor Manuel Jáquez Leal e62f3d75cf plugins: handle EGL when creating VAAPI display from gl
If GstGL reports a EGL platform force to create a EGL display using
the native EGL display.

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-06-12 12:42:11 +02:00
Hyunjun Ko 50470ae89f display: egl: create VaapiDisplayEGL with native EGL display
gst_vaapi_display_egl_new_with_native_display() has been broken since
it wasn't used.

Currently it's needed to call this API to create a display providing
the EGL display, so it could avoid duplicated calls to the native
display (eg. eglTerminate).

Signed-off-by: Victor Jaquez <vjaquez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-06-12 12:35:04 +02:00
Michael Olbrich d79bda3153 vaapipostproc: don't copy the GstParentBufferMeta if use_vpp
Otherwise a reference to a DMABuf input buffer is kept until the output
buffer is deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=796399
2018-06-07 11:55:06 +02:00
Víctor Manuel Jáquez Leal 28952f534b vaapiencode: h264: log output caps 2018-06-06 11:04:02 +02:00
Víctor Manuel Jáquez Leal af3e6a8d16 vaapiencode: h264: find profile in available and allowed caps
The commit 67e33d3de2 ("vaapiencode: h264:
find best profile in those available") changed the code to pick a profile
that is actually supported by the hardware. Unfortunately it dropped the
downstream constraints. This can cause negotiation failures under certain
circumstances.

The fix is split in two cases:

1\ the available VA-API caps doesn't intersect with pipeline's allowed
caps:
 * The best allowed profile (pipeline's caps) is set as the encoding
   target profile (it will be adjusted later by the available profiles
   and properties)

2\ the available VA-API caps does intersect with pipeline's allowed
caps:
 * The intersected caps are fixed, and its profile is set as the
   encoding target profile. In this case the is not the best profile,
   but the minimal one (if VA-API reports the profiles in order).
   Setting the minimal profile of the intersected caps is better for
   compatibility.

This patch fixes other tests related with caps negotiation, for
example, it handles baseline profile, even when VA only supports
constrained-baseline.

Original-patch-by: Michael Olbrich <m.olbrich@pengutronix.de>

https://bugzilla.gnome.org/show_bug.cgi?id=794306
2018-06-06 11:04:02 +02:00
Víctor Manuel Jáquez Leal 705b37844e plugins: guard GstGL code 2018-05-21 13:57:08 +02:00
Wang,Fei 2d95089a8d vaapih264dec: add constrained and progressive profiles
Those profiles have been added in the version 2012-01
and 2011-06 of the AVC spec (A.2.4.1 and A.2.4.2).

Both are supported by VAProfileH264High

https://bugzilla.gnome.org/show_bug.cgi?id=795624
2018-04-30 12:48:26 +02:00
Víctor Manuel Jáquez Leal 59579a9cb3 plugin: remove custom GstGL context handling
Instead of using our own context handling for looking for GstGL
parameters (display, context and other context), this patch changes
the logic to use the utility function offered by GstGL.

https://bugzilla.gnome.org/show_bug.cgi?id=793643
2018-04-26 19:37:54 +02:00
Víctor Manuel Jáquez Leal 86bf89d16d plugins: GstGL API must use the member variables
This commit basically is a revert of commits 8092537 and fc1c415

https://bugzilla.gnome.org/show_bug.cgi?id=793643
2018-04-26 19:37:54 +02:00
Hyunjun Ko b9c38a295b plugins: pass members as parameters of gst_gl_ensure_element_data()
The parameters of gst_gl_ensure_element_data() have to be not
local variable since they are going to be used to see if they're
set in gst_element_set_context() inside the API.

This is basically a revert of commit 3d56306c

https://bugzilla.gnome.org/show_bug.cgi?id=793643
2018-04-26 19:35:49 +02:00
Hyunjun Ko bfac678e9a videocontext: support wl-display in "gst.vaapi.app.Display"
Through "gst.vaapi.app.Display" context, users can set their own
VADisplay and native display of their backend.

So far we support only X11 display, from now we also support Wayland
display.

Attributes:
- wl-display : pointer of struct wl_display .

https://bugzilla.gnome.org/show_bug.cgi?id=705821
2018-04-18 18:01:06 +02:00
Víctor Manuel Jáquez Leal fa77b2bf60 vaapiencode: h264: find best profile in those available
Instead to look for the best profile in the allowed profiles by
downstream, the encoder should look for the base profile in the
available profile in VA-API.

https://bugzilla.gnome.org/show_bug.cgi?id=794306
2018-03-30 20:44:25 +02:00
Víctor Manuel Jáquez Leal 940afd2900 vaapipostproc: change how the metadata is copied
Instead of copying the metada in prepare_output_buffer() vmethod,
it is done in append_output_buffer_metadata() thus deinterlaced
buffers could also have the proper metas.

GstVideoCropMeta now it is copied internally and it is decided via
transform_meta() vmethod.

A new internal method, copy_metadata() was added to handle VPP
transformation where non-GstVideoVaapiMeta metas were lost.
2018-03-01 09:48:38 -06:00
Nicolas Dufresne fde55003ca postproc: Copy meta data from input to output
This will ensure that meta data without memory tags will be copied. This
was noticed when testing ROI.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 17:51:02 -05:00
Víctor Manuel Jáquez Leal 25c2a0d353 Revert "vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest"
This reverts commit 8f1b88dac0.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 17:51:02 -05:00
Víctor Manuel Jáquez Leal ba28c6cff2 plugins: copy input buffer metas
When importing buffers to a VA-base buffer, it is required to copy
the metas in the original buffer, otherwise information will be
lost, such as GstVideoRegionOfInterestMeta.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 10:02:14 -06:00
Víctor Manuel Jáquez Leal 9827ab0f3f vaapidecode: generate system allocated buffers
Generate system allocated output buffers when downstream doesn't
support GstVideoMeta.

The VA buffer content is copied to the new output buffer, and it
replaces the VA buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:58:08 -06:00
Víctor Manuel Jáquez Leal 188434f251 vaapipostproc: handle system allocated buffers when required
When downstream can't handle GstVideoMeta it is required to send
system allocated buffers.

The system allocated buffers are produced in prepare_output_buffer()
vmethod if downstream can't handl GstVideoMeta.

At transform() vmethod if the buffer is a system allocated buffer,
a VA buffer is instanciated and replaces the out buffer. Later
the VA buffer is copied to the system allocate buffer and it
replaces the output buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:58:08 -06:00
Víctor Manuel Jáquez Leal 2c36610748 plugins: add gst_vaapi_copy_va_buffer()
This helper function aims to copy buffers with VA memory to dumb
buffers, when GstVideoMeta is not available dowstream.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00
Víctor Manuel Jáquez Leal 5842e9cf87 plugins: add COPY_OUTPUT_FRAME flag
This patch add the member copy_output_frame and set it TRUE when
when downstream didn't request GstVideoMeta API, the caps are raw
and the internal allocator is the VA-API one.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00
Víctor Manuel Jáquez Leal f0fd2aeb04 plugins: store the first downstream allocator if available
The allocator will be required if we need to allocate a buffer
to store the frame with the expected strides.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00
Víctor Manuel Jáquez Leal bcc480b70e vaapibufferpool: add gst_vaapi_video_buffer_pool_copy_buffer()
This function will inform the element if it shall copy the generated
buffer by the pool to a system allocated buffer before pushing it
to downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00
Víctor Manuel Jáquez Leal ad705cc5a3 vaapibufferpool: don't change config when forcing video meta
VA-API based buffer might need a video meta because of different
strides. But when donwstream doesn't support video meta we need to
force the usage of video meta.

Before we changed the buffer pool configuration, but actually this
is a hack and we cannot rely on that for downstream.

This patch add a check fo raw video caps and allocator is VA-API,
then the option is enabled without changing the pool configuration.
In this case the element is responsible to copy the frame to a
simple buffer with the expected strides.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00
Víctor Manuel Jáquez Leal 516d6bb3e2 vaapipostproc: set discont flag at vpp deinterlacing
When deinterlacing with VPP the discont flag was not forwarded to
the new created buffer. This patch sets the discont flag if input
buffer has it.
2018-02-20 10:55:49 -06:00
Víctor Manuel Jáquez Leal 1ca2c78c7a vaapibufferpool: remove wrong gcc annotation 2018-02-20 06:27:30 -06:00
Tim-Philipp Müller a0b0728b6b vaapi: dist new header 2018-02-15 18:29:04 +00: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
Víctor Manuel Jáquez Leal 19fe5c4d07 plugins: update mesa's vendor string in whitelist
Mesa has updated its VA-API Gallium driver vendor string:

https://cgit.freedesktop.org/mesa/mesa/commit/?id=5db29d62ce1fefa3f2ee6e4a4688576fde4bde4a

This patch tries to cover both, the old and the new one.

https://bugzilla.gnome.org/show_bug.cgi?id=793386
2018-02-13 16:57:57 +01:00
Víctor Manuel Jáquez Leal 448105578b plugins: handle vaapi allocator in allocation query
In propose_allocation() if the numer of allocation params is zero, the
system's allocator is added first, and lastly the native VA-API
allocator.

In decide_allocation(), the allocations params in query are travered,
looking for a native VA-API allocator. If it is found, it is reused as
src pad allocator. Otherwise, a new allocator is instantiated and
appended in the query.

https://bugzilla.gnome.org/show_bug.cgi?id=789476
2018-02-08 09:57:28 +01:00
Víctor Manuel Jáquez Leal 8855a926be vaapivideomemory: remove unused macro
GST_VAAPI_VIDEO_ALLOCATOR_NAME was added in commit 5b11b8332 but it
was never used, since the native VA-API allocator name has been
GST_VAAPI_VIDEO_MEMORY_NAME.

This patch removes GST_VAAPI_VIDEO_ALLOCATOR_NAME macro.

https://bugzilla.gnome.org/show_bug.cgi?id=789476
2018-02-07 09:22:29 +01:00
VaL Doroshchuk 76dbc3e971 vaapisink: don't mask button events for foreign windows
Don't subscribe to button press events when using a foreing window,
because the user created window would trap those events, preveting the
show of frames.

https://bugzilla.gnome.org/show_bug.cgi?id=791615
2018-02-05 11:36:35 +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
Víctor Manuel Jáquez Leal da77fd5e2e vaapipostproc: remove spurious code
This assignation is dead code, since gst_video_info_from_caps() set
to 1 by default.

https://bugzilla.gnome.org/show_bug.cgi?id=790149
2018-01-18 20:46:22 +01:00
Víctor Manuel Jáquez Leal ea9c52ea8f vaapipostproc: if no p-a-r in out caps define a range
Instead of copying the pixel-aspect-ratio from the sink caps, define
an open range for the src caps pixel-aspect-ratio. Later it will be
defined.

https://bugzilla.gnome.org/show_bug.cgi?id=790149
2018-01-18 20:46:22 +01:00
Víctor Manuel Jáquez Leal f3650381c3 vaapisink: check for display's color-balance properties
Check for display's color-balance properties, available by the VA-API
driver, before setting them.

Also logs an info message of those unavailable properties.

https://bugzilla.gnome.org/show_bug.cgi?id=792638
2018-01-18 13:18:27 +01:00
Víctor Manuel Jáquez Leal 6efce291f6 plugins: re-using buffer pool breaks renegotiation
at propose_allocation() we should not reuse the proposed buffer,
because it could break renegotiation.

https://bugzilla.gnome.org/show_bug.cgi?id=792620
2018-01-17 22:07:36 +01:00
Víctor Manuel Jáquez Leal 9933dcb218 plugins: use g_clear_object() to unref sinkpad_buffer_pool
https://bugzilla.gnome.org/show_bug.cgi?id=792620
2018-01-17 22:07:35 +01:00
Víctor Manuel Jáquez Leal 8688e81d42 plugins: remove dmabuf-import hack
Remove the hack to check if an upstream element has enabled the
property io-mode enabled as dmabuf-import.

https://bugzilla.gnome.org/show_bug.cgi?id=792034
2018-01-16 19:27:27 +01:00
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
Nicolas Dufresne b0d41c5db8 videoconvert: gst_element_post_message() is transfer full on msg
For this reson we need not to unref the message, even if it failed.
2017-12-06 16:11:46 -05:00
Nicolas Dufresne f9a57ccece Revert "vaapivideocontext: possible memleak when no bus attached"
This reverts commit 0438a3e626.
2017-12-06 16:11:25 -05:00
Víctor Manuel Jáquez Leal 8f5933cd80 vaapivideocontext: only vaapisink process app context
gst.vaapi.app.Display context is made for applications that will
provide the VA display and the native display to used by the
pipeline, when are using vaapisink as overlay. There are no use
case for encoders, decoders, neither for the postprocessor.

In the case of the vaapisink, it shall query for gst.vaapi.Display
upstream first, and then, if there is no reply,
gst.vaapi.app.Display context will be posted in the bus for the
application. If the application replies, a GstVaapiDisplay object
is instantiated given the context info, otherwise a
GstVaapiDisplay is created with the normal algorithm to guess the
graphics platform. Either way, the instantiated GstVaapiDisplay
is propagated among the pipeline and the have-message bus message.

Also only vaapisink will process the gst.vaapi.app.Display, if
and only if, it doesn't have a display already set. This is
caused because if vaapisink is in a bin (playsink, for example)
the need-context is posted twice, leading to an error state.

https://bugzilla.gnome.org/show_bug.cgi?id=790999
2017-12-01 23:11:11 +01:00
Víctor Manuel Jáquez Leal 466c839990 vaapivideocontext: log the name of GstVaapiDisplay
https://bugzilla.gnome.org/show_bug.cgi?id=790999
2017-12-01 23:11:11 +01:00
Víctor Manuel Jáquez Leal 0438a3e626 vaapivideocontext: possible memleak when no bus attached
https://bugzilla.gnome.org/show_bug.cgi?id=790999
2017-12-01 23:11:11 +01:00
Víctor Manuel Jáquez Leal 8092537763 plugins: centralize assignation of GL objects
Add plugin_set_gst_gl() where the GstGL objects are assigned.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Víctor Manuel Jáquez Leal 3d56306c37 plugins: set GL objects if ensured
Only set the GL display and GL other context if they are ensured.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Víctor Manuel Jáquez Leal fc1c415515 plugins: set GL objects if context is handled
Only set the GL display and GL other context if they are extracted
correctly from the gstreamer's context.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Víctor Manuel Jáquez Leal 4866e4c452 plugins: fix memory leak when GL context is created
When the GL display and context are created inside an VAAPI element
the created GL context is leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=773453
2017-11-01 11:27:36 +01:00
Víctor Manuel Jáquez Leal 72362e1063 plugins: direct rendering on memory:VASurface
As buffers negotiated with memory:VASurface caps feature can also be
mapped, they can also be configured to use VA derived images, in other
words "direct rendering".

Also, because of the changes in dmabuf allocator as default allocator,
the code for configuring the direct rendering was not clear.

This patch cleans up the code and enables direct rendering when the
environment variable GST_VAAPI_ENABLE_DIRECT_RENDERING is defined,
even then the memory:VASurface cap feature is negotiated.

https://bugzilla.gnome.org/show_bug.cgi?id=786054
2017-10-31 18:26:42 +01:00
Víctor Manuel Jáquez Leal 0a36a707ba plugins: only dmabuf on srcpad if downstream
Set if source pad can handle dmabuf only if the GstGL context comes
from downstream.

It is possible to know that at two moments:

1\ In the case of GstGLTextureUpload caps feature is negotiated and
   downstream pool reports back gst.gl.GstGLContext.

2\ When GstGLContext is found as GstContext from dowstream.

https://bugzilla.gnome.org/show_bug.cgi?id=788503
2017-10-20 16:36:04 +02:00
Víctor Manuel Jáquez Leal 1135e8bd31 vaapivideocontext: add inline documentation
Document function gst_vaapi_find_gl_local_context().

https://bugzilla.gnome.org/show_bug.cgi?id=788503
2017-10-20 16:36:04 +02:00
Víctor Manuel Jáquez Leal 6b2b1294f8 vaapivideocontext: return the direction of gl context
In function gst_vaapi_find_gl_context() add a direction parameter to
return back the direction where the GstGL context was found.

This is going to be useful when checking if downstream can import
dmabuf-based buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=788503
2017-10-20 16:36:04 +02:00
Víctor Manuel Jáquez Leal 998e79ced6 plugins: add gst_vaapi_plugin_base_set_srcpad_can_dmabuf()
This patch refactors the code by adding the function
vaapi_plugin_base_set_srcpad_can_dmabuf(), it determines if the passed
GstGLContext can handle dmabuf-based buffers.

The function is exposed publicly since it is intended to be used later
at GstVaapiDisplay instantiation.

https://bugzilla.gnome.org/show_bug.cgi?id=788503
2017-10-20 16:36:04 +02:00
Hyunjun Ko 8ef3bc3cc2 vaapiencode: allow to set property on runtime
Tis patch, allows some properties that we want to be set on
runtime. (eg. bitrate)

Note that all properties are under control by num_codedbuf_queued.

https://bugzilla.gnome.org/show_bug.cgi?id=786321
2017-10-20 13:22:51 +02: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
Thibault Saunier a6e191e09c Avoid infinite loop when vaapi_create_display fails
Which might be the case when using, for example, xvfb.
2017-10-16 11:59:11 +02:00
Víctor Manuel Jáquez Leal 68aca503ce plugins: try to create test display in order
When creating the test display for querying capabilites, it try in
certain order: DRM, Wayland and finally X11. GLX nor EGL are tried
since they are either composited with X11 or Wayland.

The reason for this is to reduce the posibility of failure that could
blacklist the plugin.

https://bugzilla.gnome.org/show_bug.cgi?id=782212
2017-10-03 13:14:55 +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
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
Víctor Manuel Jáquez Leal 8fee85ecaa plugins: memory:DMABuf only handles planar formats
When glimagesink negotiates the caps feature memory:DMABuf the
exported dmabufs buffers with NV12 format are not well rendered, thus
setting only planar.

https://bugzilla.gnome.org/show_bug.cgi?id=788229
2017-09-27 11:46:33 +02:00
Víctor Manuel Jáquez Leal 9f4a5762d5 vaapiencode: flush pending frames before set format
Flush pending frames, if any, in the internal encorder, before setting
the new negotiated format.

https://bugzilla.gnome.org/show_bug.cgi?id=786173
2017-09-26 11:34:20 +02:00
Víctor Manuel Jáquez Leal a4daa2a04a vaapidecode: drain pending frames before set format
Drain pending frames, if any, in the internal decoder before setting
the new negotiated format.

https://bugzilla.gnome.org/show_bug.cgi?id=786173
2017-09-26 10:48:20 +02:00
Víctor Manuel Jáquez Leal b063511c05 vaapisink: use GObject setter and getter
Instead of using gst_vaapi_display_set_property() or
gst_vaapi_display_get_property(), this patch set replace it usage
with g_object_set() or g_object_get().

Also the internal helper cb_set_value() is removed since it is not
used anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=788058
2017-09-22 20:06:42 +02:00
Hyunjun Ko 148f867c12 vaapiencode/libs: encoder: fix leaks of properties
https://bugzilla.gnome.org/show_bug.cgi?id=786321
2017-09-15 11:07:55 +02:00
Nicolas Dufresne 2039eb882e Request minimum buffer even if need_pool is FALSE
When tee is used, it will not request a pool, but still it wants to
know how many buffers are required.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-06 14:21:31 -04:00
Sreerenj Balachandran 782184e781 vaapisink: Fix rendering in drm display
Make sure vaapisink create a va surface backed buffer pool and all
required attributes get assigned correctly for drm display type.

This is needed to make the below pipeline working:
gst-launch-1.0 filesrc location= raw_video.mov ! videoparse format=uyvy
width=320 height=240 framerate=30/1 ! vaapisink display=drm

https://bugzilla.gnome.org/show_bug.cgi?id=786954
2017-09-01 13:48:01 -07: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
Yi A Wang a46ad6b5be FEI: plugin: Add virtual methods to base encode
Two new virtual methods are added to gstvaapiencode.

load_control_data():  load the FEI input buffers set by the upstream elements
save_stats_to_meta(): save the FEI output buffers to Meta for downnstream elements

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 11:36:49 +02:00
Yi A Wang 0fdef0e349 FEI: plugin: Add fei specific video meta
GstVaapiFeiVideoMeta holds the below fei codec objects:
  GstVaapiEncFeiMbCode
  GstVaapiEncFeiMv
  GstVaapiEncFeiMvPredictor
  GstVaapiEncFeiMbControl
  GstVaapiEncFeiQp
  GstVaapiEncFeiDistortion

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 11:36:49 +02:00
Orestis Floros 1ae42facc1 vaapidecode: force add h264 SVC profiles in caps
When vaapih264dec's base-only profile is set to TRUE, fake SVC profile
support in caps.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2017-08-28 17:34:50 -07:00
Víctor Manuel Jáquez Leal 466c0548dc plugins: include main gstgl header
Instead including particular gstgl header files in a header file
that doesn't export a gstgl symbol, the main gstgl header file is
included in gstvaapipluginutil.c where the symbols are used.

https://bugzilla.gnome.org/show_bug.cgi?id=786597
2017-08-22 11:41:21 +02:00
Hyunjun Ko ee159b58ee vaapidecode: fix mismatch of the return type
https://bugzilla.gnome.org/show_bug.cgi?id=786307
2017-08-15 11:50:22 +03:00
Víctor Manuel Jáquez Leal 9578fd1f7b vaapiencode: h264: remove spurious code
Coverity scan bug:

An unsigned value can never be negative, so this test will always
evaluate the same way.

As len is guint32, there is no need to check it if it is equal or
bigger than zero.
2017-08-08 17:38:51 +02:00
Víctor Manuel Jáquez Leal 0b3ca62632 vaapidecode: initialize variable
Coverity scan bug:

The variable will contain an arbitrary value left from earlier
computations.

Variable base_only is fetched from base-only property, and it may be
not assigned. It needs to be initialized.
2017-08-08 17:34:12 +02:00
orestisf 3bb96eff14 vaapidecode: fix gst_caps_new_simple call
https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 23:28:59 +02:00
orestisf d4b6459bb2 vaapidecode: force add h264 MVC profiles in caps
When vaapih264dec's base-only profile is set to TRUE, fake MVC profile
support in caps.

https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:22 +02:00
orestisf 66703a7835 vaapidecode: set h264 base-only to decoder
Set the base-only value when property is set and the internal
decoder is already instantiated or when the internal decoder
is created.

https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:14 +02:00
orestisf bd040adb9c vaapidecode_props: h264: add base-only property
https://bugzilla.gnome.org/show_bug.cgi?id=732265
2017-08-03 17:07:01 +02:00
Víctor Manuel Jáquez Leal 7d6a80e13d vaapiencode: h265: compare an unsigned int if not zero
An unsigned value can never be negative, so this test (greater than
zero) will always evaluate the same way. Thus change it to just if
it's not zero.
2017-08-01 18:38:40 +02:00
Víctor Manuel Jáquez Leal 5f64d6df6c plugins: check gst_gl_ensure_element_data() return value
Refactor gst_vaapi_plugin_base_create_gl_context() in order to check
the return value of gst_gl_ensure_element_data(). The result is a code
bit cleaner.
2017-08-01 18:10:50 +02:00
Víctor Manuel Jáquez Leal 02e48ad8dc plugins: avoid dead code detection
By using #elif macro, the static code analysis would stop to detect
these lines as dead code. Also it is inforced the mutually exclusive
environments.
2017-08-01 17:59:38 +02:00
Víctor Manuel Jáquez Leal de0f8936f8 vaapivideobufferpool: don't shift by negative since it's undefined
The function g_bit_nth_lsf() may return -1 if the request bit position
is not avaible. Thus, this patch check if the return value is not -1
in order to continue.
2017-08-01 17:39:04 +02:00
Víctor Manuel Jáquez Leal 19444ce184 vaapisink: fix memory leak 2017-08-01 17:29:40 +02:00
Víctor Manuel Jáquez Leal ce03fa8ed0 vaapipostproc: fix memory leaks 2017-08-01 17:23:48 +02:00
Hyunjun Ko 736478d2a7 vaapisink: fail if surface display is different
Replacing GstVaapiDisplay during rendering might be hiding problems
at some cases, even though it's safe currently since we use cache
of GstVaapidisplay.

Play safe by failing if this happens.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-26 14:21:54 +02:00
Hyunjun Ko b8265db260 videocontext: support "gst.vaapi.app.Display" context
Through "gst.vaapi.app.Display" context, users can set their own VADisplay
and native display of their backend.

Attributes:
- display : pointer of VADisplay
- x11-display : pointer of X11 display (Display *), if they're using.

This patch creates GstVaapidisplayX11 if information provided through
"gst.vaapi.app.Display"

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-18 18:51:41 +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
Víctor Manuel Jáquez Leal e9fd571214 vaapiencode: h264: add plugin documentation
Comment how the profile is set and other parameters.
2017-07-13 16:43:34 +02:00
Víctor Manuel Jáquez Leal 11f461fb10 vaapidecode_props: h264: set low-latency in decoder
Set the low-latency property if the H264 decoder is already
instantiated, thus you could change the behavior in run-time.

https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-10 19:30:46 +02:00
Víctor Manuel Jáquez Leal 551ae940a7 vaapidecode: set h264 low latency to decoder
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Víctor Manuel Jáquez Leal f39b7e97ce vaapidecode_props: h264: add low latency property
Adding support for private data.

https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Víctor Manuel Jáquez Leal 484033d039 vaapidecode_props: add skeleton for h264 decoder properties
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Víctor Manuel Jáquez Leal 207486aa1f vaapidecode: properties callback in decoders map
https://bugzilla.gnome.org/show_bug.cgi?id=783588
2017-07-07 19:32:11 +02:00
Hyunjun Ko d018f64cbd vaapiencode: h264: set profile to src caps
So far vaapi encoder does not set profile to src caps. This patch makes it
setting profile to src caps, which is determined by itself.

In addition, if encoder chose different profile, which is not negotiated with
downstream, we should set compatible profile to make negotiation working.

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2017-07-03 18:36:29 +02:00
Víctor Manuel Jáquez Leal 39b36f7d14 vaapiencode: h264: verify if requested profile is supported
Check if the requested profile in source caps, is supported by the
VA driver. If it is not, an info log message is send saying that
another (compatible?) profile will be used.

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2017-07-03 15:33:20 +02:00
Víctor Manuel Jáquez Leal 322fe98936 vaapiencode: h264: improve set_config() vmethod
First check if downstream requests ANY caps. If so, byte-stream is
used and the profile will be choose by the encoder. If dowstream
requests EMPTY caps, the negotiation will fail.

Lately, byte-stream and profile are looked in the allowed caps.

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2017-07-03 15:33:20 +02:00
Víctor Manuel Jáquez Leal b713af42a1 vaapiencode: h264: check for avc in set_config()
The check for avc stream format was done in the vaapi encoder's
vmethod get_caps(), but that is wrong since it has to be check
when encoder set_format().

https://bugzilla.gnome.org/show_bug.cgi?id=757941
2017-07-03 15:33:20 +02:00
Hyunjun Ko e7bba345de vaapipostproc: set multivew-mode flags to src caps
vaapipostproc didn't negotiate the proper multiview caps losing
downstream information.

This patch enables the playing of MVC encoded stream by setting
the proper multiview mode/flags and views to src caps, according
to sink caps.

https://bugzilla.gnome.org/show_bug.cgi?id=784320
2017-07-03 13:37:21 +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 332cfe5626 vaapidecode: add support for DMABuf caps feature
https://bugzilla.gnome.org/show_bug.cgi?id=755072

Original-patch-by: Julien Isorce <j.isorce@samsung.com>
2017-06-23 18:44:42 +02:00
Víctor Manuel Jáquez Leal b6863e64b5 vaapipluginbase: force dmabuf allocator if DMABuf caps feature
Instantiate all dmabuf allocator for src pad buffer pool if the
src caps ask for memory:DMABuf feature.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-06-23 18:44:42 +02:00
Julien Isorce 953afe9d17 vaapipluginutil: add support for DMABuf caps feature
https://bugzilla.gnome.org/show_bug.cgi?id=755072

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Signed-off-by: Victor Jaquez <vjaquez@igalia.com>

vaapipluginutil: add support for DMABuf caps feature
2017-06-23 18:44:42 +02:00
Víctor Manuel Jáquez Leal f578515988 vaapipluginbase: dmabuf memory map trial for raw caps
Only push dmabuf-based buffers with raw caps if gst_memory_map()
succeeds. Otherwise, use the the vaapi surfaces allocator.

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

Original-patch-by: Julien Isorce <j.isorce@samsung.com>
2017-06-23 18:44:42 +02:00
Víctor Manuel Jáquez Leal 5312923d1c vaapivideomemory: add gst_vaapi_dmabuf_can_map()
This new method checks the specified allocator can create GstMemory that can
be mapped.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-06-23 18:44:42 +02:00
Víctor Manuel Jáquez Leal 7d7f722a18 vaapivideobufferpool: fix regression with video metas
There is another regression with 7a206923 when setting the video
info for the video meta, it should be the one from the image's
allocator rather from the allocation caps.

Test pipeline:

  gst-launch-1.0 filesrc location=bug766184.flv ! decodebin \
      ! tee ! videoconvert ! videoscale                     \
      ! video/x-raw, width=1920, height=1080 ! xvimagesink
2017-06-23 17:51:04 +02:00
Víctor Manuel Jáquez Leal 05a41009f2 plugins: update buffer size with the one reported by allocator
There is a regression in 7a206923, since the buffer pool ditches all
the buffers generated by them because the pool config size is
different of the buffer's size.

Test pipeline:

  gst-launch-1.0 filesrc location=big_buck_bunny_1080p_h264.mov \
      ! qtdemux ! vaapih264dec ! vaapipostproc ! xvimagesink    \
      --gst-debug=GST_PERFORMANCE:5

The allocator may update the buffer size according to the VA surface
properties. In order to do this, the video info is modified when the
allocator is created, which reports through the allocation info the
updated size, and set it to the pool config.
2017-06-23 17:49:38 +02:00
Víctor Manuel Jáquez Leal bd0209228b vaapivideobufferpool: remove allocation_vinfo private attribute
There is no need to keep this attribute internally since it is
already managed by the allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-12 18:41:14 +02:00
Víctor Manuel Jáquez Leal 60158c3d6b vaapivideobufferpool: refactor set_config()
Refactor the set_config() virtual method considering a cleaner
approach to allocator instanciation, if it it not set or if it is
not valid for the pool.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-12 18:41:14 +02:00
Víctor Manuel Jáquez Leal 7a20692364 plugins: distinguish allocation and negotiation caps
The vaapi video decoders might have different allocation caps from
the negotiation caps, thus the GstVideoMeta shall use the negotiation
caps, not the allocation caps.

This was done before reusing gst_allocator_get_vaapi_video_info(),
storing there the negotiation caps if they differ from the allocation
ones, but this strategy felt short when the allocator had to be reset
in the vaapi buffer pool, since we need both.

This patch adds gst_allocator_set_vaapi_negotiated_video_info() and
gst_allocator_get_vaapi_negotiated_video_info() to store the
negotiated video info in the allocator, and distinguish it from
the allocation video info.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-12 18:41:14 +02:00
Víctor Manuel Jáquez Leal 36cf510ce8 vaapivideomemory: rename qdata quarks and ids
Also the parameter names were renamed to reflect their origin
and purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-09 17:10:35 +02:00
Víctor Manuel Jáquez Leal 45faeb25e8 vaapivideobufferpool: rename local variables
Renamed local video info structure names in set_config() vitual
method. The purpose of their renaming is to clarify the origin
of those structures, whether come from passed caps parameter
(new_allocation_vinfo) or from the configured allocator
(allocator_vinfo).

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-09 17:10:34 +02:00
Víctor Manuel Jáquez Leal dce7a6f46b vaapivideobufferpool: rename video info structures
Renamed private GstVideoInfo structure video_info to allocation_vinfo
and alloc_info to negotiated_vinfo.

The purpose of these renaming is to clarify the origin and purpose of
these private variables:

video_info (now allocation_vinfo) comes from the bufferpool
configuration. It describes the physical video resolution to be
allocated by the allocator, which may be different from the
negotiated one.

alloc_info (now vmeta_vinfo) comes from the negotiated caps in
the pipeline. It represents how the frame is going to be mapped
using the video meta.

In Intel's VA-API backend, the allocation_vinfo resolution is
bigger than the negotiated_info.

https://bugzilla.gnome.org/show_bug.cgi?id=783599
2017-06-09 17:10:34 +02:00
Hyunjun Ko 5ab5113f6f vaapisink: keep handle_events flag except that if user want to set
When state of vaapisink is changed from PLAYING to NULL, the handle_events
flag is set to FALSE, and never recovered, and then event thread is never
going to run.

So we should allow to set the flag only when users try it.

https://bugzilla.gnome.org/show_bug.cgi?id=782543
2017-05-12 16:23:49 +02:00
Víctor Manuel Jáquez Leal b3c374e22f plugins: remove par from caps negotiation
https://bugzilla.gnome.org/show_bug.cgi?id=781759
2017-05-12 13:47:57 +02:00
Hyunjun Ko 8f1b88dac0 vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest
Handles new custom event GstVaapiEncoderRegionOfInterest
to enable/disable a ROI region.

Writes a way to use new event to document.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2017-05-12 11:12:56 +02:00
Víctor Manuel Jáquez Leal c45d448a15 Revert "vaapidecodebin: fix element's classification"
This reverts commit 8cbe03599a.
2017-05-04 11:49:33 +02:00
Victor Toso 8cbe03599a vaapidecodebin: fix element's classification
This bin should have similar classification as decodebin which is
"Generic/Bin/Decoder" otherwise it will appear wrongly as video
decoder.

Signed-off-by: Victor Toso <victortoso@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=782063
2017-05-02 16:14:49 +02:00
Víctor Manuel Jáquez Leal c7d4664609 Revert "plugins: reject pixel-aspect-ratio with value 0/1"
This reverts commit c0be7b1890.
2017-04-27 13:08:56 +02:00