Commit graph

2866 commits

Author SHA1 Message Date
Julien Isorce
fbed3c3366 vaapivideomemory: add direction to dmabuf allocator
Add GstPadDirection param to gst_vaapi_dmabuf_allocator_new(), thus
we later could do different thing when the allocated memory is for
upstream or dowstream, as required by VA-API.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Hyunjun Ko
a5650e8dc3 libs: utils: return NULL if failed to get surface formats
Thus, when generating the allowed caps, the element will throw a
warning and it will use its caps template.

This behavior might be a bug in the VA driver.

https://bugzilla.gnome.org/show_bug.cgi?id=775490
2017-02-01 20:01:11 +01:00
Víctor Manuel Jáquez Leal
65c16145a5 Revert "vaapidisplay: mark X11 display as compatible with EGL"
This reverts commit 200b1baabc.
2017-02-01 16:20:08 +01:00
Hyunjun Ko
a01c0bc352 vaapipostproc: set GST_VAAPI_POSTPROC_FLAG_SIZE according to src caps
A value of width/height property should be set to out caps,
if negotiation had been going properly.
So we can use srcpad_info when making decision of scaling.

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

https://bugzilla.gnome.org/show_bug.cgi?id=777409
2017-01-27 13:35:40 +01:00
Víctor Manuel Jáquez Leal
0968ce468d plugins: create a GL context on certain conditions
If a GstVaapiDisplay is not found in the GStreamer context sharing,
then VAAPI elements look for a local GstGLContext in gst context
sharing mechanism ('gst.gl.local.context').

If this GstGLContext not found either then, only the VAAPI decoders
and the VAAPI post-processor, will try to instantiate a new
GstGLContext.

If a valid GstGLContext is received, then a new GstVaapiDisplay will
be instantiated with the platform, API and windowing specified by the
instantiated GstGLContext.

Original-Patch-By: Matt Fischer <matt.fischer@garmin.com>

https://bugzilla.gnome.org/show_bug.cgi?id=777409
2017-01-27 11:27:35 +01:00
Víctor Manuel Jáquez Leal
43d4f0bfb5 vaapivideocontext: context type can be rejected
Instead of calling g_return_val_if_fail() to check the context type, we
should use a normal conditional, since it is possible that other context types
can arrive and try to be assigned. Otherwise a critical log message is
printed.

This happens when we use playbin3 with vaapipostproc as video-filter.

https://bugzilla.gnome.org/show_bug.cgi?id=777409
2017-01-26 12:34:16 +01:00
Víctor Manuel Jáquez Leal
26fa4df958 vaapipostproc: use sink caps par if not requested
Use the sink caps pixel-aspect-ratio to fixate the src caps, if it
is not already set.

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

https://bugzilla.gnome.org/show_bug.cgi?id=777395
2017-01-20 19:22:39 +01:00
Víctor Manuel Jáquez Leal
42df9ba98c vaapisink: fix gcc compiler warning
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
2017-01-20 16:12:31 +01:00
Víctor Manuel Jáquez Leal
f5360282bc vaapisink: don't use member variable outside lock
Thus a race condition segfault is avoided.

Original-patch-by: Matt Staples <staples255@gmail.com>

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

To avoid this log flooding first the pool state is checked before
changing it.
2017-01-18 17:25:44 +01:00
Víctor Manuel Jáquez Leal
8654829628 vaapidecode: update internal decoder sink caps
When a new sink caps arrive the internal decoder state is updated
and, if it is, request a downstream renegotiation.

Previously, when new caps arrived the whole decoder where destroyed
and recreated. Now, if the caps are compatible or has the same codec,
the internal decoder is kept, but a downstream renegotiation is
requested.

https://bugzilla.gnome.org/show_bug.cgi?id=776979
2017-01-18 11:30:49 +01:00
Sebastian Dröge
4807a85e82 Back to development 2017-01-12 16:33:13 +02:00
Sebastian Dröge
0fbcc05970 Release 1.11.1 2017-01-12 16:27:12 +02:00
Víctor Manuel Jáquez Leal
da7500de3f vaapi: bump ifdef to API 0.40.0 for log redirect
vaSetInfoCallback() is not released yet. It is going to appear in
VA-API 0.40.0
2017-01-12 12:54:34 +01:00
Sebastian Dröge
08dea01bf4 vaapiutils: Fix compilation with latest and previous libva releases
vaSetInfoCallback() was defined after 0.39.4 / 1.7.3, so check for
0.39.5 instead.
2017-01-12 13:45:29 +02:00
Víctor Manuel Jáquez Leal
1e0b3c2f74 libs: display: redirect logging at initialize
Redirect libva's logs to GStreamer logging mechanism. This is
particularly useful when VA is initialized, because it always logs
out the drivers details.

In order to achieve this a new helper function was added as a wrapper
for the vaInitialize() function.

https://bugzilla.gnome.org/show_bug.cgi?id=777115
2017-01-11 16:11:30 +01:00
Hyunjun Ko
bca2b1680b plugins: provide at least two buffers in sink pool
Adds two buffers as the default value of minimum buffer.

This would be used when creating and proposing vaapi bufferpool for
sink pad, hence the upstream element will keep, at least, these two
buffers.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2017-01-10 13:42:34 +01:00
Hyunjun Ko
58e7b575bb libs: decoder: h264: don't update cloned attributes
If the frame is a cloned picture, its PTS comes from its parent
picture.  In addition, the base decoder doesn't set a valid PTS to
the frame corresponding to the cloned picture.

https://bugzilla.gnome.org/show_bug.cgi?id=774254
2017-01-10 12:54:39 +01:00
Víctor Manuel Jáquez Leal
a1f7b5573d vaapivideomemory: check for display
This patch fixes the check of display, rather than check for the
meta, which it is known it exists.
2017-01-09 19:25:24 +01:00
Víctor Manuel Jáquez Leal
eb1d396536 vaapivideomemory: rename dmabuf allocator parameters
Rename the parameters 'vip' and 'flags' to 'alloc_info' and
'surface_alloc_flags' respectively. The purpose of this change is
to auto-document those parameters.

Also, aligned to this patch, the local 'alloc_info' variable was
renamed as 'surface_info', because it stores the possible surface's
video info, not the allocate one.
2017-01-09 18:07:41 +01:00
Víctor Manuel Jáquez Leal
2534dab8d8 vaapivideomemory: rename vip to alloc_info parameter
In order to auto-document the code, this patch renames the 'vip'
parameter in the functions related to gst_vaapi_video_allocator_new ()
to 'alloc_info', since it declares the allocation video info from
the vaapi buffer pool.
2017-01-09 16:26:22 +01:00
Víctor Manuel Jáquez Leal
d3d489a855 vaapivideomemory: use GST_VIDEO_INFO_FORMAT_STRING()
Use the existing local macro GST_VIDEO_INFO_FORMAT_STRING() to get
the video format string.
2017-01-09 16:16:36 +01:00
Víctor Manuel Jáquez Leal
7ced30dbac vaapivideomemory: unroll gst_vaapi_surface_new_with_format()
gst_vaapi_surface_new_with_format() is a wrapper for
gst_vaapi_surface_new_full (). In this case, the former is simpler
than the first. This patch changes that.
2017-01-09 12:51:11 +01:00
Hyunjun Ko
b23640fb27 vaapipostproc: notify if src pad caps changed
If src pad caps have changed, it needs to notify it downstream. In
addition, do not set passthrough if they have changed.

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

https://bugzilla.gnome.org/show_bug.cgi?id=775204
2017-01-06 12:15:50 +01:00
Víctor Manuel Jáquez Leal
a36b9b27e5 vaapidecodebin: capsfilter to optimize negotiation
Add a capsfilter forcing the caps
"video/x-raw(memory:VASurface), format=(string)NV12" between the
queue and the vaapipostproc so no renegotiation is required.

https://bugzilla.gnome.org/show_bug.cgi?id=776175
2016-12-21 12:03:57 +01:00
Hyunjun Ko
a66c2d44bf vaapivideomemory: fail surface/image configuration
To detect and handle errors during allocator_configure_surface_info()
and allocator_conigure_image_info().

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-21 11:22:31 +01:00
Hyunjun Ko
5e09f57dea vaapisink: ensures raw caps at start()
Calls gst_vaapi_plugin_base_get_allowed_raw_caps() at start() to avoid
race conditions at get_caps(), especially with multiple src elements.

https://bugzilla.gnome.org/show_bug.cgi?id=776303
2016-12-21 11:10:02 +01:00
Víctor Manuel Jáquez Leal
dde4db3b3e libs: surface: fix error handling code style 2016-12-14 17:25:44 +01:00
Víctor Manuel Jáquez Leal
0f819fa190 vaapivideomemory: add gst_video_info_update_from_surface()
With this function is possible to refactor and remove duplicated code
between dmabuf configuration and direct rendering/uploading
configuration.
2016-12-14 17:25:43 +01:00
Víctor Manuel Jáquez Leal
7b2f774036 vaapivideomemory: no log object at initialization
When an instance of GstVaapiVideoAllocator fails at initializing, the
log message should not include the allocator's object, because it is
going to be unrefed.
2016-12-14 17:25:43 +01:00
Víctor Manuel Jáquez Leal
daed911caf vaapidecode: lock stream when setting caps 2016-12-09 17:56:02 +01:00
Víctor Manuel Jáquez Leal
ba49dc9dd7 Revert "vaapidecode: implement negotiate() vmethod"
This reverts commit 3285121181.

videodecode's negotiate() vmethod is also called when events arrive,
but this would mean that the proper configuration of sink pad might
not be complete, thus we should not update the src pad.

Let's keep the old non-vmethod negotitate().
2016-12-09 17:42:42 +01: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
Hyunjun Ko
9bda7a6d5d vaapiencode: get surface formats in get_caps()
Query for the supported surface formats in config at get_caps() vmethod.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-07 16:47:18 +01:00
Hyunjun Ko
4e2049d108 libs: encoder: add gst_vaapi_encoder_get_surface_formats()
This method will return the valid surface formats in the current
config. If the are no VAConfig it is created with the information
available.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-07 16:47:18 +01:00
Hyunjun Ko
72e26ed30b libs: encoder: split set_context_info()
Split set_context_info() adding init_context_info() which only
initialises the GstVaapiContextInfo structure inside GstVaapiEncoder
required for VAConfig.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-07 16:47:18 +01:00
Hyunjun Ko
41d27b5e2e libs: context: skip VAContext if no frame size
If GstVaapiContextInfo has just initial information, without frame's
width and height, skip the creation of the VAContext, just keep the
VAConfig.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-07 16:47:01 +01:00
Hyunjun Ko
059cc59a29 libs: context: split context_create()
Split the funcion context_create() into context_create() and
config_create().

Decoupling VAConfig and VAContext during context creation, we could
query the VAConfig for the supported surface's formats without creating
a VAContext.

https://bugzilla.gnome.org/show_bug.cgi?id=769266
2016-12-07 10:21:46 +01:00
Víctor Manuel Jáquez Leal
7aeefb0990 libs: drm: find render node in hybrid system
Originally the drm backend only tried to open the first render node
found. But in hybrid system this first render node might not support
VA-API (propietary Nvidia driver, for example).

This patch tries all the available nodes until a finding one with a
VA-API supported driver.

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

Original-patch-by: Stirling Westrup <swestrup@gmail.com> and
                   Reza Razavi <reza@userful.com>
2016-12-06 17:33:42 +01:00
Víctor Manuel Jáquez Leal
ad8da84062 vaapivideomemory: refactor code for readability
Added the inlined function allocator_configure_pools() moving out code
from gst_vaapi_video_allocator_new() to make clear that it is a
post-initalization of the object.
2016-12-05 17:42:38 +01:00
Víctor Manuel Jáquez Leal
b9b8c26c40 vaapivideomemory: log error if not VA image
Log an error message if the test image for surface downloading
cannot be allocated or mapped.
2016-12-05 17:42:38 +01:00
Víctor Manuel Jáquez Leal
f88ce54b65 vaapivideomemory: remove unused macros
These macros are not used. Let us remove them.
2016-12-05 17:42:38 +01:00
Víctor Manuel Jáquez Leal
4dffc12d6b vaapivideomemory: rename video for allocation_info
Since video_info stores the GstVideoInfo of the allocation caps,
it is clear if we rename it as allocation_info, to distinguish it
later from negotiation_info.
2016-12-05 17:42:38 +01:00
Julien Isorce
952b20a893 vaapivideomemory: add real GstVaapiDmaBufAllocator
Instead of defining GstVaapiDmaBufAllocator as a hackish decorator of
GstDmaBufAllocator, now, since the expose of the GstDmaBufAllocator's
GType, GstVaapiDmaBufAllocator is a full feature GstAllocator inherited
from GstDmaBufAllocator.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-05 17:41:58 +01:00
Julien Isorce
bb4dc645f0 vaapivideomemory: errors in gst_vaapi_dmabuf_allocator_new()
Add a helper function to initialize the gst_debug_vaapivideomemory,
to use it either by the GstVaapiVideoAllocatorClass or
GstVaapiDmabufAllocator (which is a decorator of GstDmaBufAllocator).

Later, log possible errors when calling gst_vaapi_dmabuf_allocator_new ()

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2016-12-05 17:33:40 +01:00
Hyunjun Ko
55aa83c5bf vaapiencode: release internal encoder at stop()
As the internal encoder is created at start(), let's release it at
stop() vmethod, to be consistent.

gst_vaapiencode_destroy() is called since it also resets the input and
output states, which is something that the base class does internally
after calling stop() vmethod.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-12-05 17:23:56 +01:00
Edward Hervey
5df21e9d54 Automatic update of common submodule
From f49c55e to 39ac2f5
2016-12-03 08:20:56 +01:00
Hyunjun Ko
6e6fbd1cbf vaapiencode: call ensure_encoder() at start()
Currently, specific encoder is created during set_format(). This might
lead to race condition when creating profiles with multiple encoders.

This patch moves ensure_encoder() call to start() vmethod to ensure
avoiding the race condition.

https://bugzilla.gnome.org/show_bug.cgi?id=773546
2016-12-01 15:40:09 +01:00