Commit graph

998 commits

Author SHA1 Message Date
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
Víctor Manuel Jáquez Leal
c0be7b1890 plugins: reject pixel-aspect-ratio with value 0/1
Do not negotiate a pixel-aspect-ratio of 0/1.

https://bugzilla.gnome.org/show_bug.cgi?id=781759
2017-04-27 12:43:54 +02:00
Víctor Manuel Jáquez Leal
4820d2d09d plugins: handle pixel-aspect-ratio with value 0/1
When downstream negotiates a pixel-aspect-ratio of 0/1, the
calculations for resizing and formatting in vaapipostproc and
vaapisink, respectively, failed, and thus the pipeline.

This patch handles this situation by converting p-a-r of 0/1 to
1/1. This is how other sinks, such as glimagesink, work.

https://bugzilla.gnome.org/show_bug.cgi?id=781759
2017-04-27 11:17:12 +02:00
Hyunjun Ko
cce5ce4a9d vaapivideobufferpool: fix leak of created allocator
Since it's created by itself, it should be unref-counted
after gst_buffer_pool_config_set_allocator call. Afterwards,
this allocator will be ref-counted again when assigning to priv->allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=781577
2017-04-27 11:03:02 +02:00
Víctor Manuel Jáquez Leal
158b44fc1e vaapivideobufferpool: create or reconfig allocator
Sometimes a video decoder could set different buffer pool
configurations, because their frame size changes. In this case we
did not reconfigure the allocator.

This patch enables this use case, creating a new allocator inside
the VAAPI buffer pool if the caps changed, if it is not dmabuf-based.
If so, it is just reconfigured, since it doesn't have a surface pool.

https://bugzilla.gnome.org/show_bug.cgi?id=781577
2017-04-25 15:06:39 +02:00
Hyunjun Ko
26486c436a vaapidecodebin: skips configuration once it's done
Skips configuration of creation of vpp/capsfilter and link them once it's done.
Otherwise, it always fails when it's trying to re-start playback.

https://bugzilla.gnome.org/show_bug.cgi?id=781573
2017-04-21 11:48:16 +02:00
Víctor Manuel Jáquez Leal
5c3318227b vaapipostproc: fixes for memory leaks
The use of gst_vaapi_value_set_format() and gst_structure_*_value()
requires to clear the used GValue to avoid a memory leak.
2017-04-20 18:48:22 +02:00
Víctor Manuel Jáquez Leal
24af97a7d1 plugins: enable direct rendering with envvar
Direct rendering (use vaDeriveImage rather than vaPutImage) has better
performance in some Intel platforms (Haswell, for example) but in others
(Skylake) is the opposite.

In order to have some control, the patch enables the direct rendering
through the environment variable GST_VAAPI_ENABLE_DIRECT_RENDERING.

Also it seems to generating some problems with gallium/radeon backend.
See bug #779642.

https://bugzilla.gnome.org/show_bug.cgi?id=775848
2017-04-12 20:39:06 +02:00
Jan Schmidt
ebca86dcc7 vaapidecode: Don't renegotiate on every flush
If caps don't actually change, don't update the
decoder and don't set the do_renego flag forcing
downstream renegotiation

https://bugzilla.gnome.org/show_bug.cgi?id=781142
2017-04-12 10:43:49 +10:00
Jan Schmidt
a7a9b33ad9 Implement decoder reset on flush, rather than recreating
Clear decoders out on a flush but keep the same instance,
rather than completely recreating them. That avoids
unecessarily freeing and recreating surface pools
and contexts, which can be quite expensive

https://bugzilla.gnome.org/show_bug.cgi?id=781142
2017-04-12 10:43:49 +10:00
Scott D Phillips
0343649667 plugins: Fix usage of GST_GL_HAVE_WINDOW_* defines
When these definitions are false, they are undef in the
preprocessor, not a defined value of 0. When they are unset the
compile fails with:

 'GST_GL_HAVE_WINDOW_WAYLAND' undeclared (first use in this function)

https://bugzilla.gnome.org/show_bug.cgi?id=780948
2017-04-11 16:32:26 +02:00
Víctor Manuel Jáquez Leal
b2815a376b vaapiencode: h265: add main-10 in caps template
This patch adds h265's main-10 profile in encoder src caps template.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-07 12:04:57 +02:00
Víctor Manuel Jáquez Leal
5ccadd6e9c vaapiencode: add get_profile() vmethod
This new virtual method, get_profile(), if implemented by specific
encoders, will return the VA profile potentially determined by the
source caps.

Also it is implemented by h264 and h265 encoders, which are the main
users of this vmethod.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
7153b4597d libs: encoder: pass profile to get_surface_formats()
In order to get the supported surface formats within a specific
profile this patch adds the GstVaapiProfile as property to
gst_vaapi_encoder_get_surface_formats().

Currently the extracted formats are only those related with the
default profile of the element's codec.

https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
914a4712d9 vaapiencode: enhance logs of negotiated caps
https://bugzilla.gnome.org/show_bug.cgi?id=771291
2017-04-06 22:00:05 +02:00
Víctor Manuel Jáquez Leal
152217064f plugins: when debug disabled, default category is NULL
As in gstreamer-vaapi a common base class is used, the specific
default category is passed to the base-plugin initializator, thus
the log messages are categorized with the used plugin.

Nonetheless, when the gst-debug is disabled in compilation time,
it is needed to pass NULL to the base-plugin initializator. This
patch does that.

https://bugzilla.gnome.org/show_bug.cgi?id=780302
2017-03-20 19:15:39 +01:00
Hyunjun Ko
e65d916f0d docs: h264/h265: put parser to the example pipeline
https://bugzilla.gnome.org/show_bug.cgi?id=778749
2017-03-14 16:54:39 +01:00
Víctor Manuel Jáquez Leal
3723d2051a plugins: retry to create the VA display
Particularly in GNOME Wayland, the negotiated or created GL context
defines a GLX environment, but VAAPI fails to create a GLX VA
display because there is no a DRI2 connection.

This patch retries to create the VA display if VA cannot create one
with the GL context parameters. Now using the old list of display
types.

This should also work in the case of systems with two GPU, when the
non-VAAPI has the graphics environment, and the VAAPI-enabled one
shall work headless.

https://bugzilla.gnome.org/show_bug.cgi?id=772838
2017-03-03 22:40:12 +01:00
Julien Isorce
8d86b3f40a vaapipostproc: texture upload if driver supports GL
Removes GstVideoGLTextureUploadMeta caps feature if the driver
doesn't support opengl.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=772838
2017-03-03 20:01:33 +01:00
Víctor Manuel Jáquez Leal
bce6e1416b vaapidecode: texture upload if driver supports GL
When the allowed source pad caps are generated, the GLTextureUpload caps are
only inserted if the driver support OpenGL.

https://bugzilla.gnome.org/show_bug.cgi?id=772838
2017-03-03 20:01:09 +01:00
Víctor Manuel Jáquez Leal
5905970917 vaapiencode: merge tags for downstream's info
Add encoder and codec name and the bitrate into the output for
informational purposes. Some muxers or application use it as
media metadata.

https://bugzilla.gnome.org/show_bug.cgi?id=778781
2017-02-22 05:19:06 +01:00
Scott D Phillips
884e0bece2 build: rename USE_HEVC_DECODER to USE_H265_DECODER
Rename to be consistent with H.264 and also H.265 encoder. The
meson build assumed this was already consistently named, and so
previously was not able to actually build the H.265 decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=778576
2017-02-16 17:27:50 +01:00
Víctor Manuel Jáquez Leal
025d5ce33e plugins: fix build when gcc
In commit a8e482f9 we added a function without parameters, but gcc
doesn't like that.
2017-02-09 12:49:44 +01:00
Scott D Phillips
412dd13e86 vaapi: add meson build
https://bugzilla.gnome.org/show_bug.cgi?id=778250
2017-02-09 11:27:44 +01:00
Julien Isorce
a8e482f93f plugins: use linear storage if not the same device
When dmabuf is negotiated downstream and decoding and rendering are
not done on the same device, the layout has to be linear in order for
the memory to be shared accross devices, since each device has its
own way to do tiling.

Right now this code is rather just a to-do comment, since we are not
fetching the device ids.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-09 11:24:08 +01:00
Víctor Manuel Jáquez Leal
b0016e336b vaapidecode: don't GLTextureUpload if dmabuf
Do not add the meta:GstVideoGLTextureUploadMeta feature if the render
element can handle dmabuf-based buffers, avoiding its negotiation.
2017-02-03 17:11:56 +01:00
Julien Isorce
25e8309567 vaapidecode: make pool to export decoder's surface
Use new -base API gst_video_decoder_allocate_output_frame_full() to
pass the current proxy/surface to the pool.

The pool will will export thins given surface instead of exporting a
brand new surface that will never be filled in with meaningfull data.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
2017-02-03 17:11:20 +01:00
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