Commit graph

74 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
6c5b6232da vaapivideobufferpool: share options flag with pluginbase
Originally, vaapivideobufferpool has a set of boolean variables for the
buffer configuration options.

This pach changes these boolean variables for a single bitwise, just as
it is used in pluginbase. Hence, the internal enum was moved to
vaapivideobufferpool header.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
d0c72182a4 plugins: add gst_vaapi_plugin_base_create_pool()
This patch refactors the code in pluginbase in order to centralize the buffer
pool instantiation. As the buffer pool config may have different options, these
are gathered using a bitwise flag.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
50b2423a2b pluginbase negotiates allocator with bufferpool
Originally vaapivideobufferpool instantiates its own allocator regardless the
received configuration, and it relies in custom configuration options to
choose which kind of allocator instantiate.

This patch transfers the responsibility of the allocator instantiate to
vaapipluginbase and pass it to the vaapivideobufferpool through its
configuration.

* gst/vaapi/gstvaapipluginbase.c
  + set_dmabuf_allocator(): inserts a dmabuf allocator in the bufferpool
  + ensure_sinkpad_buffer_pool(): set a normal vaapi video allocator in
    bufferpool configuration
  + gst_vaapi_plugin_base_propose_allocation(): call set_dmabuf_allocator() if
    needed.
  + gst_vaapi_plugin_base_decide_allocation(): set a normal vaapi video
    allocator in bufferpool configuration
* gst/vaapi/gstvaapivideobufferpool.c
  + gst_vaapi_video_buffer_pool_set_config(): instead of instantiate the
    allocator, process the received one through its configuration.
* gst/vaapi/gstvaapivideobufferpool.h: removed
  GST_BUFFER_POOL_OPTION_DMABUF_MEMORY since it is not used anymore.
* gst/vaapi/gstvaapivideomemory.c
  + gst_vaapi_is_dmabuf_allocator(): new helper function to identify a dmabuf
    allocator with the vaapi qdata.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
3d9f8dd41f pluginutil: add gst_video_info_force_nv12_if_encoded()
This lines repeat a couple times in the code, so it would be better to put it
a helper function.

https://bugzilla.gnome.org/show_bug.cgi?id=765435
2016-06-08 10:19:01 +02:00
Víctor Manuel Jáquez Leal
101e31df83 plugins: remove unused header
Remove the include of gst/allocators/allocators.h since it is not used.
2016-05-25 12:36:12 +02:00
Víctor Manuel Jáquez Leal
789afaccfb plugins: add gst_vaapi_buffer_pool_caps_is_equal()
This is a helper function to improve the readability of
ensure_sinkpad_buffer_pool(). It makes clearer when the buffer pool needs to be
re-instantiated.
2016-05-24 16:50:41 +02:00
Víctor Manuel Jáquez Leal
2fc855b134 plugins: deactivate buffer pool before unref
This buffer pool may still be processing buffers when a caps renegotiation is
done. This one-liner patch deactivates the pool to drain it before it
de-allocation.
2016-05-24 16:50:41 +02:00
Víctor Manuel Jáquez Leal
b27ddd8036 plugins: no sinkpad bufferpool when decoder
Right now, the decoders create a buffer pool for their sink pad which is not
used at all, because the decoders have never proposed it to upstream.

This patch avoids the buffer pool instantiating when the element inherits from
the GstVideoDecoder class.
2016-05-24 16:50:39 +02:00
Víctor Manuel Jáquez Leal
c9f6006865 plugins: avoid to get/set pool config twice
This patch is a bit of optimization, since the bufferpool configuration is get
when the pool is created. Hence, we only need to request it when the pool from
the allocation query is reused.
2016-05-24 13:39:25 +02:00
Víctor Manuel Jáquez Leal
9667f0e472 plugins: destroy pool earlier if non-vaapi
If the offered pool in decide_allocation() vmethod doesn't have the
VAAPI_VIDEO_META option, it is destroyed immediatly and the pointer cleared,
so it could be created later.
2016-05-24 13:35:55 +02:00
Víctor Manuel Jáquez Leal
1f5ba28bd0 plugins: check for caps in query earlier
Check for caps as soon gst_query_parse_allocation() returns.
2016-05-24 10:33:18 +02:00
Víctor Manuel Jáquez Leal
f0d385ea4e plugins: remove unused variables
This variables stopped to be used since commit 001a5c63, which removed the
gstvaapiuploader.
2016-05-24 10:33:18 +02:00
Víctor Manuel Jáquez Leal
4800f48980 plugins: fix potential memleak from commit 9159328
If gst_video_info_from_caps() fails it is required to unref the instantiated
pool.
2016-05-23 18:47:46 +02:00
Víctor Manuel Jáquez Leal
9159328434 plugins: handle if gst_video_info_from_caps() fails
Let's play safe and return error if, somehow, the received caps are wrong.
2016-05-23 17:55:35 +02:00
Víctor Manuel Jáquez Leal
6d8b7056cc plugins: relate errors to instance
Use GST_{ERROR,WARNING}_OBJECT instead of GST_{ERROR,WARNING}, thus the logs
will show the name of the vaapipluginbase instance that failed.

Also, the code-style is fixed, where some error labels need to be surrounded
by braces.
2016-05-23 17:47:36 +02:00
Víctor Manuel Jáquez Leal
4dd2464060 plugins: use GstVideoInfo accessors
Instead of access to GstVideInfo members directly, use their accessors
macros. This patch makes more resistance to future changes in GStreamer core.
2016-05-20 21:01:02 +02:00
Víctor Manuel Jáquez Leal
d69917ecca remove spurious gst_video_info_init()
gst_video_info_set_format() and gst_video_info_from_caps() call, internally,
gst_video_info_init(), hence it is not required to call it before them. This
patch removes these spurious calls.
2016-05-20 19:33:39 +02:00
Víctor Manuel Jáquez Leal
35f6ce964d vaapipluginbase: code-style: rename goto label
The error labels have error_ prefix, but this one.
2016-05-20 19:22:41 +02:00
Víctor Manuel Jáquez Leal
5341d9ae9f plugins: remove gst_vaapi_plugin_base_set_pool_config()
This function helper make sense for GStreamer 1.2, but it is not helpful for
greater version since the validation is already done in the API implementation.
Thus, it is removed.
2016-05-19 12:54:38 +02:00
Sreerenj Balachandran
36e2346fc7 gstvaapipluginbase: Fix typo in doc 2016-05-18 17:05:03 +03:00
Víctor Manuel Jáquez Leal
53851b0e73 vaapidecode: search driver in whitelist
If the backend driver vendor string is not in a white-list, and the
environment variable GST_VAAPI_ALL_DRIVERS is not set either, the decoder will
change it state from NULL to READY, hence the auto-plug mechanism will look
for another decoder.

This patch assumes the GstContext has already being shared along the pipeline
and the element has a valid GstVaapiDisplay instance.

https://bugzilla.gnome.org/show_bug.cgi?id=764673
2016-04-22 17:25:00 +02:00
Víctor Manuel Jáquez Leal
bccdda84b7 plugins: rework set_context() vmethod definition
In bug 757598 was added the set_context() vmethod chain up in
GstVaapiPluginBase. But it is buggy, since the parent_class address is
assigned to the last element which called gst_vaapi_plugin_base_class_init().

No error has shown up since none of the element's base classes redefined
set_context() vmethod from GstElement, so always the correct function was
called. Still this code is wrong and this patch make it right.

Since set_context() is the same code, a macro is used to implement that code
in all the gst-vaapi elements.

https://bugzilla.gnome.org/show_bug.cgi?id=765368
2016-04-22 17:18:18 +02:00
Víctor Manuel Jáquez Leal
c5c60e2a33 plugins: remove param in gst_vaapi_plugin_base_decide_allocation() 2016-04-18 19:07:55 +02:00
Víctor Manuel Jáquez Leal
8d42c95b0f plugin: use allowed caps filter from element
Instead of using the srcpad template caps for filtering the peer caps, the
function gst_vaapi_find_preferred_caps_feature(), now receives a new parameter
for the element's allowed caps.

With this modification, the vaapipostproc element simplifies a bit its code.

https://bugzilla.gnome.org/show_bug.cgi?id=765223
2016-04-18 18:28:43 +02:00
Víctor Manuel Jáquez Leal
2d7d38cb9c plugin: remove function parameter
The native format parameter in gst_vaapi_find_preferred_caps_feature() can be
saved if the out format is used for both: in and out. Thus the code is more
readable.

https://bugzilla.gnome.org/show_bug.cgi?id=765223
2016-04-18 18:28:43 +02:00
Víctor Manuel Jáquez Leal
8169c6afb1 remove custom allocation query
When resolving bug 753914, a custom allocation query was added, overlapping
the responsibilities of GstVideoDecoder.

But with the merge of the patches from bug 764421 this overlapping was not
required anymore. This patch restores this situation setting the
allocation_caps in the GstVideoCodecState when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Sreerenj Balachandran
fd04a7c046 gst/vaapi: keep precedence for NV12 over I420
Use NV12 as default "assumption" format all over.
NV12 is the default high priority format used my most of the
vaapi-drivers.
2016-03-29 15:02:46 +03:00
Sreerenj Balachandran
959d14ce8a vaapidecode: Fix decide_allocation handling
Set the already configured pool in decide_allocation query
in cases where pool renegotiation is not required.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2016-03-24 15:09:43 +02:00
Sreerenj Balachandran
859a2b2f4f Make vaapidecode to advertise the cropped values in srcpad, but negotiate pool only if needed
-- Maintaing decoded surface resoluton and actual display resoultion separately
-- Before pushing every frames downstream, check for the requirement of pool negoation and
output_state negotiation: This is needed to avoid multiple issuses with cropping,
multi-resoluton video handling, more complex multi resolution decode scenarios for vp9decode,
possible wrong behaviour from upstream element to report uncropped values etc. Due to these reasons,
We can't just reliably use the resolution change notification from libgstvaapi for pool renegotiation too.
This is slight overhead, but safe enough. Optimization could be possible though.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2016-03-24 15:08:50 +02:00
Víctor Manuel Jáquez Leal
5b5ebc0a15 plugins: remove deprecated code
Since we are only supporting current GStreamer version, since 1.3
gst_buffer_pool_config_add_option() checks if the option to add is
already set. There is no need to do it ourselves.
2016-02-22 17:43:13 +01:00
Lim Siew Hoon
ce1ab4673c Add icamerasrc as dmabuf capable peer element
icamerasrc is another gstreamer plugin using to capture RAW
frames from camera device. It is based on libcamhal library.
There are some properties available to control icamera behavior.

Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
Tested & Reviewed: Zhu Haiyang <haiyang.zhu@intel.com>

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

Fixme: This is the similar workaround we done for v4l2src.
The workaround will be removed once we fix #755072
2016-02-17 15:40:54 +02:00
Vineeth TM
733c9b6fba vaapipluginbase: Fix structure memory leak
config structure is not being freed in all cases

https://bugzilla.gnome.org/show_bug.cgi?id=762172
2016-02-17 10:45:29 +02:00
Tim-Philipp Müller
24168a2093 vaapi: fix 'ISO C90 forbids mixed declarations and code' compiler warnings
Declare variables at the beginning of a code block, which
is how it's done in GStreamer.

https://bugzilla.gnome.org/show_bug.cgi?id=759192
2016-02-02 16:17:43 +01:00
Víctor Manuel Jáquez Leal
1c722efe54 Remove old gst version guards
As gstreamer-vaapi now only supports from GStreamer 1.6, this patch removes
all the old GStreamer version guards.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-01-25 12:09:40 +00:00
Víctor Manuel Jáquez Leal
1efe569639 plugin: guard pointers to pad query functions
Since gstreamer 1.4 is not required to have pad query functions if the query
vmethods are used.

This patch guards out the pad query functions for gstreamer < 1.4

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

https://bugzilla.gnome.org/show_bug.cgi?id=757629
2015-11-09 16:18:44 +01:00
Víctor Manuel Jáquez Leal
1e96fae94c plugin: chain up set_context() vmethod
Since Gstreamer 1.7, set_context() vmethod needs to be chained up with
the parent class in order to broadcast all its contexts when the element
is added into a bin:

http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=d5ded1588920c4471eefe055d09095d9e5e989b5

There is no need to guard the call, because before GStreamer 1.7, the
set_context() vmethod was NULL in the element class, hence the conditional
call make it safe.

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

https://bugzilla.gnome.org/show_bug.cgi?id=757598
2015-11-09 16:18:19 +01:00
Victor Jaquez
9bdf43a843 plugins: reduce the noise of warnings
Those messagse should be attached to the object, also the lack of
caps is not an error, in particular in the case of JPEG encoding.

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

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-04 19:42:48 +02:00
Víctor Manuel Jáquez Leal
001a5c637d remove gstvaapiuploader
Working on bug #744042 I realized that the gstvaapiuploader is practically not
used.

This patch removes the gstvaapiuploader and add the method
gst_vaapi_plugin_base_get_allowed_raw_caps () that returns the raw caps that
the system can handle, which is used by vaapisink and vaapipostproc.

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

https://bugzilla.gnome.org/show_bug.cgi?id=752777
2015-08-04 19:32:40 +02:00
Sreerenj Balachandran
b4154ac85c gst/vaapi: Switch to upstreram like indentation.
gst-indent for all gst/vaapi/*.c source files
2015-06-30 09:44:18 +03:00
Olivier Crete
3241296f67 vaapipluginbase: Override downstream allocation reply if no pool
If the downstream replied without a pool, then override it.

https://bugzilla.gnome.org/show_bug.cgi?id=748559
2015-06-17 09:53:29 +03:00
Víctor Manuel Jáquez Leal
3024640d4f plugins: remove gstreamer-0.10 crumbs
GstVideoContext was used in gstreamer-0.10, which is not supported anymore.
Still, its definition was still in the code. This patch removes it.

https://bugzilla.gnome.org/show_bug.cgi?id=749113
2015-05-12 12:19:57 +02:00
Víctor Manuel Jáquez Leal
188d8fe442 plugins: check if the pool config is already set
In commit 97b768, a regression for GStreamer 1.2 was introduced:

GStreamer 1.2 doesn't check, in gst_buffer_pool_set_config() if the
config option is already set. This patch adds an inline function to
first verify if the option is not in the pool config berfore add it.
2015-04-30 13:51:22 +02:00
Víctor Manuel Jáquez Leal
97b768675a plugins: check gst_buffer_pool_set_config()
Check the return value of gst_buffer_pool_set_config(). If it fails an error
message is posted in the bus.
2015-04-29 12:27:43 +02:00
Víctor Manuel Jáquez Leal
100d5971b5 plugins: more specific log message
Be more specific in the log message about the reason of creating a new pool.
2015-04-29 12:24:52 +02:00
Víctor Manuel Jáquez Leal
b8268b1f3e plugins: delete unused variable
need_pool is a boolean variable extracted from the allocation query, but it is
not used afterwards.
2015-04-29 12:22:29 +02:00
Olivier Crete
d70a2e8d13 vaapipluginbase: Update the pool if there was no pool in the downstream reply
Fix regression introduced by bd866479, the query after decide_allocation()
always needs a pool in the first slot.

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

https://bugzilla.gnome.org/show_bug.cgi?id=748559
2015-04-29 12:05:07 +02:00
Olivier Crete
bd86647970 vaapipluginbase: The allocation query can return without a pool
It is possible to return the min/max/size without actually providing
a pool. This way the source knows how many buffers downstream needs.

https://bugzilla.gnome.org/show_bug.cgi?id=748076
2015-04-19 09:25:56 +02:00
Víctor Manuel Jáquez Leal
8b36e25f47 Removal of gstreamer-1.0 support
The support for GStreamer 1.0 has been obsoleted in 0.5.10 release.
GStreamer 1.2 is the a minimal requirement for building the gstreamer-vaapi.

This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-1.0.

Thus, all the video converters were removed too.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-03 17:09:08 +03:00
Víctor Manuel Jáquez Leal
c561b8da8a update and move gstcompat.h
The purpose of gstcompat.h is to couple the API differences among
gstreamer-1.0 and gstreamer-0.10. Since gstreamer-0.10 is obsolete, the code
in this compatibility layer shall be removed.

Nevertheless, the gstcompat.h header should be kept, if new incompatibilites
appear in the future, but it shall live in gst/vaapi, not in gst-libs.

This patch removes the crumbs defined gstcompat.h and moves it to gst/vaapi.
In order to avoid layer violations, gstcompat.h includes sysdeps.h and all
the includes in gst/vaapi of sysdeps.h are replaced with gstcompat.h

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-03 17:08:30 +03:00
Víctor Manuel Jáquez Leal
d256f1d283 Removal of gstreamer-0.10 support
This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-0.10.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 16:55:27 +03:00