Commit graph

939 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
50242eaaf7 plugins: decoder can negotiate dmabuf downstream 2017-02-03 17:11:20 +01:00
Julien Isorce
9ed73e76af vaapivideobufferpool: override acquire_buffer()
Overriding the vmethod acquire_buffer() it is possible to attach the
right GstMemory to the current acquired buffer.

As a matter of fact, this acquired buffer may contain any instantiated
GstFdmemory, since this buffer have been popped out from the buffer
pool, which is a FIFO queue. So there is no garantee that this buffer
matches with the current processed surface. Evenmore, the VA driver
might not use a FIFO queue. Therefore, it is no way to guess on the
ordering.

In short, acquire_buffer on the VA driver and on the buffer pool return
none matching data, we have to manually attach the right GstFdMemory to
the acquired GstBuffer. The right GstMemory is the one associated with
the current surface.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-03 16:18:08 +01:00
Julien Isorce
6a0375d96e vaapivideomemory: export surface if it is provided
gst_vaapi_dmabuf_memory_new() always exports a surface. Previously, it
had to create that surface. Now it can also export an already provided
surface. It is useful to export decoder's surfaces (from VA context).

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Julien Isorce
9132510ce0 vaapivideobufferpool: add GstVaapiVideoBufferPoolAcquireParams
Useful to let the pool know the current surface proxy when calling
gst_buffer_pool_alloc_buffer() / gst_buffer_pool_acquire_buffer()

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Julien Isorce
bc97987ffb vaapipostproc: don't GLTextureUpload if dmabuf
Do not add the meta:GstVideoGLTextureUploadMeta feature if the render
element can handle dmabuf-based buffers, avoiding its negotiation.

Similar as "vaapidecode: do not add meta:GstVideoGLTextureUploadMeta
feature if can dmabuf"

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
Víctor Manuel Jáquez Leal
aa20508bcf plugins: enable DMAbuf allocator to downstream
If the negotiated caps are raw caps and downstream supports the
EGL_EXT_image_dma_buf_import extension, then the created allocator
is the DMAbuf, configured to downstream.

At this moment, the only element which can push dmabuf-based buffers
to downstream, is vaapipostproc.
2017-02-02 20:33:36 +01:00
Víctor Manuel Jáquez Leal
37b7743934 plugins: check if negotiate dmabuf with downstream
In order to enable, in the future, dmabuf-based buffers, the vaapi base
plugin needs to check if downstream can import dmabuf buffers.

This patch checks if downstream can handle dmabuf, by introspecting the
shared GL context. If the GL context is EGL/GLES2 and have the extension
EGL_EXT_image_dma_buf_import, then dmabuf can be negotiated.

Original-patch-by: Julien Isorce <j.isorce@samsung.com>
2017-02-02 20:33:36 +01:00
Julien Isorce
33af1fc578 vaapivideomemory: release proxy's data if downstream
The surface created for downstream is going to be filled by VAAPI
elements. So, the driver needs write access on that surface.

This patch releases the derived image held by the proxy, thus the
surface is unmarked as busy.

This is how it has to be done as discussed on libva mailing list.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-02 20:33:36 +01:00
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
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
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
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
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
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
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
Víctor Manuel Jáquez Leal
4609f7fd5e vaapidecodebin: bring back dynamic configuration
In commit ca0c3fd6 we remove the dynamic configuration if the bin
because we assumed that the bin will be always static as it is
registered.

Nonetheless we were wrong, because it is possible to request, with a
property, to avoid the use of the post-processor.

Since we want to add a way to disable the post-processor through
environment variables, this remove feature is required again.

If the environment variable GST_VAAPI_DISABLE_VPP is defined the
postprocessor inside of the vaapidecodebin is disabled, then
vaapidecodebin is an alias of the old vaapidecode.

https://bugzilla.gnome.org/show_bug.cgi?id=775041
2016-12-01 12:49:56 +01:00
Víctor Manuel Jáquez Leal
3285121181 vaapidecode: implement negotiate() vmethod
Instead of decorating the negotiate() method, let us override it,
so the stream is locked while called.

https://bugzilla.gnome.org/show_bug.cgi?id=775040
2016-12-01 11:45:19 +01:00
Víctor Manuel Jáquez Leal
184e6890ca vaapivideocontext: log a message if no bus
Raise a warning if there is no bus when the element tries to post a
message.
2016-11-24 19:08:54 +01:00
Víctor Manuel Jáquez Leal
a567955c6d vaapisink: create display at open()
Instead of creating the VA display before setting the bus to the
element, it is created when the element is opened.

Basically, this commit is a revert of
5e5d62cac7

That was done when the GStreamer's context sharing was not mature
enough as now. There is no reason to keep this hack.
2016-11-24 19:07:53 +01:00
Víctor Manuel Jáquez Leal
8555eaf079 vaapidecode: don't add video crop meta
Since the differentiation of negotiation caps and allocation caps,
there is no need to add a video crop meta with the negotiation caps.
Hence, removing it.

https://bugzilla.gnome.org/show_bug.cgi?id=773948
2016-11-24 18:32:34 +01:00
Víctor Manuel Jáquez Leal
267422dde5 remove the video converter from vaapi buffer meta
Since all the video converter were deprecated in gstreamer-1.2, we don't need
to handle them anymore in the vaapi's buffer meta.

This patch removes its usage and the buffer meta's API for that.

https://bugzilla.gnome.org/show_bug.cgi?id=745728
2016-11-24 18:32:34 +01:00
Víctor Manuel Jáquez Leal
3fccc83278 plugins: destroy source pad allocator and pool
First, deactivate source pad pool when the out caps change, and if so,
destroy texture map, the source pad allocator and pool only if the
new caps are different from the ones already set.
2016-11-24 13:24:08 +01:00
Víctor Manuel Jáquez Leal
8953126374 plugins: don't destroy sink pad allocator
Don't destroy sink pad allocator at _set_caps() because it will be done at
ensure_sinkpad_buffer_pool() if it is required.
2016-11-24 13:24:08 +01:00
Víctor Manuel Jáquez Leal
ec364858b1 plugins: first validate the out caps
When calling _set_caps() first validate the out caps before doing
anything else.
2016-11-24 13:20:40 +01:00
Víctor Manuel Jáquez Leal
f09d9ff2ab vaapidecode: negotiate after destroying allocator
This is related with bug 758907 when no vaapipostproc is used (no
vaapidecodebin). In order to negotiate downstream we need to destroy
the source pad allocator, otherwise the same allocated buffers are
used, failing the mapping.
2016-11-21 19:00:04 +01:00
Víctor Manuel Jáquez Leal
22463b96f3 vaapivideomemory: remove GST_VAAPI_TYPE_VIDEO_INFO
Remove redundant GST_VAAPI_TYPE_VIDEO_INFO, since it is a duplicate of
GST_TYPE_VIDEO_INFO created before gstreamer 1.6, where the boxed type
was created.

https://bugzilla.gnome.org/show_bug.cgi?id=774782
2016-11-21 17:22:31 +01:00
Víctor Manuel Jáquez Leal
d799bb3041 plugins: update the src pad allocator video info
Update the size, stride and offset of the source pad allocator video
info, so the pool could set the correct GstVideoMeta

https://bugzilla.gnome.org/show_bug.cgi?id=774782
2016-11-21 16:37:36 +01:00
Víctor Manuel Jáquez Leal
432731e636 vaapivideomemory: add missing documentation
https://bugzilla.gnome.org/show_bug.cgi?id=774782
2016-11-21 16:37:36 +01:00
Víctor Manuel Jáquez Leal
ac18e0479f plugins: use early return without goto
https://bugzilla.gnome.org/show_bug.cgi?id=774782
2016-11-21 16:37:36 +01:00
Víctor Manuel Jáquez Leal
acefc7e384 plugins: add allocator to allocation query
This patch adds the created allocator to the allocation query either
in decide_allocation() and propose_allocation() vmehtods.

With it, there's no need to set the modified allocator's size in the
pool configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=774782
2016-11-21 16:37:36 +01:00
Julien Isorce
aca43dab47 vaapivideobufferpool: set correct buffer size
We should set the correct buffer size when we are configuring the pool,
otherwise the buffer will be discarded when it returns to the pool.

Indeed when the ref-count of a buffer reaches zero, its pool will queue
it back (and ref it) if, and only if, the buffer size matches the
configured buffer size on the pool.

This issue can be debugged with GST_DEBUG=*PERF*:6, see gstbufferpool.c

https://bugzilla.gnome.org/show_bug.cgi?id=774782
2016-11-21 16:37:31 +01:00
Víctor Manuel Jáquez Leal
e265788271 vaapivideomemory: check for memory allocator
When calling gst_vaapi_video_memory_copy() the allocator of the memory
to copy should be allocated by the vaapi allocator.

This patch does this verification.
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
f6566a2c98 vaapivideomemory: code style fixes
A cosmetic commit for enhance readability of the casts and method
preconditions.
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
85b3af62b4 vaapivideomemory: unroll gst_vaapi_video_allocator_free()
Instead of having a gst_vaapi_video_memory_free() that is only going to
be called by gst_vaapi_video_allocator_free(), let's just remove the first
and merged into the second.
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
582d4d47f9 vaapivideomemory: avoid virtual methods casting
Use the expected virtual method signatures for readability.
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
82cb89e1ed vaapivideomemory: remove unimplemented methods
Remove unimplemented method for allocator mem_share() and mem_is_span().
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
a02c86b395 vaapivideomemory: fail if frame map can't get plane
If map() vmethod in GstVideMeta cannot get the plane data, return false,
thus the caller will not try to read invalid memory.

https://bugzilla.gnome.org/show_bug.cgi?id=774213
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
3fa9af225f vaapivideomemory: lock map and unmap operations
In order to avoid race condition when two threads call map/unmap the same
VA surface, this patch mutex these operations.

https://bugzilla.gnome.org/show_bug.cgi?id=774213
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
4ae9428072 vaapivideomemory: refactor vaapi memory unmapping
There were duplicated code in gst_video_meta_unmap_vaapi_memory() and
gst_vaapi_video_memory_unmap() when unmapping.

This patch refactors both methods adding the common function
unmap_vaapi_memory(). This also ensures, if direct rendering is enabled, it
is correctly reset.

Additionally, only when mapping flag has the WRITE bit, it set the image as
current, which was done in gst_video_meta_map_vaapi_memory() but no in
gst_vaapi_video_memory_map().

In order to make this, the mapping flags were required, so instead of
overloading mem_unmap() virtual function, mem_unmap_full() is overloaded.

https://bugzilla.gnome.org/show_bug.cgi?id=774213
2016-11-11 11:59:18 +01:00
Víctor Manuel Jáquez Leal
eda03230d9 vaapivideomemory: refactor vaapi memory mapping
There were duplicated code in gst_video_meta_map_vaapi_memory() and
gst_vaapi_video_memory_map() when doing the READ and WRITE mapping.

This patch refactors both methods adding the common function
map_vaapi_memory().

Additionally, only when flag has the READ bit it calls
ensure_images_is_current(), which was done in
gst_video_meta_map_vaapi_memory() but no in
gst_vaapi_video_memory_map().

https://bugzilla.gnome.org/show_bug.cgi?id=772151
2016-11-11 11:34:31 +01:00
Víctor Manuel Jáquez Leal
02cd120bc8 vaapidecode: unref allowed_sinkpad_caps at close()
The variable member allowed_sinkpad_caps is constructed querying the
current VA display. Bearing that in mind, the variable shall be freed
when the VA display changes or is removed.

This patch moves the freeing of allowed_sinkpad_caps to close(), when
the VA display is freed.
2016-11-11 10:48:43 +01:00
Hyunjun Ko
d2e801e87a vaapisink: finish event thread at stop()
The thread that handles window's events should be finished during
pipeline's shutdown, otherwise it will remain alive during pipeline
re-activation, leading to unexpected problems.

This patch fixes failures of intensive_state_change scenario of
gst-validate

https://bugzilla.gnome.org/show_bug.cgi?id=774241
2016-11-11 10:44:27 +01:00
Víctor Manuel Jáquez Leal
0d3e1d9072 vaapipostproc: enhance debug message
"gst_pad_push" is not a good description of the event.
2016-11-08 09:35:00 +01:00
Hyunjun Ko
cbce9b8e49 postproc: honor gst_pad_push() return value
Returning GST_FLOW_ERROR always when gst_pad_push fails might lead to
deadlock during seek.

This patch returns the same error of gst_pad_push() and log out the
return value.

https://bugzilla.gnome.org/show_bug.cgi?id=774030
2016-11-08 08:27:41 +01:00
Víctor Manuel Jáquez Leal
d7231f66cc vaapidecode: guard GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS
In commit 6d11a00 were introduced a regression when gstreamer-vaapi is
compiled with out EGL/GLX support: it shall not support
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS.

This patch guards the inclusion of GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS in the
allowed src caps for vaapedecode if EGL/GLX.
2016-11-04 16:26:18 +01:00
Víctor Manuel Jáquez Leal
ae8e5d44f7 vaapivideomemory: increment map counter only if succeeded
Previously the frame map counter increased independently if the map succeeded
or not. This leaded to critical messages and crashes if the frame was unable
to be mapped, but the counter increased.

This patch increases the map counter only if the map operation occurred.

https://bugzilla.gnome.org/show_bug.cgi?id=773939
2016-11-04 13:44:29 +01:00
Víctor Manuel Jáquez Leal
1f190e49c4 plugins: set negotiation caps in src allocator
When the allocator is created, it stores the allocation caps. But sometimes
the "allocation caps" may be different from the "negotiation caps".

In this case, the allocator should store the negotiation caps since they
are the ones used for frame mapping with GstVideoMeta.

When vaapispostproc is used, this is not a problem since the element is assume
to resize. But when using a vaapi decoder only, with a software renderer, it
fails in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=773323
2016-11-04 13:44:29 +01:00
Víctor Manuel Jáquez Leal
6d11a0098e vaapidecode: generate source pad caps
Just as vaapipostproc, VA decoder's context can be queried to get the possible
raw formats, so, the src caps can negotiate the exact caps that the context
supports.
2016-11-03 13:04:09 +01:00
Víctor Manuel Jáquez Leal
e9ba11a733 plugins: remove set_sinkpad_dmabuf_allocator()
Since when the sink pad allocator is created, it is decided if the required
one is vaapi allocator or dmabuf allocator, there is no need to force its set
again.
2016-11-03 13:01:50 +01:00
Víctor Manuel Jáquez Leal
9d5875df67 plugins: ensure display when getting raw caps
When running gst-discoverer-1.0, in certain media, vaapipostroc is stopped
meanwhile it is transforming caps. The problem is that stop() calls
gst_vaapi_plugin_base_close(), which nullifies the element's va display, but
the va display is used in tranform_caps() when it is extracting the possible
format conversions. This display disappearing generates warning messages.

This patch holds a local reference of va display at ensure_allowed_raw_caps()
hence it doesn't go away meanwhile it is used, even if the
gst_vaapi_plugin_base_close() is called in other thread.

https://bugzilla.gnome.org/show_bug.cgi?id=773593
2016-11-03 12:59:22 +01:00
Víctor Manuel Jáquez Leal
1e7d89e7fe plugins: fix code style for errors 2016-11-03 12:54:23 +01:00
Víctor Manuel Jáquez Leal
3578716a4f plugins: update GstGL deprecated symbol
GST_GL_TYPE_CONTEXT was deprecated. Now it is GST_TYPE_GL_CONTEXT.
2016-11-03 09:31:17 +01:00
Víctor Manuel Jáquez Leal
202110bded plugins: direct render when raw video
Enable the direct rendering with linear surfaces if the negotiated src caps
are video/x-raw without features.

Pass also the caps, since they are needed to know the requested caps features.
2016-11-03 08:38:35 +01:00
Víctor Manuel Jáquez Leal
faebca3383 plugins: move src allocator error to instantiator
Just as we did in ensure_sinkpad_allocator(), let's move the error message
into the ensure_srcpad_allocator() from the caller,
gst_vaapi_plugin_base_decide_allocation()
2016-11-03 08:37:51 +01:00
Víctor Manuel Jáquez Leal
02f16e82e9 plugins: enable direct upload if raw video
Enable the direct upload with linear surfaces if the negotiated sink caps are
video/x-raw without features.
2016-11-03 08:35:29 +01:00
Víctor Manuel Jáquez Leal
1605a2646a pluginutil: add gst_caps_is_video_raw() 2016-11-03 08:35:29 +01:00
Víctor Manuel Jáquez Leal
e0d73d613e plugins: receive caps in ensure_sinkpad_allocator()
Instead of receiving the GstVideoInfo structure as parameter, get the original
GstCaps from ensure_sinkpad_buffer_pool(), in this way we could decide better
which allocator instantiate.
2016-11-03 08:35:29 +01:00
Víctor Manuel Jáquez Leal
2761e472af vaapivideomemory: destroy derived image at unmap
If the allocator was configured to use direct upload or rendering, the
generated derived image created at mapping needs to be destroyed after
unmapping, because, in order to process the surface, it should not be marked
as "busy" by the driver.
2016-11-03 08:35:29 +01:00
Víctor Manuel Jáquez Leal
ce8b14858f vaapivideomemory: enhance logs for direct modes
Print, conditionally, only the enabled direct mode.
2016-11-03 08:35:29 +01:00
Víctor Manuel Jáquez Leal
7c692265d8 vaapivideomemory: add direct upload flag
Adds the direct-upload flag in the GstVaapiVideoAllocator and
GstVaapiVideoMemory.

It still doesn't apply any functional change.
2016-11-03 08:35:28 +01:00
Víctor Manuel Jáquez Leal
e988298782 vaapivideomemory: set direct rendering at run-time
The way to experiment with the direct rendering is through and internal
compiler pre-processor flag.

The current change set enables a way to specified at run-time, as a flag
passed to the allocator at instanciation time.
2016-11-03 08:35:28 +01:00
Víctor Manuel Jáquez Leal
1bc5f00dfe vaapivideomemory: log in perf category when copy
Log in performance category when the derive image handling fails, falling back
to memory copy.
2016-11-03 08:35:28 +01:00
Víctor Manuel Jáquez Leal
7e90ae4c2e vaapivideomemory: error log is derive image fails
Instead of a silently failure of the derive image, this patch log an error
message according to the failure.
2016-11-03 08:35:28 +01:00
Víctor Manuel Jáquez Leal
dcbd411275 vaapivideomemory: store surface alloc flags in qdata
For sake of consistency, we should add the requested surface allocation flags
to the object's qdata structure.
2016-11-03 08:35:28 +01:00
Víctor Manuel Jáquez Leal
4016388565 vaapivideomemory: category init when object define
Move the Gstreamer debug category initialize to the GObject definition.
2016-11-03 08:35:28 +01:00
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