Commit graph

3761 commits

Author SHA1 Message Date
He Junyan
18f530978b plugins: postproc: Fix a problem of propose_allocation when passthrough.
We should query the downstream element to answer a precise allocation
query when the passthrough mode is enabled.
The current way still decides the allocation by the postproc itself. The
pipeline such as:
  gst-launch-1.0 -v filesrc location=xxx.264 ! h264parse ! vaapih264dec ! \
  vaapipostproc ! fakevideosink silent=false sync=true
will lose some info such as the GST_VIDEO_META_API_TYPE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/413>
2021-02-04 08:59:28 +00: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
Víctor Manuel Jáquez Leal
a16849b4ed vaapi: use gst_clear_object instead of g_clear_object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/406>
2020-12-12 10:38:17 +01:00
He Junyan
5bee089331 plugins: encode: unlock the stream lock before _flush()
The current encoder will hang when EOS comes. When we call the
gst_vaapi_encoder_encode_and_queue(), we should release the stream
lock, just like what we do in gst_vaapiencode_handle_frame().

The deadlock happens when: The input thread holding the stream lock
is using gst_vaapi_encoder_create_coded_buffer() to acquire a coded
buffer, while the output thread which holding the coded buffer resource
is acquiring the stream lock in _push_frame() to push the data to
down stream element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/404>
2020-12-11 18:02:34 +00: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
eb9be73299 plugin: encode: vp9: Implement the set_config().
We store the allowed profiles list to encoder in set_config().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
2020-11-30 16:45:54 +00:00
He Junyan
33ef4ec817 plugin: encode: vp9: Add the profile into output caps.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
2020-11-30 16:45:54 +00: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
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