Commit graph

3730 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal 27427c00c0 decoder: don't reply src caps query with allowed if pad is fixed
If the pad is already fixed the caps query have to be reply with the
current fixed caps. Otherwise the query has to be replied with the
autogeneratd src caps.

This path fix this by falling back to the normal caps query processing
if the pad is already fixed. Otherwise it will fetch the allowed src
pad caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/397>
2020-09-20 10:02:16 +02:00
He Junyan 6305acc9d3 plugins: decode: fix a DMA caps typo in ensure_allowed_srcpad_caps.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/392>
2020-09-15 00:11:30 +08:00
Marc Leeman 629154642f vaapisink: when updating the caps, reset rotation
When an element upstream changes settings (e.g. crop), new caps are sent
to vaapisink. When vaapisink was rotating the image, it needs to
re-evaluate if the sink needs to rotate the image.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/389>
2020-09-09 16:51:54 +00:00
Tim-Philipp Müller 0818af088b ci: include template from gst-ci master branch again 2020-09-08 17:31:02 +01:00
Tim-Philipp Müller ff5b204561 Back to development 2020-09-08 16:59:07 +01:00
Tim-Philipp Müller de6fb60929 Release 1.18.0 2020-09-08 00:09:52 +01:00
Sebastian Dröge 69fbe8c84c Update for gst_video_transfer_function_*() function renaming
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/391>
2020-09-07 12:50:11 +03:00
Víctor Manuel Jáquez Leal f822366f92 Revert "libs: decoder: h264, h265: in context at least 16 reference surfaces"
This reverts commit b387081a4d as discussed in
b387081a4d
2020-08-22 12:57:54 +02:00
Tim-Philipp Müller 0320e7a3b6 Release 1.17.90 2020-08-20 16:16:25 +01:00
Víctor Manuel Jáquez Leal c080ee6dc9 libs: surface: egl: guard memory type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/384>
2020-08-18 08:11:27 +00:00
He Junyan 5c21736903 plugin: decode: Fix two mem leaks because of caps.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/385>
2020-08-17 19:27:11 +08:00
He Junyan 3540dcf4d9 plugin: allocator: No need to ref allocator when create mem.
We do not need to ref the allocator when creating GstVaapiVideoMemory
kind memory, and then release it in _free(). The framework already
does it for us.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/383>
2020-08-16 01:57:15 +08:00
Víctor Manuel Jáquez Leal ae6d4f3969 vaapiencode: h264: ignore level without breaking negotiation
Since commit 9f627ef2 if the user sets level in the encoder src caps
the caps negotiation is rejected.

But since the same commit the same encoder set the autoconfigured
level in caps. Some change in the base class might fixed the operation
order so now the caps are set and later negotiated.

This patch removes the level check.

Fixes: #273
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/382>
2020-08-14 11:08:54 +00:00
Víctor Manuel Jáquez Leal 7a3b25884c libs: egl: surface: export EGLImage as DMABuf if GEM not supported
This code path is used when frames are rendered as textures through
GstVideoGLTextureUploadMeta with EGL, mainly under Wayland.

Originally the EGLImage was exported as GEM, which was handled by
Intel drivers, but Gallium ones cannot create VA surfaces from
GEM buffers, only DMABuf.

This patch checks the memory types supported by VA driver to choose
the render the EGLImages from GEM or DMABuf, because GEM is still
better where supported.

DMABuf is well handled either by intel-vaapi-driver and gallium.

Fixes: #137
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/122>
2020-08-14 12:43:20 +02:00
Víctor Manuel Jáquez Leal 992d9e3a20 libs: filter: gst_vaapi_filter_get_memory_types()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/122>
2020-08-14 12:31:37 +02:00
Víctor Manuel Jáquez Leal 089ef59c37 plugins: remove gst_vaapi_plugin_base_get_allowed_srcpad_raw_caps()
Since nobody uses it, just remove it.

Thus extract_allowed_surface_formats() is refactored to attend only
gst_vaapi_plugin_base_get_allowed_sinkpad_raw_caps().

Now a surface is created when the image chorma is different from the
previous one. And if the driver has the quirk, it outputs all the
supported image formats without trying them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/381>
2020-08-12 18:48:59 +02:00
Víctor Manuel Jáquez Leal a50b466fc7 vaapidecode: expose raw src caps with same chroma
The try-and-error approach for getting the possible image formats from
a surface has brought several problems in different drivers, from
crashes to drop in performance.

Instead of that we change the algorithm to determine the possible
image formats based in the surface chroma: only those available image
formats with same chroma are exposed as possible raw caps.

Do this is important to avoid performance degrading in raw sinks
which doesn't handle NV12 but it does YV12 or I420.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/381>
2020-08-12 17:50:50 +02:00
He Junyan 30290115af libs: util: h265: use common parser API to get vaapi profiles.
We can reuse H265 parser's API to recognize the correct profile and
then just need to convert them to VAAPI profiles.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/356>
2020-08-08 19:28:15 +08:00
Víctor Manuel Jáquez Leal 3e9a6f80aa build: update for gl pkg-config file split
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/378>
2020-08-07 17:30:21 +02:00
Xu Guangxin 34b1d195b7 h264dec: mark remaining frames as unreference before exec_picture_refs_modification
8.2.4.2 required this. Some clips will crash if we do not fill the reference list like this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/376>
2020-08-06 14:13:56 +08:00
He Junyan 55769a16c7 libs: encoder: H265: Enable Main 12 profile support.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/375>
2020-08-06 00:21:50 +08:00
He Junyan 6e97062d35 video format: Fix P012_LE's chrome type typo.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/375>
2020-08-06 00:21:36 +08:00
Jordan Petridis 89580cc230 gstvaapiminiobject.c: fix clang 10 warnings
the typesystem checks in g_atomic_pointer_compare_and_exchange
seem to trigger some false positives with clang 10

similar to gstreamer!584

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/377>
2020-08-04 21:15:01 +03:00
Michael Olbrich 887ba40e65 libs: window: wayland: destroy all wayland buffers during finalize
Some buffers and the associated FrameState state may still be pending at
that point. If the wayland connection is shared, then messages for the
buffer may still arrive. However, the associated event queue is already
deleted. So the result is a crash.

With a private connection the associated memory is leaked instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:34 +02:00
Michael Olbrich d11ba513bb test: vaapicontext: fix draw callback with multiple videos
The callback is called for both windows. So make sure that
gst_video_overlay_set_render_rectangle() is called for the correct one.
Otherwise, the left video will be randomly moved behind the right video.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Michael Olbrich 24be7b8aae test: vaapicontext: support wayland display
On Wayland, The whole gtk window is one Wayland surface. So
gtk_widget_get_window() must be called on the top-level widget.
For any other widget the following gdk_window_ensure_native() may create a
new top-level Wayland surface that is never visible.

As a result, the coordinates passed to
gst_video_overlay_set_render_rectangle() must be relativ to the top-level
window. Otherwise the video is placed incorrectly.

Original-Patch-By: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Víctor Manuel Jáquez Leal 283fceac0b test: vaapicontext: use playbin to test files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Víctor Manuel Jáquez Leal 672b2dd991 test: vaapicontext: add PLAY and NULL buttons
They only appear when only one sink is instanciated and their purpose
is to test the NULL-PLAY use case in context sharing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Michael Olbrich 9eb25ab849 libs: wayland: update the opaque region in set_render_rect
gst_vaapi_window_wayland_set_render_rect() may be called from an arbitrary
thread. That thread may be responsible for making the window visible.

At that point another thread will block in gst_vaapi_window_wayland_sync()
because the frame callback will not be called until the window is visible.

If that happens, then acquiring the display lock in
gst_vaapi_window_wayland_set_render_rect() would result in a deadlock.

Cache the size of the opaque rectangle separately and create the opaque
region right before applying it to the surface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Hyunjun Ko a362d99e9e libs: window: implements gst_vaapi_window_set_render_rectangle
Implements new vmethod gst_vaapi_window_set_render_rectangle,
which is doing set the information of the rendered rectangle set by
user.
This is necessary on wayland at least to get exact information of
external surface.

And vaapisink calls this when gst_video_overlay_set_render_rectangle is
called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Hyunjun Ko a5f37a21ec vaapisink: implements gst_vaapisink_wayland_create_window_from_handle()
Implements gst_vaapisink_wayland_create_window_from_handle() to support
using external wl_surface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Michael Olbrich 40364c2c09 libs: wayland: implement video overlay API
The Wayland sub-surfaces API is used to embed the video into an application
window.

See Appendix A. Wayland Protocol Specification as the following.

"""
The aim of sub-surfaces is to offload some of the compositing work
within a window from clients to the compositor. A prime example is
a video player with decorations and video in separate wl_surface
objects.

This should allow the compositor to pass YUV video buffer processing to
dedicated overlay hardware when possible.
"""

Added new method gst_vaapi_window_wayland_new_with_surface()

Original-Patch-By: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
                   Zhao Halley <halley.zhao@intel.com>
                   changzhix.wei@intel.com
                   Hyunjun Ko <zzoon@igalia.com>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 14:02:33 +02:00
Michael Olbrich 3d1cf3a6da doc: libs: wayland: add 'transfer full' to the returnvalye of gst_vaapi_window_wayland_new
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 11:14:44 +02:00
Michael Olbrich 07aadb82fb libs: display: always call close_display()
All close_display() have their own checks for use_foreign_display and only
destroy locally created objects in that case.
Without this objects other than the actuall foreign display itself are
leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
2020-07-31 11:14:43 +02:00
He Junyan 5902e5bfdb video-format: Add the missing P012_LE into GST_VAAPI_FORMATS_ALL.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/373>
2020-07-31 08:38:10 +00:00
Víctor Manuel Jáquez Leal 99ac072673 plugins: add gst_vaapi_caps_set_width_and_height_range()
This utility function is called internally by
gst_vaapi_build_caps_from_formats() and can be used outside.

This function sets frame size and framerates ranges.

Also gst_vaapi_build_caps_from_formats() is simplified.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/374>
2020-07-31 10:14:34 +02:00
He Junyan 6ab488475a libs: decoder: fix a crash issue when get_surface_formats.
Some context does not report any valid format that we can support.
For example, the HEVC 444 12 bits decoder context, all the formats
it reports is not supported now, which make the formats list a NULL
array. We should check that pointer before we use it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/372>
2020-07-31 15:27:38 +08:00
He Junyan 7a9a99d0c4 libs: encoder: h265: choose the profile based on allowed list.
We can decide the profile in ensure_profile(), based on allowed list
passed by the encode. We also need to check whether the entrypoint is
available. Once it is decided, no need to check the hw entrypoint
them again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/349>
2020-07-30 18:51:51 +08:00
He Junyan 2bb6e8c813 plugins: encode: h265: set all allowed profiles to encoder.
We should collect all allowed profiles and pass them to the inside
encoder, rather than just calculate the max profile idc.
The allowed profiles should also be supported by the HW.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/349>
2020-07-30 17:48:03 +08:00
He Junyan 65c8718f5e libs: display: Add a helper function to get profiles by codec.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/349>
2020-07-30 17:46:24 +08:00
He Junyan 38db4bc15e plugins: encode: h265: collect all allowed profiles to encoder.
We should collect all allowed profiles and pass them to the inside
encoder, rather than just calculate the max profile idc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/349>
2020-07-30 17:45:39 +08:00
He Junyan 3554f06235 libs: encoder: h265: modify set_max_profile to set_allowed_profiles.
In h265, bigger profile idc may not be compatible with the small profile
idc. And more important, there are multi profiles with the same profile
idc. Such as main-422-10, main-444 and main-444-10, they all have profile
idc 4.
So recording the max profile idc is not enough, the encoder needs to know
all allowed profiles when deciding the real profile.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/349>
2020-07-30 17:42:49 +08:00
He Junyan 579aa4cab1 libs: encoder: h265: No need to check hw_max_profile.
In h265, higher profile idc number does not mean better compression
performance and may be not compatible with the lower profile idc.
So, it is not suitable to find the heighest idc for hw to ensure the
compatibility.

On the other side, when the entrypoint of the selected profile is valid,
it means the hw really support this profile, no need to check it again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/349>
2020-07-30 17:41:53 +08:00
Víctor Manuel Jáquez Leal daecc5bfa1 vaapipostproc: early return if fixate srcpad caps fails
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/371>
2020-07-29 16:59:06 +00:00
Víctor Manuel Jáquez Leal 80b1e53ccc vaapipluginutil: simplify gst_vaapi_find_preferred_caps_feature()
Generalize the way how the preferred color format is chosen. Also
use new GStreamre API as syntatic sugar.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/370>
2020-07-29 16:41:58 +00:00
He Junyan cf3b0120cb libs: profile: Use get_codec_from_caps to get codec type.
There is no need to get a profile from the caps and then convert
that profile into codec type. We can get the codec type by caps's
name easily.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/358>
2020-07-29 16:17:35 +00:00
He Junyan 7acc3c4db8 libs: profile: h265: Fix return value of from_codec_data_h265.
profile_from_codec_data_h265() returns wrong GstVaapiProfile for h265.
The codec data of caps contain the profile IDC, but the mapping between
profile IDC and GstVaapiProfile is wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/358>
2020-07-29 16:17:35 +00:00
He Junyan 35c3de234c plugins: encode: vp9: Implement vp9's allowed_profiles() func.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/188>
2020-07-29 15:41:40 +00:00
He Junyan b86489eb8c plugin: util: rename h26x_encoder_get_profiles_from_caps().
Change its name to encoder_get_profiles_from_caps(). Other codecs such
as VP9 also needs to use this function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/188>
2020-07-29 15:41:40 +00:00
He Junyan ed55dd8df1 libs: utils: vpx: Add utils vpx to handle VP8/9 misc things.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/188>
2020-07-29 15:41:40 +00:00