Commit graph

1933 commits

Author SHA1 Message Date
He Junyan
993d46bb2f decoder: H265: Enable cu_qp_delta_enabled_flag when ROI
If ROI is enabled, the CUs within the ROI region may have different
QP from the other part of the picture. This needs us to enable the
cu_qp_delta_enabled_flag even in the CQP mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/419>
2021-03-22 13:43:01 +08:00
Matthew Waters
d270654c48 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/418>
2021-03-19 19:03:54 +11:00
Paul Goulpié
e1f6c37b46 gstvaapiencoder_h264: add ENCODER_EXPOSURE on aud propertie
forgot during the following mainline commit: bc2f8fd19e#

Signed-off-by: Paul Goulpié <paul.goulpie@ubicast.eu>
2021-02-27 22:48:57 +01:00
Haihao Xiang
4ff4bcd725 libs: display: drm: support gst.vaapi.app.Display context for drm backend
Attributes for drm backend:
- va-display : ponter of VADisplay
- drm-device-fd : the DRM device file descriptor

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/409>
2021-01-29 14:08:42 +00:00
Haihao Xiang
85284f4aac libs: display: drm: allow user specify a drm device via an env variable
Currently the default drm device is always used on a system with
multiple drm devices. This patch allows user to specify the required
drm device via GST_VAAPI_DRM_DEVICE env variable

Example:
GST_VAAPI_DRM_DEVICE=/dev/dri/renderD129 gst-launch-1.0 videotestsrc !
vaapih264enc ! fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/409>
2021-01-29 14:08:42 +00:00
Haihao Xiang
23967fc02b libs: display: drm: fix set_device_path_from_fd
drmGetBusid() (GET_UNIQUE ioctl) won't return a valid bus id when
drmSetInterfaceVersion() (SET_VERSION ioctl) hasn't been called(see[1]),
so we can't get the right device path. Running test-display will get the
error below:

** (test-display:18630): ERROR **: 10:26:00.434: could not create Gst/VA
display

Calling drmSetInterfaceVersion() before drmGetBusid() can't fix this
issue because a special permission is required for SET_VERSION ioctl.

This patch retrieves the device path from file descriptor via
g_file_read_link()

[1] https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/drm_ioctl.c#L48-L104

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/412>
2021-01-28 09:48:56 +08:00
Rafał Dzięgiel
c4e76d6fc5 glx: Iterate over FBConfig and select 8 bit color size
Texture upload mechanism used by gstreamer-vaapi relies on 8 bpc.
In latest mesa versions the first fbconfig might not be 8 bit, so iterate
over it to find the correct config with supported values.

This also adds 8 bit alpha size to the framebuffer configuration which is
required to get it working properly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/410>
2021-01-20 10:42:09 +01:00
Ung, Teng En
a0a8b8785e vaapipostproc: fix code style.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/407>
2021-01-11 11:01:57 +00:00
Ung, Teng En
a354c14e58 vaapipostproc: Remove YUV to/from RGB color primary quirk since iHD driver has fixed in
a39fe9bc05.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/407>
2021-01-11 11:01:57 +00:00
Ung, Teng En
4ccb37fe37 vaapipostproc: Added gstreamer BT2020 color standard support.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/407>
2021-01-11 11:01:57 +00:00
He Junyan
5e3fde8569 decoder: AV1: Fix a static analysis problem of update_state().
No need to check the picture pointer after we have already dereferenced it.

Fix: #298
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/408>
2021-01-09 21:01:16 +08:00
He Junyan
5523b75550 libs: decoder: Add decode_with_surface_id for AV1 film_grain.
The AV1 film_graim feature needs two surfaces the same time for
decoding. One is for recon surface which will be used as reference
later, and the other one is for display. The GstVaapiPicture should
contain the surface for display, while the vaBeginPicture() need
the recon surface as the target.
We add a gst_vaapi_picture_decode_with_surface_id API to handle this
kind of requirement.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/191>
2021-01-06 00:08:10 +08:00
He Junyan
0a34b6882e libs: decoder: AV1: Add the av1 decoder support.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/191>
2021-01-06 00:08:01 +08:00
He Junyan
46c1f3875a libs: codecobject: Add number of elements when create codec object.
One slice data may need several slice parameter buffers at one time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/191>
2020-12-14 18:43:52 +08:00
He Junyan
5997093ba1 libs: encoder: H264: Fix one assert in get_pending_reordered().
gst_vaapi_encoder_h264_get_pending_reordered() does not consider the
case for HIERARCHICAL_B mode. The pipeline:

gst-launch-1.0  videotestsrc num-buffers=48 ! vaapih264enc prediction-type=2 \
keyframe-period=32 ! fakesink

get a assert:

ERROR:../gst-libs/gst/vaapi/gstvaapiencoder_h264.c:1996:reflist1_init_hierarchical_b:
assertion failed: (count != 0)

The last few B frames are not fetched in correct order when HIERARCHICAL_B
is enabled.

We also fix a latent bug for normal mode. The g_queue_pop_tail() of B frames
make the last several frames encoded in reverse order. The NAL of last few
frames come in reverse order in the bit stream, though it can still output
the correct image.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/405>
2020-12-09 01:26:26 +08:00
He Junyan
dfc730165c libs: encoder: H265: Add screen content coding extensions support.
In scc mode, the I frame can ref to itself and it needs the L0 reference
list enabled. So we should set the I frame to P_SLICE type. We do not need
to change the ref_pic_list0/1 passed to VA driver, just need to enable the
VAEncPictureParameterBufferHEVC->pps_curr_pic_ref_enabled_flag to notify
the driver consider the current frame as reference. For bits conformance,
the NumRpsCurrTempList0 should be incremented by one to include the current
picture as the reference frame. We manually do it when packing the slice header.

Command line like:
gst-launch-1.0  videotestsrc num-buffers=10 ! \
capsfilter caps=video/x-raw,format=NV12, framerate=30/1,width=640,height=360 ! \
vaapih265enc ! capsfilter caps=video/x-h265,profile="{ (string)screen-extended-main }" ! \
filesink location=out.265
Can be used to specify that the encoder should use SCC profiles.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/379>
2020-12-06 23:37:56 +08:00
He Junyan
1725e47700 libs: encoder: vp9: no need to ensure_hw_profile.
Once we decide the profile and can get the valid entrypoint for
that profile, hw must already support this profile/entrypoint pair.
No need to check it again in set_context_info().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
2020-11-30 16:45:54 +00:00
He Junyan
a639528217 libs: encoder: vp9: Improve the manner to decide the profile.
We should decide the VP9 encoder's profile based on the chroma and
depth of the input format, then make sure it is included in the
allowed list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
2020-11-30 16:45:54 +00:00
He Junyan
ff829c660b libs: util: vpx: add get_chroma_format_idc for VP9
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
2020-11-30 16:45:54 +00:00
He Junyan
973b879f95 libs: encoder: vp9: Add allowed_profiles.
We need the allowed_profiles to store the allowed profiles in down
stream's caps.
Command line like:
  vaapivp9enc ! capsfilter caps=video/x-vp9,profile="{ (string)1, \
    (string)3 }"
We need to store GST_VAAPI_PROFILE_VP9_1 and GST_VAAPI_PROFILE_VP9_3
in this list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
2020-11-30 16:45:54 +00:00
He Junyan
ba58557c14 libs: decoder: H265: Fix a typo in scc reference setting.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/402>
2020-11-30 18:00:38 +08:00
He Junyan
d94b864428 libs: decoder: H265: Add MAIN_422_12 profile supporting.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/390>
2020-11-27 14:29:01 +00:00
He Junyan
ec68ec518b video-format: Add Y212_LE format.
It can be used as HEVC YUV_4:2:2 12bits stream's decoder output, and
also can be used as the input format for encoding HEVC YUV_4:2:2 12bits
stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/390>
2020-11-27 14:29:01 +00:00
He Junyan
8af9b46748 libs: decoder: H265: Add MAIN_444_12 profile supporting.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/390>
2020-11-27 14:29:01 +00:00
He Junyan
92b30ffa1a video-format: Add Y412_LE format.
It can be used as HEVC YUV_4:4:4 12bits stream's decoder output, and
also can be used as the input format for encoding HEVC YUV_4:4:4 12bits
stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/390>
2020-11-27 14:29:01 +00:00
He Junyan
ed9a708397 libs: decoder: h265: fill missing predictor_palette_size field.
The predictor_palette_size of VAPictureParameterBufferHEVCScc is
forgotten and need to be filled when streams have palettes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/396>
2020-11-15 12:39:22 +00:00
He Junyan
d72f818029 libs: utils: h265: Use get_profile_from_sps to get profile.
We now use gst_h265_get_profile_from_sps() to replace the old way
of gst_h265_profile_tier_level_get_profile() to get more precise
profile. The new function consider the unstandard cases and give
a more suitable profile decision.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/395>
2020-10-30 07:24:44 +00:00
Víctor Manuel Jáquez Leal
865a46b193 libs: decoder: vp9: 0xff segment pred probs if no temporal update
According to the spec (6.2.11 Segmentation params syntax)
segmentation_pred_prob[i] ast to be 0xff if not temporal_update.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/400>
2020-10-19 16:45:35 +02:00
Víctor Manuel Jáquez Leal
08b4aaa7fa libs: decoder: vp9: avoid reference rewriting
The removed code set all the reference frames to the current frame it is a key
one, but later, all the reference frames were rewritten with the decoded picture
buffers or VA_INVALID_SURFACE if they were not available.

Basically, all this time the first reference frame assignment has been ignored,
and it's not described by the spec, and this patch removes that code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/400>
2020-10-19 13:42:53 +02: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
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
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
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
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
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
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
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