platform/upstream/gstreamer.git
7 years agobuild: rename USE_HEVC_DECODER to USE_H265_DECODER
Scott D Phillips [Tue, 14 Feb 2017 00:39:41 +0000 (16:39 -0800)]
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

7 years agomeson: gstreamer-codecparsers is a required dep
Tim-Philipp Müller [Wed, 15 Feb 2017 19:14:59 +0000 (19:14 +0000)]
meson: gstreamer-codecparsers is a required dep

Just like in configure.ac.

7 years agomeson: dist meson build files
Tim-Philipp Müller [Wed, 15 Feb 2017 00:26:21 +0000 (00:26 +0000)]
meson: dist meson build files

Ship meson build files in tarballs, so people who use tarballs
in their builds can start playing with meson already.

7 years agolibs: encoder: vp8: add CBR encoding mode
Hyunjun Ko [Fri, 10 Feb 2017 00:51:38 +0000 (09:51 +0900)]
libs: encoder: vp8: add CBR encoding mode

This patch enables the Constant BitRate encoding mode in VP8 encoder.
Basically it adds the configuration parameters required by libva to
CBR enconding.

Original-Patch-By: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=749950

7 years agolibs: encoder: vp8: fix bitrate calculation
Hyunjun Ko [Thu, 9 Feb 2017 03:39:19 +0000 (12:39 +0900)]
libs: encoder: vp8: fix bitrate calculation

Base encoder's unit of bitrate is in Kbps. We should honor it so
we use the value of bitrate in VA, in which is expressed in bps.

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

7 years agoplugins: fix build when gcc
Víctor Manuel Jáquez Leal [Thu, 9 Feb 2017 11:49:44 +0000 (12:49 +0100)]
plugins: fix build when gcc

In commit a8e482f9 we added a function without parameters, but gcc
doesn't like that.

7 years agovaapi: add meson build
Scott D Phillips [Mon, 6 Feb 2017 23:46:20 +0000 (15:46 -0800)]
vaapi: add meson build

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

7 years agomake: remove gstvaapiversion.h generation
Scott D Phillips [Wed, 8 Feb 2017 18:17:40 +0000 (10:17 -0800)]
make: remove gstvaapiversion.h generation

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

7 years agoplugins: use linear storage if not the same device
Julien Isorce [Wed, 19 Oct 2016 14:47:41 +0000 (15:47 +0100)]
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

7 years agolibs: utils: add HEVC profiles representation
Hyunjun Ko [Wed, 8 Feb 2017 05:17:05 +0000 (14:17 +0900)]
libs: utils: add HEVC profiles representation

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

7 years agolibs: decoder: h264: reduce frame number of gaps
Hyunjun Ko [Tue, 7 Feb 2017 07:17:39 +0000 (16:17 +0900)]
libs: decoder: h264: reduce frame number of gaps

Reduce frame num gaps so that we don't have to create unnecessary
dummy pictures, just throw them away.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=777506

7 years agovaapidecode: don't GLTextureUpload if dmabuf
Víctor Manuel Jáquez Leal [Sun, 16 Oct 2016 00:04:09 +0000 (01:04 +0100)]
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.

7 years agovaapidecode: make pool to export decoder's surface
Julien Isorce [Wed, 19 Oct 2016 15:21:21 +0000 (16:21 +0100)]
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

7 years agoplugins: decoder can negotiate dmabuf downstream
Víctor Manuel Jáquez Leal [Fri, 3 Feb 2017 16:06:29 +0000 (17:06 +0100)]
plugins: decoder can negotiate dmabuf downstream

7 years agovaapivideobufferpool: override acquire_buffer()
Julien Isorce [Wed, 19 Oct 2016 15:07:07 +0000 (16:07 +0100)]
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

7 years agovaapivideomemory: export surface if it is provided
Julien Isorce [Wed, 19 Oct 2016 15:05:04 +0000 (16:05 +0100)]
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

7 years agovaapivideobufferpool: add GstVaapiVideoBufferPoolAcquireParams
Julien Isorce [Wed, 19 Oct 2016 14:55:27 +0000 (15:55 +0100)]
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

7 years agolibs: surface: add gst_vaapi_surface_{set,peek}_buffer_proxy()
Julien Isorce [Wed, 19 Oct 2016 14:09:34 +0000 (15:09 +0100)]
libs: surface: add gst_vaapi_surface_{set,peek}_buffer_proxy()

These functions are useful when a dmabuf-based memory is instantiated in
order to relate the generated buffer @proxy with the processed @surface.

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

7 years agolibs: bufferproxy: gst_vaapi_buffer_proxy_{set,peek}_mem()
Julien Isorce [Wed, 19 Oct 2016 14:07:31 +0000 (15:07 +0100)]
libs: bufferproxy: gst_vaapi_buffer_proxy_{set,peek}_mem()

This patch adds a GstMemory as a variable member of the buffer proxy,
because we will need to associate the buffer proxy with the memory
which exposes it. Later, we will know which memory, in the video buffer
pool, is attached to the processed surface.

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

7 years agovaapipostproc: don't GLTextureUpload if dmabuf
Julien Isorce [Wed, 19 Oct 2016 14:33:41 +0000 (15:33 +0100)]
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

7 years agoplugins: enable DMAbuf allocator to downstream
Víctor Manuel Jáquez Leal [Fri, 16 Dec 2016 13:12:30 +0000 (14:12 +0100)]
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.

7 years agoplugins: check if negotiate dmabuf with downstream
Víctor Manuel Jáquez Leal [Thu, 2 Jun 2016 20:13:51 +0000 (22:13 +0200)]
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>
7 years agovaapivideomemory: release proxy's data if downstream
Julien Isorce [Wed, 19 Oct 2016 14:37:04 +0000 (15:37 +0100)]
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

7 years agolibs: bufferproxy: add gst_vaapi_buffer_proxy_release_data()
Julien Isorce [Wed, 19 Oct 2016 14:01:04 +0000 (15:01 +0100)]
libs: bufferproxy: add gst_vaapi_buffer_proxy_release_data()

Adds an API to request the user's data release in the buffer proxy.

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

7 years agovaapivideomemory: add direction to dmabuf allocator
Julien Isorce [Wed, 19 Oct 2016 14:27:03 +0000 (15:27 +0100)]
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

7 years agolibs: utils: return NULL if failed to get surface formats
Hyunjun Ko [Thu, 15 Dec 2016 06:59:30 +0000 (15:59 +0900)]
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

7 years agoRevert "vaapidisplay: mark X11 display as compatible with EGL"
Víctor Manuel Jáquez Leal [Thu, 26 Nov 2015 17:21:08 +0000 (18:21 +0100)]
Revert "vaapidisplay: mark X11 display as compatible with EGL"

This reverts commit 200b1baabc066f8a4102f82f539655d588200ec9.

7 years agovaapipostproc: set GST_VAAPI_POSTPROC_FLAG_SIZE according to src caps
Hyunjun Ko [Wed, 1 Feb 2017 05:32:45 +0000 (14:32 +0900)]
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

7 years agoplugins: handle GL params through context query
Víctor Manuel Jáquez Leal [Fri, 27 Jan 2017 11:10:54 +0000 (12:10 +0100)]
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

7 years agoplugins: create a GL context on certain conditions
Víctor Manuel Jáquez Leal [Thu, 26 Jan 2017 11:02:56 +0000 (12:02 +0100)]
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

7 years agovaapivideocontext: context type can be rejected
Víctor Manuel Jáquez Leal [Tue, 2 Aug 2016 13:48:25 +0000 (15:48 +0200)]
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

7 years agovaapipostproc: use sink caps par if not requested
Víctor Manuel Jáquez Leal [Fri, 20 Jan 2017 18:57:52 +0000 (19:57 +0100)]
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

7 years agovaapipostproc: set interlace mode
Víctor Manuel Jáquez Leal [Fri, 20 Jan 2017 18:00:24 +0000 (19:00 +0100)]
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

7 years agovaapisink: fix gcc compiler warning
Víctor Manuel Jáquez Leal [Fri, 20 Jan 2017 15:10:32 +0000 (16:10 +0100)]
vaapisink: fix gcc compiler warning

warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

7 years agovaapisink: don't use member variable outside lock
Víctor Manuel Jáquez Leal [Thu, 12 Jan 2017 18:54:41 +0000 (19:54 +0100)]
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

7 years agoplugins: avoid log flood when activating pool
Víctor Manuel Jáquez Leal [Wed, 18 Jan 2017 16:20:21 +0000 (17:20 +0100)]
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.

7 years agovaapidecode: update internal decoder sink caps
Víctor Manuel Jáquez Leal [Fri, 13 Jan 2017 20:26:15 +0000 (21:26 +0100)]
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

7 years agoBack to development
Sebastian Dröge [Thu, 12 Jan 2017 14:33:13 +0000 (16:33 +0200)]
Back to development

7 years agoRelease 1.11.1
Sebastian Dröge [Thu, 12 Jan 2017 14:27:12 +0000 (16:27 +0200)]
Release 1.11.1

7 years agovaapi: bump ifdef to API 0.40.0 for log redirect
Víctor Manuel Jáquez Leal [Thu, 12 Jan 2017 11:49:55 +0000 (12:49 +0100)]
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

7 years agovaapiutils: Fix compilation with latest and previous libva releases
Sebastian Dröge [Thu, 12 Jan 2017 11:45:29 +0000 (13:45 +0200)]
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.

7 years agolibs: display: redirect logging at initialize
Víctor Manuel Jáquez Leal [Wed, 11 Jan 2017 15:04:24 +0000 (16:04 +0100)]
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

7 years agoplugins: provide at least two buffers in sink pool
Hyunjun Ko [Tue, 10 Jan 2017 06:15:31 +0000 (15:15 +0900)]
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>
7 years agolibs: decoder: h264: don't update cloned attributes
Hyunjun Ko [Tue, 10 Jan 2017 04:49:27 +0000 (13:49 +0900)]
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

7 years agovaapivideomemory: check for display
Víctor Manuel Jáquez Leal [Mon, 9 Jan 2017 18:25:24 +0000 (19:25 +0100)]
vaapivideomemory: check for display

This patch fixes the check of display, rather than check for the
meta, which it is known it exists.

7 years agovaapivideomemory: rename dmabuf allocator parameters
Víctor Manuel Jáquez Leal [Mon, 9 Jan 2017 15:23:56 +0000 (16:23 +0100)]
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.

7 years agovaapivideomemory: rename vip to alloc_info parameter
Víctor Manuel Jáquez Leal [Mon, 9 Jan 2017 15:18:32 +0000 (16:18 +0100)]
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.

7 years agovaapivideomemory: use GST_VIDEO_INFO_FORMAT_STRING()
Víctor Manuel Jáquez Leal [Mon, 9 Jan 2017 15:08:17 +0000 (16:08 +0100)]
vaapivideomemory: use GST_VIDEO_INFO_FORMAT_STRING()

Use the existing local macro GST_VIDEO_INFO_FORMAT_STRING() to get
the video format string.

7 years agovaapivideomemory: unroll gst_vaapi_surface_new_with_format()
Víctor Manuel Jáquez Leal [Mon, 9 Jan 2017 11:51:11 +0000 (12:51 +0100)]
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.

7 years agovaapipostproc: notify if src pad caps changed
Hyunjun Ko [Wed, 4 Jan 2017 10:23:06 +0000 (19:23 +0900)]
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

7 years agovaapidecodebin: capsfilter to optimize negotiation
Víctor Manuel Jáquez Leal [Wed, 14 Dec 2016 14:51:01 +0000 (15:51 +0100)]
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

7 years agovaapivideomemory: fail surface/image configuration
Hyunjun Ko [Wed, 21 Dec 2016 08:38:07 +0000 (17:38 +0900)]
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>
7 years agovaapisink: ensures raw caps at start()
Hyunjun Ko [Wed, 21 Dec 2016 08:50:41 +0000 (17:50 +0900)]
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

7 years agolibs: surface: fix error handling code style
Víctor Manuel Jáquez Leal [Fri, 9 Dec 2016 13:51:52 +0000 (14:51 +0100)]
libs: surface: fix error handling code style

7 years agovaapivideomemory: add gst_video_info_update_from_surface()
Víctor Manuel Jáquez Leal [Fri, 9 Dec 2016 15:14:14 +0000 (16:14 +0100)]
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.

7 years agovaapivideomemory: no log object at initialization
Víctor Manuel Jáquez Leal [Fri, 9 Dec 2016 14:51:32 +0000 (15:51 +0100)]
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.

7 years agovaapidecode: lock stream when setting caps
Víctor Manuel Jáquez Leal [Fri, 9 Dec 2016 16:56:02 +0000 (17:56 +0100)]
vaapidecode: lock stream when setting caps

7 years agoRevert "vaapidecode: implement negotiate() vmethod"
Víctor Manuel Jáquez Leal [Fri, 9 Dec 2016 16:42:42 +0000 (17:42 +0100)]
Revert "vaapidecode: implement negotiate() vmethod"

This reverts commit 3285121181295c544480fc6ba756845b16285d30.

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().

7 years agoRevert "encoders: demote to RANK_NONE since not fit for autoplugging yet"
Víctor Manuel Jáquez Leal [Wed, 7 Dec 2016 15:52:35 +0000 (16:52 +0100)]
Revert "encoders: demote to RANK_NONE since not fit for autoplugging yet"

This reverts commit f182b8be2ba05965e6d31a4d380d6563b9b53a77.

7 years agovaapiencode: get surface formats in get_caps()
Hyunjun Ko [Thu, 1 Dec 2016 09:57:10 +0000 (18:57 +0900)]
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>
7 years agolibs: encoder: add gst_vaapi_encoder_get_surface_formats()
Hyunjun Ko [Wed, 7 Dec 2016 10:26:37 +0000 (11:26 +0100)]
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>
7 years agolibs: encoder: split set_context_info()
Hyunjun Ko [Wed, 7 Dec 2016 10:10:42 +0000 (11:10 +0100)]
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>
7 years agolibs: context: skip VAContext if no frame size
Hyunjun Ko [Fri, 2 Dec 2016 00:30:52 +0000 (09:30 +0900)]
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>
7 years agolibs: context: split context_create()
Hyunjun Ko [Fri, 2 Dec 2016 00:28:07 +0000 (09:28 +0900)]
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

7 years agolibs: drm: find render node in hybrid system
Víctor Manuel Jáquez Leal [Tue, 6 Dec 2016 16:33:42 +0000 (17:33 +0100)]
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>

7 years agovaapivideomemory: refactor code for readability
Víctor Manuel Jáquez Leal [Mon, 14 Nov 2016 16:45:55 +0000 (17:45 +0100)]
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.

7 years agovaapivideomemory: log error if not VA image
Víctor Manuel Jáquez Leal [Mon, 14 Nov 2016 16:40:37 +0000 (17:40 +0100)]
vaapivideomemory: log error if not VA image

Log an error message if the test image for surface downloading
cannot be allocated or mapped.

7 years agovaapivideomemory: remove unused macros
Víctor Manuel Jáquez Leal [Mon, 14 Nov 2016 16:33:41 +0000 (17:33 +0100)]
vaapivideomemory: remove unused macros

These macros are not used. Let us remove them.

7 years agovaapivideomemory: rename video for allocation_info
Víctor Manuel Jáquez Leal [Fri, 11 Nov 2016 18:45:45 +0000 (19:45 +0100)]
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.

7 years agovaapivideomemory: add real GstVaapiDmaBufAllocator
Julien Isorce [Wed, 19 Oct 2016 14:27:03 +0000 (15:27 +0100)]
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>
7 years agovaapivideomemory: errors in gst_vaapi_dmabuf_allocator_new()
Julien Isorce [Wed, 19 Oct 2016 14:30:09 +0000 (15:30 +0100)]
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

7 years agovaapiencode: release internal encoder at stop()
Hyunjun Ko [Tue, 29 Nov 2016 06:14:32 +0000 (15:14 +0900)]
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>
7 years agoAutomatic update of common submodule
Edward Hervey [Sat, 3 Dec 2016 07:20:56 +0000 (08:20 +0100)]
Automatic update of common submodule

From f49c55e to 39ac2f5

7 years agovaapiencode: call ensure_encoder() at start()
Hyunjun Ko [Tue, 29 Nov 2016 05:59:02 +0000 (14:59 +0900)]
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

7 years agovaapidecodebin: bring back dynamic configuration
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 18:29:22 +0000 (19:29 +0100)]
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

7 years agovaapidecode: implement negotiate() vmethod
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 17:25:18 +0000 (18:25 +0100)]
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

7 years agocommon: use https protocol for common submodule
Tim-Philipp Müller [Sat, 26 Nov 2016 11:27:26 +0000 (11:27 +0000)]
common: use https protocol for common submodule

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

7 years agobuild: add LIBVA_WAYLAND_CFLAGS to libgstvaapiegl
Dominique Leuenberger [Thu, 24 Nov 2016 20:17:54 +0000 (21:17 +0100)]
build: add LIBVA_WAYLAND_CFLAGS to libgstvaapiegl

In case libva-wayland has its headers not installed in default
locations (like /usr/include), the build fails to include "wayland-client.h":

   CC       libgstvaapi_egl_la-gstvaapiutils_egl.lo
 In file included from gstvaapidisplay_wayland.h:27:0,
                  from gstvaapidisplay_egl.c:35:
 /usr/include/va/va_wayland.h:31:28: fatal error: wayland-client.h: No such file or directory
  #include <wayland-client.h>

As we already passed VA_CLAGS, /usr/include/va/va_wayland.h could be found, but it is
our fault not to instruct the system that we ALSO care for va_wayland. We correctly query
for libva-wayland.pc in configure and use this in other places as well. It is thus only
correct and consequent, to do it also at this spot.

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

7 years agovaapivideocontext: log a message if no bus
Víctor Manuel Jáquez Leal [Wed, 28 Oct 2015 11:55:18 +0000 (12:55 +0100)]
vaapivideocontext: log a message if no bus

Raise a warning if there is no bus when the element tries to post a
message.

7 years agovaapisink: create display at open()
Víctor Manuel Jáquez Leal [Wed, 28 Oct 2015 11:57:14 +0000 (12:57 +0100)]
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
5e5d62cac79754ba60057fc2516135aad8d7de35

That was done when the GStreamer's context sharing was not mature
enough as now. There is no reason to keep this hack.

7 years agovaapidecode: don't add video crop meta
Víctor Manuel Jáquez Leal [Fri, 4 Nov 2016 17:04:36 +0000 (18:04 +0100)]
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

7 years agoremove the video converter from vaapi buffer meta
Víctor Manuel Jáquez Leal [Thu, 19 Mar 2015 20:20:26 +0000 (21:20 +0100)]
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

7 years agoplugins: destroy source pad allocator and pool
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 17:28:18 +0000 (18:28 +0100)]
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.

7 years agoplugins: don't destroy sink pad allocator
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 18:17:07 +0000 (19:17 +0100)]
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.

7 years agoplugins: first validate the out caps
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 17:27:00 +0000 (18:27 +0100)]
plugins: first validate the out caps

When calling _set_caps() first validate the out caps before doing
anything else.

7 years agovaapidecode: negotiate after destroying allocator
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 17:42:02 +0000 (18:42 +0100)]
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.

7 years agovaapivideomemory: remove GST_VAAPI_TYPE_VIDEO_INFO
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 15:35:34 +0000 (16:35 +0100)]
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

7 years agoplugins: update the src pad allocator video info
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 11:51:25 +0000 (12:51 +0100)]
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

7 years agovaapivideomemory: add missing documentation
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 11:36:27 +0000 (12:36 +0100)]
vaapivideomemory: add missing documentation

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

7 years agoplugins: use early return without goto
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 11:29:26 +0000 (12:29 +0100)]
plugins: use early return without goto

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

7 years agoplugins: add allocator to allocation query
Víctor Manuel Jáquez Leal [Mon, 21 Nov 2016 10:25:21 +0000 (11:25 +0100)]
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

7 years agovaapivideobufferpool: set correct buffer size
Julien Isorce [Wed, 19 Oct 2016 14:15:01 +0000 (15:15 +0100)]
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

7 years agovaapivideomemory: check for memory allocator
Víctor Manuel Jáquez Leal [Thu, 10 Nov 2016 12:26:31 +0000 (13:26 +0100)]
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.

7 years agovaapivideomemory: code style fixes
Víctor Manuel Jáquez Leal [Thu, 10 Nov 2016 12:25:30 +0000 (13:25 +0100)]
vaapivideomemory: code style fixes

A cosmetic commit for enhance readability of the casts and method
preconditions.

7 years agovaapivideomemory: unroll gst_vaapi_video_allocator_free()
Víctor Manuel Jáquez Leal [Wed, 9 Nov 2016 18:49:22 +0000 (19:49 +0100)]
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.

7 years agovaapivideomemory: avoid virtual methods casting
Víctor Manuel Jáquez Leal [Wed, 9 Nov 2016 18:29:12 +0000 (19:29 +0100)]
vaapivideomemory: avoid virtual methods casting

Use the expected virtual method signatures for readability.

7 years agovaapivideomemory: remove unimplemented methods
Víctor Manuel Jáquez Leal [Wed, 9 Nov 2016 17:58:20 +0000 (18:58 +0100)]
vaapivideomemory: remove unimplemented methods

Remove unimplemented method for allocator mem_share() and mem_is_span().

7 years agovaapivideomemory: fail if frame map can't get plane
Víctor Manuel Jáquez Leal [Wed, 9 Nov 2016 17:54:47 +0000 (18:54 +0100)]
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

7 years agovaapivideomemory: lock map and unmap operations
Víctor Manuel Jáquez Leal [Wed, 9 Nov 2016 17:39:06 +0000 (18:39 +0100)]
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

7 years agovaapivideomemory: refactor vaapi memory unmapping
Víctor Manuel Jáquez Leal [Wed, 9 Nov 2016 16:37:06 +0000 (17:37 +0100)]
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