Sreerenj Balachandran [Fri, 17 Apr 2015 12:44:04 +0000 (15:44 +0300)]
codecparsers: Update to gst-vaapi-branch commit
43a0368
45f1c28: codecparser: h265: Fix nal unit size checking
f25987b: codecparser: h265: Calculate crop rectangle dimensions
639573a: codecparser: h265: Fix parsing multiple SEI messages in a single SEI Nal
4c8ec41: Add h265 videoparser plugin source files
Gwenole Beauchesne [Fri, 17 Apr 2015 08:10:10 +0000 (10:10 +0200)]
autogen: drop videoutils submodule.
Gwenole Beauchesne [Fri, 17 Apr 2015 08:36:25 +0000 (10:36 +0200)]
decoder: hevc: cosmetics.
Mostly coding style updates. Avoid integer signess inconsistencies.
Optimize dpb_find_lowest_poc() to align with original h264's decoder.
Sreerenj Balachandran [Thu, 16 Apr 2015 11:13:59 +0000 (14:13 +0300)]
decoder: hevc: Add Support for tiled video decoding
Based up on the value of uniform_spacing_flag in Picture Parameter Set,
the tile column width and tile row height should be calculated.
Equations: 6-1, 6-2
Tiled video Descriptions: 7.3.2.3, 7.4.3.3
Sreerenj Balachandran [Thu, 16 Apr 2015 11:13:21 +0000 (14:13 +0300)]
decoder: hevc: Fix decoding when there are RASL pictures present.
-- Set NoRaslOutputFlag based on EOS and EOB Nal units
-- Fix PicOutputFlag setting for RASL picture
-- Fix prev_poc_lsb/prev_poc_msb calculation
-- Drop the RASL frames if NoRaslOutputFlag is TRUE for the associated IRAP picture
-- Fixed couple of crashes and added cosmetics
Martin Sherburn [Tue, 14 Apr 2015 09:54:54 +0000 (10:54 +0100)]
display: drm: fix race condition setting device type
There is a race condition where g_drm_device_type can be left set to
DRM_DEVICE_RENDERNODES when it shouldn't.
If thread 1 comes in and falls into the last else statement setting up both
RENDERNODES and LEGACY types. And begins to process the first type (RENDERNODES),
it sets g_drm_device_type = RENDERNODES.
Now when thread 2 comes in and sees g_drm_device_type is RENDERNODES, it queues
up that type to be tried but then encounters the lock and has to wait until the
first thread finishes. Once the lock is acquired it will then proceed to ONLY try
RENDERNODES and fail it. But it doesn't try LEGACY. And from then on, all future
attempts will only try RENDERNODES.
So to avoid this situation I have simply moved the acquisition of the lock higher
up in the attached patch.
https://bugzilla.gnome.org/show_bug.cgi?id=747914
Olivier Crete [Wed, 15 Apr 2015 19:26:12 +0000 (15:26 -0400)]
vaapipostproc: Don't create filter on caps query
The problem with this is that creating the filter causes the display to
be selected, and the caps query happens while linking the element. So,
if the downstream or upstream element is using a specific display
object, it won't be propagated correctly to the postproc as it already
has a display at this point.
https://bugzilla.gnome.org/show_bug.cgi?id=747945
Olivier Crete [Wed, 15 Apr 2015 19:20:17 +0000 (15:20 -0400)]
videopool: Release lock while allocating new object
The video pool can be accessed with the display lock held, for example,
when releasing a buffer from inside vaapisink_render, but allocating
a new object can may also take the display lock. Which means a possible
deadlock.
https://bugzilla.gnome.org/show_bug.cgi?id=747944
Víctor Manuel Jáquez Leal [Wed, 15 Apr 2015 15:26:43 +0000 (17:26 +0200)]
vaapisink: use GstVideoSink vmethod show_frame()
vaapisink inherits from GstVideoSink, in order to use its functionality (such
as ::show-preroll-frame property), we should use its vmethod show_frame(),
rather than call ourselves render() and preroll().
Víctor Manuel Jáquez Leal [Wed, 15 Apr 2015 16:16:47 +0000 (18:16 +0200)]
vaapisink: add 'handoff' signal
This patch adds the signal ::handoff and the property signal-handoffs. If the
property is set TRUE, the signal ::handoff is emitted just after the buffer is
rendered.
Based on Zhao Halley <halley.zhao@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=747905
Víctor Manuel Jáquez Leal [Tue, 14 Apr 2015 08:17:16 +0000 (10:17 +0200)]
HEVC: silence the compiler
Fixed a couple of clang complains.
Michael Olbrich [Mon, 2 Feb 2015 15:42:43 +0000 (16:42 +0100)]
wayland: destroy vpp buffer pool on resize
Otherwise the old buffers with the old size are used.
https://bugzilla.gnome.org/show_bug.cgi?id=747491
Víctor Manuel Jáquez Leal [Tue, 14 Apr 2015 08:08:47 +0000 (10:08 +0200)]
build: don't compile HEVC if not supported
HEVC decoding was added recently libva-1.5.
This patch avoids HEVC decoding support in libgstvaapi if it is not available
in the installed libva.
https://bugzilla.gnome.org/show_bug.cgi?id=747831
Sreerenj Balachandran [Mon, 13 Apr 2015 13:04:59 +0000 (16:04 +0300)]
vaapidecode: Update Author name in plugin metadata
Sreerenj Balachandran [Mon, 13 Apr 2015 12:43:30 +0000 (15:43 +0300)]
plugins: Add HEVC decoder
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Mon, 13 Apr 2015 12:41:45 +0000 (15:41 +0300)]
HEVC: Add HEVC(h265) decoder to core libgstvaapi
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Mon, 13 Apr 2015 11:53:46 +0000 (14:53 +0300)]
HEVC: Add codec utility methods to core libgstvaapi
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Mon, 13 Apr 2015 11:52:53 +0000 (14:52 +0300)]
HEVC: gstvaapiprofile: Add profile definitions
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Mon, 13 Apr 2015 11:52:14 +0000 (14:52 +0300)]
HEVC: build: Check availability of h265 decoder APIs
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Mon, 13 Apr 2015 11:51:51 +0000 (14:51 +0300)]
HEVC: Allow to build h265 codecparser internally
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Víctor Manuel Jáquez Leal [Wed, 8 Apr 2015 16:05:20 +0000 (18:05 +0200)]
guard buffer export API if not available
The support for buffer exports in VA-API was added in version 0.36. These
interfaces are for interop with EGL, OpenCL, etc.
GStreamer-VAAPI uses it for a dmabuf memory allocator. Though, gstreamer-vaapi
has to support VA-API versions ranging from 0.30.4, which doesn't support it.
This patch guards all the buffer exports handling (and dmabuf allocator) if
the detected VA-API version is below 0.36.
https://bugzilla.gnome.org/show_bug.cgi?id=746405
Sreerenj Balachandran [Mon, 13 Apr 2015 08:29:35 +0000 (11:29 +0300)]
codecparsers: Update to gst-vaapi-branch commit
9bc72b0
767bf22: codecparsers: h265: add helpers to convert quantization matrices
71c8e93: codecparser: h265: skip byte alignment bits while parsing slice header
3bf0355: codecparsre: h265: Fix the NumDeltaPocs calculation
10e2087: codecparser: h265: Fix the NumPocTotalCurr calculatio
2d753b8: codecparser: h265: Fix nal size calculation for EOS and EOB
Michael Olbrich [Thu, 11 Dec 2014 11:02:38 +0000 (12:02 +0100)]
vaapidecode: unref video codec frame twice
We get one reference when the frame is passed to decode_handle_frame()
and create another one in gst_vaapi_decoder_push_frame().
Usually the frame is handled in gst_vaapidecode_push_decoded_frame().
Here the frame is always released twice:
gst_video_decoder_finish_frame() + gst_video_codec_frame_unref() or
gst_video_decoder_drop_frame() + gst_video_codec_frame_unref().
In gst_vaapidecode_reset_full() both references to the frame must be
released as well.
Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
https://bugzilla.gnome.org/show_bug.cgi?id=743226
Víctor Manuel Jáquez Leal [Wed, 8 Apr 2015 16:20:34 +0000 (18:20 +0200)]
libs: remove unused variables
clang reports these unused variables. Let's get rid of them.
This patch is a missing part of commit
c82e5173
https://bugzilla.gnome.org/show_bug.cgi?id=747312
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 18:38:07 +0000 (20:38 +0200)]
decoder: mpeg4: remove an spurious comparison
The member size in GstMpeg4Packet is gsize which is unsigned, which cannot be
less than zero. Hence this pre-condition test is a no-op. This patch removes
that code.
https://bugzilla.gnome.org/show_bug.cgi?id=747312
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 18:33:44 +0000 (20:33 +0200)]
encoder: h264: casts slice_param->slice_type
slice_type in slice_param is defined as (char *), but it is compared against a
signed integer. clang complains about this comparison.
This patch casts the variable.
https://bugzilla.gnome.org/show_bug.cgi?id=747312
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 18:31:47 +0000 (20:31 +0200)]
encoder: avoid GstVaapiCodedBuffer redefinition
The symbol GstVaapiCodedBuffer is already defined in
gst-libs/gst/vaapi/gstvaapicodedbuffer.h which is loaded, at the end, by
gstvaapiencoder_objects.h. Clang complains about the symbol re-definition.
This patch removes that redefinition.
https://bugzilla.gnome.org/show_bug.cgi?id=747312
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 18:28:22 +0000 (20:28 +0200)]
libs: remove unused variables
clang reports these unused variables. Let's get rid of them.
https://bugzilla.gnome.org/show_bug.cgi?id=747312
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 18:27:24 +0000 (20:27 +0200)]
encoder: mpeg2: use fabsf() instead of abs()
The member value in frame_rate_tab is float, the result of the abs() function
should be float too. But abs() only manages integers.
This patch replaces abs() with fabsf() to handle correctly the possible floats
values.
https://bugzilla.gnome.org/show_bug.cgi?id=747312
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 18:02:29 +0000 (20:02 +0200)]
decoder: cast GST_VAAPI_DECODER_STATUS_DROP_FRAME
Since GST_VAAPI_DECODER_STATUS_DROP_FRAME is not part of the enum
GstVaapiDecoderStatus, we need to cast it to avoid compiler complains.
https://bugzilla.gnome.org/show_bug.cgi?id=747312
Sreerenj Balachandran [Fri, 3 Apr 2015 21:40:29 +0000 (00:40 +0300)]
Update README
Sreerenj Balachandran [Fri, 3 Apr 2015 21:06:56 +0000 (00:06 +0300)]
Changing source code download links from https://gitorious to https://github
-- gitmodules: Change gstreamer-codecparsers submodule source download link
-- README: Change the gstreamer-vaapi webpage link
Sreerenj Balachandran [Fri, 3 Apr 2015 20:30:24 +0000 (23:30 +0300)]
codecparsers: update to gst-vaapi-branch commit
1f792e4
87f4a7e: bytereader: add gst_byte_reader_peek_sub_reader() and _get_sub_reader()
7d8ba7a: bytereader: use unchecked inline variant for get_remaining in more places
2528ea6: bytereader: add gst_byte_reader_masked_scan_uint32_peek
2b92a67: h264parse: reset the parser information when caps changes
05eee86: codecparsers: Indent file
e27a38b: codecparsers: Add READ_UE_MAX macro
2036471: Constify some static arrays everywhere
Sreerenj Balachandran [Fri, 3 Apr 2015 14:45:08 +0000 (17:45 +0300)]
Remove the gstvaapivideoconverter_*.c source files missed in commit
51b1e4a
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:09:08 +0000 (17:09 +0300)]
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>
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:08:30 +0000 (17:08 +0300)]
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>
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:05:45 +0000 (17:05 +0300)]
autotools: remove gstreamer-1.0 support
This patch only removes the support of gstreamer-1.0 in the autotools
scripts. No other files are touched.
In the automake file all the converters were deprecated.
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>
Sreerenj Balachandran [Fri, 3 Apr 2015 14:03:38 +0000 (17:03 +0300)]
Remove the gstreamer-videoutils submodule
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:01:45 +0000 (17:01 +0300)]
Remove libgstvaapi-videoutils.so
This library was intended to add the base classes for video decoders which
where not included in gstreamer-0.10.
Since the support of gstreamer-0.10 is deprecated those classes are not
required, thus the whole library is removed.
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>
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 13:55:43 +0000 (16:55 +0300)]
Remove HAVE_GST_VIDEO_OVERLAY_HWCAPS macro
This macro guarded the use of HAVE_GST_VIDEO_OVERLAY_HWCAPS, which was not
defined before gstreamer 0.10.35. Since the support of gstreamer-0.10 is
deprecated these guards are not required.
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>
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 13:55:27 +0000 (16:55 +0300)]
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>
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 13:54:54 +0000 (16:54 +0300)]
autotools: remove gstreamer-0.10 support
This patch only removes the support of gstreamer-0.10 in the autotools
scripts. No other files are touched.
The configuration parameter --gstreamer-api was deleted since now it is always
auto-detected.
The verification of vmethod query in GstBaseSinkClass was removed since it was
added in gstreamer 0.10.35. The same case for GstVideoOverlayComposition and
its format flags.
The precious variable GST_PLUGIN_PATH was removed, while GST_PLUGIN_PATH_1_0
remained.
The automake files were changed accordingly.
Removed, in debian/control, the vaapiupload and vaapidownload descriptions.
https://bugzilla.gnome.org/show_bug.cgi?id=732666
https://bugzilla.gnome.org/show_bug.cgi?id=745728
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:38:18 +0000 (23:38 +0200)]
vaapidecode: add drain() vmethod
In GStremer v1.6 a new vmethod drain() was added in GstVideoDecoder
class. This patch implements this new method.
https://bugzilla.gnome.org/show_bug.cgi?id=742922
Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:37:29 +0000 (23:37 +0200)]
vaapidecode: remove vmethod reset()
Since in bug #745728 the support for GStreamer 1.0 is going to be dropped,
this patch removes the method reset() which was deprecated in GStreamer 1.2.
https://bugzilla.gnome.org/show_bug.cgi?id=742922
Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:36:33 +0000 (23:36 +0200)]
vaapidecode: handle flush() vmethod
Since GStreamer 1.2 the vmethod reset() in GstVideoDecoderClass was deprecated
and flush() was added.
This patch set the vmethod flush() if the installed GStreamer version is 1.2 or
superior. Otherwise, reset() is set.
v2: 1) In order to avoid symbol collision, the old method gst_vaapidecode_flush()
was renamed to gst_vaapidecode_internal_flush().
2) The new vmethod flush() always do a hard full reset.
v3: 1) Call gst_vaapidecode_internal_flush() first in flush() vmethod, in order to
gather all collected data with gst_video_decoder_have_frame()
https://bugzilla.gnome.org/show_bug.cgi?id=742922
Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:10:53 +0000 (23:10 +0200)]
vaapidecode: call the correct query function
In commit
2f8c115 (vaapidecode: use the query virtual methods in 1.4)
a bug was introduced: when calling the parent's query function of the
src pad, the one of the sink pad is called instead. This patch fixes
this issue.
https://bugzilla.gnome.org/show_bug.cgi?id=746248
Sreerenj Balachandran [Sat, 14 Mar 2015 22:36:45 +0000 (00:36 +0200)]
gitmodules: Use https:// url instead of git:// for submodules.
Gitorious is failing to clone repositories over git:// url.
Julien Isorce [Sat, 14 Mar 2015 20:12:19 +0000 (22:12 +0200)]
vaapidisplay: mark X11 display as compatible with EGL
GST_GL_WINDOW=x11 GST_GL_API=gles2 GST_GL_PLATFORM=egl
gst-launch-1.0 ... ! vaapidecode ! glimagesink
https://bugzilla.gnome.org/show_bug.cgi?id=745902
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Olivier Crete [Fri, 6 Mar 2015 13:20:01 +0000 (15:20 +0200)]
vaapidecode: Don't crash if a buffer outlives the decoder
Sometimes, for example, when switching video streams but keeping
the same sink, the surface will be released after the decoder is
stopped and replaced. This caused a crash because the release
callback was called on an invalid pointer.
The patch adding an additional reference to the decoder object in the buffer.
https://bugzilla.gnome.org/show_bug.cgi?id=745189
Signed-off-by: Olivier Crete <olivier.crete@collabora.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Fri, 6 Mar 2015 12:31:21 +0000 (14:31 +0200)]
vaapidecode: clean-ups (indentation, drop unused variables)
Víctor Manuel Jáquez Leal [Fri, 6 Mar 2015 12:09:22 +0000 (14:09 +0200)]
vaapidecode: use the query virtual methods in 1.4
GstVideoDecoder, the base class of vaapidecode, added support for
pad queries as virtual methods. This patch enables the use of that
support, while keeping support for lower versions of gstreamer.
This patch is important because GstVideoDecoder takes care of other
queries that might be important in the pipeline managing.
v2: 1) rebase to current master
2) fix indentation with gst-indent
3) simplify the patch layout
4) fix the context query
5) initialise the filter to NULL
6) improve the query log message for gst-1.2
https://bugzilla.gnome.org/show_bug.cgi?id=744406
Víctor Manuel Jáquez Leal [Fri, 6 Mar 2015 10:16:17 +0000 (12:16 +0200)]
vaapipostproc: always activate buffer pool
The vaapipostproc has a proxy flag to know if the the buffer pool is
already active. But this fails in some situations where it is needed
to renegotiate the buffer pool.
This patch removes that flag so the renegotiation is done whenever is
required.
https://bugzilla.gnome.org/show_bug.cgi?id=745535
Gwenole Beauchesne [Mon, 2 Mar 2015 16:04:20 +0000 (17:04 +0100)]
vaapisink: fix minor memory leak in debug mode.
The gst_video_colorimetry_to_string() function returns a newly created
string that represents the GstVideoColorimetry value. So, that needs
to be released after usage, in e.g. GST_DEBUG().
Sreerenj Balachandran [Tue, 3 Mar 2015 10:37:41 +0000 (12:37 +0200)]
vaapidecodebin: Avoid usage of "__" prefix in macro names
Avoiding "__" prefix usage in Header File Guards as per
C standard recommendation.
Sreerenj Balachandran [Tue, 3 Mar 2015 10:31:11 +0000 (12:31 +0200)]
plugins: Disable vaapidecodebin for GStreamer < 1.4
There are autoplugging issues in GStreamer-1.2.
Lets disable vaapidecodebin untill we get some workarounds for this.
Sreerenj Balachandran [Mon, 2 Mar 2015 13:19:40 +0000 (15:19 +0200)]
plugins: Add a vaapidecodebin element
Add a "vaapidecodebin" element to vaapi plugins.
Child Elements: "vaapidecode ! queue ! vaapipostproc"
The Reasons for implementing a new bin element:
-- Help to Autoplug Hardware Accelerated Video Postprocessing element in playbin
with out any dependency to upstream gstreamer.
This is to overcome the *unacceptable* delay in upstream gstreamer to get new
features in. Eg: https://bugzilla.gnome.org/show_bug.cgi?id=687182.
Also customers using older gstreamer versions (1.2 and 1.4) will get the
benefit of autoplugging, hardware accelerated deinterlacing support etc.
-- Help to maintain a single thread implementation in vaapidecode.
This will result a dead-lock free vaapidecode in most of the cases.
More details here: https://bugzilla.gnome.org/show_bug.cgi?id=742605
https://bugzilla.gnome.org/show_bug.cgi?id=745216
Sreerenj Balachandran [Mon, 2 Mar 2015 12:59:16 +0000 (14:59 +0200)]
vaapidecode: re-indent (gst-indent) gstvaapidecode.c
Simon Farnsworth [Mon, 2 Mar 2015 12:46:38 +0000 (14:46 +0200)]
vaapidecode: Switch back to Single thread implementation
Because the decoder uses the thread from handle_frame() to decode a frame,
the src pad task creates an unsolveable AB-BA deadlock between
handle_frame() waiting for a free surface and decode_loop() pushing
decoded frames out.
Instead, have handle_frame() take responsibility for pushing surfaces,
and remove the deadlock completely. If you need a separate thread
downstream, you can insert a queue between vaapidecode and its downstream
to get one.
Another justification for the single thread implementation is,
there are two many point of locking in gstreamer-vaapi's current
implementation which can lead to deadlocks.
https://bugzilla.gnome.org/show_bug.cgi?id=742605
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Gwenole Beauchesne [Mon, 2 Mar 2015 12:28:41 +0000 (13:28 +0100)]
plugins: fix detection of upstream v4l2src element.
Improve check for upstream element that requires DMABUF buffer pool,
e.g. v4l2src element. In particular, make sure to traverse through
any additional capsfilter for instance.
Note: the traversal to the top-most upstream element could be made
more generic, but we are insofar only interested in supporting pipes
similar to v4l2src or v4l2src ! capsfilter, e.g. with an explicit
specification for a desired video camera format, or resolution.
Gwenole Beauchesne [Mon, 2 Mar 2015 10:12:53 +0000 (11:12 +0100)]
plugins: fix allocation of DMABUF memory.
The dmabuf allocator would close the DMABUF handle passed in the init
function gst_dmabuf_allocator_alloc(). So, we need to dup() it so that
to avoid a double close, ultimately in the underlying driver that owns
the DMABUF handle.
Víctor Manuel Jáquez Leal [Thu, 26 Feb 2015 10:28:02 +0000 (12:28 +0200)]
vaapidecode: keep src caps and output state in sync
vaapidecode keeps an output state that use the format
GST_VIDEO_FORMAT_ENCODED, while it crafts a different src caps
for a correct negotiation.
I don't see the rational behind this decoupling, it looks like
unnecessary complexity. This patch simplify this logic keeping
in sync the output state and the src caps.
This patch improves the readability of the function
gst_vaapidecode_update_src_caps() and simplify its logic. Also,
the patch validates if the buffer pool has the configuration for
the GL texture upload meta, in order to set the caps feature
meta:GLTextureUpload. Otherwise, the I420 format is set back.
https://bugzilla.gnome.org/show_bug.cgi?id=744618
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Víctor Manuel Jáquez Leal [Thu, 26 Feb 2015 10:26:54 +0000 (12:26 +0200)]
vaapidecode: upload meta only if feature and allocation
When vaapidecode finishes the decoding of a frame and pushes it,
if, in the decide_allocation() method, it is determined if the
next element supports the GL texture upload meta feature, the
decoder adds the buffer's meta.
Nonetheless, in the same spirit of the commit
71d3ce4d, the
determination if the next element supports the GL texture upload
meta needs to check both the preferred caps feature *and* if the
allocation query request the API type.
This patch, first removes the unused variable need_pool, and
determines the attribute has_texture_upload_meta using the
preferred caps feature *and* the allocation query.
Also, the feature passed to GstVaapPluginBase is not longer
determined by has_texture_upload_meta, but by the computed
preferred one.
https://bugzilla.gnome.org/show_bug.cgi?id=744618
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Víctor Manuel Jáquez Leal [Thu, 26 Feb 2015 10:24:55 +0000 (12:24 +0200)]
vaapidecode: delayed src caps negotiation
Currently the src caps are set immediately after the sink caps are set, but in
that moment the pipeline might not fully constructed and the video sink has
not negotiated its supported caps and features. As a consequence, in many cases
of playback, the least optimized caps feature is forced. This is partially the
responsible of bug #744039.
Also, vaapidecode doesn't attend the reconfigure events from downstream,
which is a problem too, since the video sink can be changed with different
caps features.
This patch delays the src caps, setting them until the first frame arrives to
the decoder, assuming until that very moment the whole pipeline is already
negotiated. Particularly, it checks if the src pad needs to be reconfigured,
as a consequence of a reconfiguration event from downstream.
A key part of this patch is the new GstVaapiCapsFeature
GST_VAAPI_CAPS_FEATURE_NOT_NEGOTIATED, which is returned when the src pad
doesn't have a peer yet. Also, for a better report of the caps allowed
through the src pad and its peer, this patch uses gst_pad_get_allowed_caps()
instead of gst_pad_peer_query_caps() when looking for the preferred feature.
v3: move the input_state unref to close(), since videodecoder resets at
some events such as navigation.
v4: a) the state_changed() callback replaces the input_state if the media
changed, so this case is also handled.
b) since the parameter ref_state in gst_vaapidecode_update_src_caps() is
always the input_state, the parameter were removed.
c) there were a lot of repeated code handling the input_state, so I
refactored it with the function gst_vaapi_decode_input_state_replace().
https://bugzilla.gnome.org/show_bug.cgi?id=744618
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Tue, 24 Feb 2015 15:14:33 +0000 (17:14 +0200)]
encoder: h264: add support for more than 2 views
Add support for H.264 MVC Multiview High profile encoding with
more than 2 views. All views within the same accesss unit are
provided in increasing order of view order index (VOIdx).
Upto 10 view are supported for now.
A new property "view-ids" has been provided for the plugins to
set the view ids (which is an array of guint values) to be used
for mvc encoding.
https://bugzilla.gnome.org/show_bug.cgi?id=732453
Víctor Manuel Jáquez Leal [Mon, 23 Feb 2015 15:55:36 +0000 (16:55 +0100)]
plugins: upload meta only if feature and allocation
Working on bug #743687, I realized that vaapidecode always adds to its buffer
pool the config option GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META if
the decide_allocation()'s query has GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE.
Nevertheless, there are occasions where the query has the API type, but the
last negotiated caps don't have the feature meta:GstVideoGLTextureUploadMeta.
Under this contradiction, vaapidecode adds the GLTextureUploadMeta API to its
buffer pool configuration, and adds its buffer's meta to each output buffer,
even if the negotiated caps feature is memory:SystemMemory with I420 color
format.
This kind of output buffers chokes ClutterAutoVideosSink, since it uses a map
that relates caps <-> GL upload method. If it receives a buffer with color
format I420, it assumes that it doesn't have a texture upload meta, because
only those with RGB color format has it. Our buffers, with I420 format, say
that they have the upload meta too. In that case the mapped method is a dummy
one which does nothing. I reported this issue in bug #744039 (the patch,
obviously, was rejected).
This patch workarounds the problem: the buffer pool's configuration option
GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META is set if and only if the
query has the GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE *and* the negotiated
caps feature is meta:GstVideoGLTextureUploadMeta.
I have tested these patches with gst-master (1.5), gst-1.4 and gst-1.2 and
in all they seem to work correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=744618
[adapted to fit current EGL changes]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Gwenole Beauchesne [Fri, 20 Feb 2015 14:13:03 +0000 (15:13 +0100)]
plugins: add support for GstVideoGLTextureOrientation.
Add support for GstVideoGLTextureOrientation modes. In particular,
add orientation flags to the GstVaapiTexture wrapper and the GLX
implementations. Default mode is that texture memory is laid out
with top lines first, left row first. Flags indicate whether the
X or Y axis need to be inverted.
Gwenole Beauchesne [Mon, 9 Feb 2015 20:09:07 +0000 (21:09 +0100)]
plugins: add support for BGRA textures.
Some frameworks (EFL) expect BGRA textures for storage. However,
adding support for that broadly into GStreamer framework implies
two kinds of hacks: (i) libgstgl helpers currently do not support
BGRA textures correctly, (ii) we need to better parse downstream
suggested caps and intersect them with what the VA plugin elements
can offer to them for GL texturing.
Gwenole Beauchesne [Fri, 23 Jan 2015 08:31:57 +0000 (09:31 +0100)]
plugins: fix support for Wayland/EGL running alongside X11.
When multiple display servers are available, the glimagesink element
(from GStreamer 1.4) may not be able to derive a global display in
Wayland. Rather, a "window"-specific display is created. In this case,
the GstGLDisplay handle available through GstGLContext is invalid.
So, try to improve heuristics for display server characterisation in
those particular situations.
Gwenole Beauchesne [Fri, 20 Feb 2015 14:29:17 +0000 (15:29 +0100)]
plugins: add initial support for EGL.
Add initial support for EGL through GstVideoGLTextureUploadMeta.
Fix gst_vaapi_ensure_display() to allocate a GstVaapiDisplay off the
downstream supplied GstGLContext configuration, i.e. use its native
display handle to create a GstVaapiDisplay of type X11 or Wayland ;
and use the desired OpenGL API to allocate the GstVaapiDisplayEGL
wrapper.
https://bugzilla.gnome.org/show_bug.cgi?id=741079
Gwenole Beauchesne [Tue, 9 Dec 2014 10:46:58 +0000 (11:46 +0100)]
plugins: track video texture size changes.
Sync video texture sizes to GstVideoGLTextureUploadMeta private date,
i.e. GstVaapiVideoMetaTexture, on a regular basis. In particular, we
now update the texture size from the GstVideoMeta, if any, or reset
to some defaults otherwise.
Gwenole Beauchesne [Wed, 3 Dec 2014 14:45:52 +0000 (15:45 +0100)]
plugins: ensure VA display matches GL context expectations.
If a GstGLContext is supplied by the downstream element, then make
sure that the VA plugin element gets a compatible display to what
is requested by the GL context. e.g. re-allocate a VA/GLX display
when a GLX context is provided by the downstream element.
Gwenole Beauchesne [Wed, 3 Dec 2014 13:14:30 +0000 (14:14 +0100)]
plugins: record downstream GstGLContext.
Record GL context supplied by downstream elements. This can be useful,
and further needed, to enforce run-time check that the GL context is
compatible for use by libgstvaapi. e.g. check that we don't create a
VA/GLX display for EGL/X11 contexts.
https://bugzilla.gnome.org/show_bug.cgi?id=725643
Original-path-by: Matthew Waters <ystreet00@gmail.com>
Gwenole Beauchesne [Mon, 1 Dec 2014 13:52:39 +0000 (14:52 +0100)]
egl: update tests.
Add initial support for EGL to tests. The new EGL backend can be selected
through the --egl command line option. The OpenGL|ES version can further
be selected with the --gles-version command line option, where the default
of 0 means "desktop" OpenGL.
Gwenole Beauchesne [Tue, 27 Jan 2015 15:21:04 +0000 (16:21 +0100)]
egl: add windowing support.
This provides for some basic EGL window abstraction.
Gwenole Beauchesne [Sat, 24 Jan 2015 07:29:57 +0000 (08:29 +0100)]
egl: add texture abstraction.
Add GstVaapiTextureEGL abstraction that can create its own GL texture,
or import a foreign allocated one, while still allowing updates from a
VA surface.
Gwenole Beauchesne [Tue, 9 Dec 2014 17:14:56 +0000 (18:14 +0100)]
egl: allow for EGLImage imports into VA Surfaces.
Add helpers to import EGLImage objects into VA surfaces. There are
two operational modes: (i) gst_vaapi_surface_new_from_egl_image(),
which allows for implicit conversion from EGLImage to a VA surface
in native video format, and (ii) gst_vaapi_surface_new_with_egl_image(),
which exactly wraps the source EGLImage, typically in RGBA format
with linear storage.
Note: in case of (i), the EGLImage can be disposed right after the
VA surface creation call, unlike in (ii) where the user shall ensure
that the EGLImage is live until the associated VA surface is no longer
needed.
https://bugzilla.gnome.org/show_bug.cgi?id=743847
Gwenole Beauchesne [Fri, 20 Feb 2015 14:27:53 +0000 (15:27 +0100)]
Add initial support for EGL.
Add initial support for EGL to libgstvaapi core library. The target
display server and the desired OpenGL API can be programmatically
selected at run-time.
A comprehensive set of EGL utilities are provided to support those
dynamic selection needs, but also most importantly to ensure that
the GL command stream is executed from within a single thread.
https://bugzilla.gnome.org/show_bug.cgi?id=743846
Gwenole Beauchesne [Fri, 30 Jan 2015 20:38:07 +0000 (21:38 +0100)]
libs: initialize GValues in a thread-safe manner.
Gwenole Beauchesne [Fri, 30 Jan 2015 20:35:10 +0000 (21:35 +0100)]
libs: re-indent all GValue related source code.
Gwenole Beauchesne [Thu, 22 Jan 2015 21:45:24 +0000 (22:45 +0100)]
vaapidecode: partially revert
0777f35.
Reset the VA decoder after updating the base plugin caps, and most
importantly, after GstVideoDecoder negotiation. The reason behind
this is that the negotiation could trigger a last decide_allocation()
where we could actually derive a new GstVaapiDisplay to use from the
downstream element. e.g. GLX backend.
Sreerenj Balachandran [Thu, 19 Feb 2015 11:37:09 +0000 (13:37 +0200)]
vaapidecode: Caps query should return the list of all supported caps.
Query caps filtering should be always done on top of allowed caps instead
of existing fixed caps on a particular pad.
This fixes the mvc stream decoding when there is a base view(high profile)
and non-base view(stereo-high profile).
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 11:36:16 +0000 (13:36 +0200)]
vaapidecode: intersect filter from query caps
According to documentation[1] when receiving a GST_QUERY_CAPS
the return value should be all formats that this elements supports,
taking into account limitations of peer elements further downstream
or upstream, sorted by order of preference, highest preference first.
This patch add those limitations intersecting with the received
filter in the query. Also takes into account the already negotiated
caps. Also adds the processing of the query on the SRC pad.
1. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-nego-getcaps.html
https://bugzilla.gnome.org/show_bug.cgi?id=744406
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:46:11 +0000 (11:46 +0200)]
Fix compiler warnings
This patch fixes some warnings that gcc 4.9 reports.
https://bugzilla.gnome.org/show_bug.cgi?id=744411
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:22:21 +0000 (11:22 +0200)]
vaapidecode: Use GST_DEBUG_FUNCPTR for gst_vaapidecode_query()
Hence the function name is shown in the gst-inspect-1.0 information
rather than the memory address.
https://bugzilla.gnome.org/show_bug.cgi?id=744330
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:21:35 +0000 (11:21 +0200)]
vaapidecode: log flow error name
https://bugzilla.gnome.org/show_bug.cgi?id=744387
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:20:42 +0000 (11:20 +0200)]
VC1: decoder: Ignore VC1 user BDU's
Don't return error if the processed BDU is a user one, just ignore them.
https://bugzilla.gnome.org/show_bug.cgi?id=741237
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Olivier Crete [Wed, 18 Feb 2015 09:19:26 +0000 (11:19 +0200)]
vaapidecode: Emit error GstMessage when returning a GST_FLOW_ERROR
This is required in GStreamer, elements should never return
GST_FLOW_ERROR without posting an ERROR message on the bus.
https://bugzilla.gnome.org/show_bug.cgi?id=744620
Sreerenj Balachandran [Fri, 13 Feb 2015 11:45:32 +0000 (13:45 +0200)]
plugins: Add VP8 Encoder
Sreerenj Balachandran [Fri, 13 Feb 2015 11:42:04 +0000 (13:42 +0200)]
Add VP8 Encoder to core libgstvaapi.
Sreerenj Balachandran [Fri, 13 Feb 2015 11:40:19 +0000 (13:40 +0200)]
configure: Add Check for VP8 Encoding API
Lim Siew Hoon [Tue, 10 Feb 2015 09:40:16 +0000 (11:40 +0200)]
decoder: vc1: Rounding control handling for VC1 simple and Main profile
Added rounding control handling for VC1 simple and Main profile
based on VC1 standard spec: section 8.3.7
https://bugzilla.gnome.org/show_bug.cgi?id=743958
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Sreerenj Balachandran [Fri, 6 Feb 2015 10:10:51 +0000 (12:10 +0200)]
build: fix make dist when certain conditionals not met.
Fix typo which was preventing the inclusion of jpeg encoder
source files from make dist (when there is no jpeg encoder
API support in libva).
Sreerenj Balachandran [Thu, 5 Feb 2015 11:08:53 +0000 (13:08 +0200)]
encoder: jpeg: Fix the sampling factor calculation for ENCODED format.
If the incoming raw video format is GST_VIDEO_FORMAT_ENCODED,
use native YUV420 format (which is i420) as default.
Sreerenj Balachandran [Thu, 5 Feb 2015 10:13:38 +0000 (12:13 +0200)]
encoder: Only support YUV420 native format as input for now
Practically we should be able to support more formats, for eg:
JPEG Encoder can support YUV422, RGBA and all.
But this is causing more issues which need proper fix here and there.
Olivier Crete [Wed, 4 Feb 2015 16:34:59 +0000 (18:34 +0200)]
vaapidecode: Check the condition after taking the lock
Otherwise the condition could become true before the lock
is taken and the g_cond_signal() could be called
before the g_cond_wait(), so the g_cond_wait() is never
awoken.
https://bugzilla.gnome.org/show_bug.cgi?id=740645
Sreerenj Balachandran [Wed, 4 Feb 2015 09:18:29 +0000 (11:18 +0200)]
plugins: Add JPEG encoder element
Sreerenj Balachandran [Wed, 4 Feb 2015 09:17:58 +0000 (11:17 +0200)]
gstvaapicontext: Add VAConfigAttribValEncJPEG to the attribute list using for VAConfig creation.
Sreerenj Balachandran [Wed, 4 Feb 2015 09:17:27 +0000 (11:17 +0200)]
gstvaapicontext: Don't use the unsupported Ratecontrol attributes for vaCreateConfig
Don't add the VAConfigAttribRateControl to the attribute list using
for the vaCreateConfig if it is not supported by the driver.
Sreerenj Balachandran [Wed, 4 Feb 2015 09:17:06 +0000 (11:17 +0200)]
gstvaapiencoder: Use hardcoded packed_raw_data flag for JPEG Encoding
Sreerenj Balachandran [Wed, 4 Feb 2015 09:16:37 +0000 (11:16 +0200)]
gstvaapiencoder: Fix crash when handling rate control mask
Having a ratecontrol_mask equal to zero is not a bug, but the driver
might not be supporting any kind of rate control mechanisms.
Eg: JPEG Encoding