Commit graph

2257 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
3d8e5e59a7 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>
2015-02-26 12:28:02 +02:00
Víctor Manuel Jáquez Leal
e4f8d14979 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>
2015-02-26 12:26:54 +02:00
Víctor Manuel Jáquez Leal
9799875df4 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>
2015-02-26 12:24:55 +02:00
Sreerenj Balachandran
3f28da7f5a 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
2015-02-24 17:14:33 +02:00
Víctor Manuel Jáquez Leal
71d3ce4de2 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>
2015-02-24 15:28:26 +01:00
Gwenole Beauchesne
6a465ae793 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.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
8c93c842ef 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.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
7343ce41cd 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.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
60e96e80cc 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
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
44013fdaf0 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.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
9aa5eac5e3 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.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
d9c082168b 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>
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
8d4498f9fd 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.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
aabb8c99c2 egl: add windowing support.
This provides for some basic EGL window abstraction.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
23c489d8ee 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.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
a9fe79610a 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
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
1e7c4db5a7 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
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
91c5d948be libs: initialize GValues in a thread-safe manner. 2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
11b02b05e5 libs: re-indent all GValue related source code. 2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
9b9878c96d 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.
2015-02-24 15:20:03 +01:00
Sreerenj Balachandran
82e12a933e 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).
2015-02-19 13:37:09 +02:00
Víctor Manuel Jáquez Leal
7ca0591759 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
2015-02-18 13:36:16 +02:00
Víctor Manuel Jáquez Leal
671b1ea305 Fix compiler warnings
This patch fixes some warnings that gcc 4.9 reports.

https://bugzilla.gnome.org/show_bug.cgi?id=744411
2015-02-18 11:46:11 +02:00
Víctor Manuel Jáquez Leal
ce4d3355e1 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
2015-02-18 11:22:21 +02:00
Víctor Manuel Jáquez Leal
ee0855dc65 vaapidecode: log flow error name
https://bugzilla.gnome.org/show_bug.cgi?id=744387
2015-02-18 11:21:35 +02:00
Víctor Manuel Jáquez Leal
481d6b1f25 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>
2015-02-18 11:20:42 +02:00
Olivier Crete
aaf4165819 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
2015-02-18 11:19:26 +02:00
Sreerenj Balachandran
a664a479a8 plugins: Add VP8 Encoder 2015-02-13 13:45:32 +02:00
Sreerenj Balachandran
eeefdb4958 Add VP8 Encoder to core libgstvaapi. 2015-02-13 13:42:04 +02:00
Sreerenj Balachandran
8145fbf700 configure: Add Check for VP8 Encoding API 2015-02-13 13:40:19 +02:00
Lim Siew Hoon
6edb173486 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>
2015-02-10 11:40:16 +02:00
Sreerenj Balachandran
004968f506 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).
2015-02-06 12:10:51 +02:00
Sreerenj Balachandran
6b73746ab6 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.
2015-02-05 13:08:53 +02:00
Sreerenj Balachandran
0f40843bb3 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.
2015-02-05 12:13:38 +02:00
Olivier Crete
fc7e6b19fd 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
2015-02-04 18:34:59 +02:00
Sreerenj Balachandran
d2e2784a78 plugins: Add JPEG encoder element 2015-02-04 11:18:29 +02:00
Sreerenj Balachandran
4c7c858374 gstvaapicontext: Add VAConfigAttribValEncJPEG to the attribute list using for VAConfig creation. 2015-02-04 11:17:58 +02:00
Sreerenj Balachandran
7a84b06097 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.
2015-02-04 11:17:27 +02:00
Sreerenj Balachandran
beefadc7b7 gstvaapiencoder: Use hardcoded packed_raw_data flag for JPEG Encoding 2015-02-04 11:17:06 +02:00
Sreerenj Balachandran
3332c25ef6 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
2015-02-04 11:16:37 +02:00
Sreerenj Balachandran
0609fad69c encoder: Add JPEG Encoder 2015-02-04 11:16:05 +02:00
Sreerenj Balachandran
f8020bb03e encoder_objects: Add QuantizationMatrix and JPEGHuffmanTable 2015-02-04 11:15:38 +02:00
Sreerenj Balachandran
d48ab9a3d6 Encode: Add support for Picture level Entrypoint
This is useful for JPEG encoding which is utilizing picture level
entrypoint instead of slice level entrypoint like h264,mpeg2 etc.
2015-02-04 11:15:00 +02:00
Sreerenj Balachandran
4197c8de17 configure: Add Check for JPEG encoding API 2015-02-04 11:14:15 +02:00
Sreerenj Balachandran
bb1b147180 AUTHORS: Updates 2015-02-03 13:08:53 +02:00
Sreerenj Balachandran
b6dece082c Bump version for development. 2015-02-03 13:08:01 +02:00
Sreerenj Balachandran
a14ed0a78e 0.5.10 2015-02-03 10:00:42 +02:00
Sreerenj Balachandran
a49187ab39 NEWS: Updates 2015-02-03 10:00:23 +02:00
Sreerenj Balachandran
b328e880fe Fix compilation error if there is no GL/gl.h header file installed 2015-02-02 11:43:58 +02:00
Gwenole Beauchesne
da6b88692f plugins: drop leftover declaration.
GstVaapiVideoMemory quark is not needed any more, and the actual
implementation was already removed bfore the merge. i.e. this is
an oversight for a hunk that was not meant to be pushed.
2015-01-28 18:09:40 +01:00