platform/upstream/gstreamer.git
3 years agodoc: libs: wayland: add 'transfer full' to the returnvalye of gst_vaapi_window_waylan...
Michael Olbrich [Fri, 19 Jun 2020 19:54:52 +0000 (21:54 +0200)]
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>

3 years agolibs: display: always call close_display()
Michael Olbrich [Thu, 11 Jun 2020 06:25:57 +0000 (08:25 +0200)]
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>

3 years agovideo-format: Add the missing P012_LE into GST_VAAPI_FORMATS_ALL.
He Junyan [Thu, 30 Jul 2020 15:37:10 +0000 (23:37 +0800)]
video-format: Add the missing P012_LE into GST_VAAPI_FORMATS_ALL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/373>

3 years agoplugins: add gst_vaapi_caps_set_width_and_height_range()
Víctor Manuel Jáquez Leal [Mon, 25 May 2020 15:02:26 +0000 (17:02 +0200)]
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>

3 years agolibs: decoder: fix a crash issue when get_surface_formats.
He Junyan [Fri, 31 Jul 2020 07:27:38 +0000 (15:27 +0800)]
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>

3 years agolibs: encoder: h265: choose the profile based on allowed list.
He Junyan [Fri, 3 Jul 2020 11:28:28 +0000 (19:28 +0800)]
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>

3 years agoplugins: encode: h265: set all allowed profiles to encoder.
He Junyan [Wed, 29 Jul 2020 14:05:41 +0000 (22:05 +0800)]
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>

3 years agolibs: display: Add a helper function to get profiles by codec.
He Junyan [Wed, 29 Jul 2020 14:32:55 +0000 (22:32 +0800)]
libs: display: Add a helper function to get profiles by codec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/349>

3 years agoplugins: encode: h265: collect all allowed profiles to encoder.
He Junyan [Thu, 2 Jul 2020 17:28:28 +0000 (01:28 +0800)]
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>

3 years agolibs: encoder: h265: modify set_max_profile to set_allowed_profiles.
He Junyan [Thu, 2 Jul 2020 16:53:31 +0000 (00:53 +0800)]
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>

3 years agolibs: encoder: h265: No need to check hw_max_profile.
He Junyan [Thu, 2 Jul 2020 15:33:31 +0000 (23:33 +0800)]
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>

3 years agovaapipostproc: early return if fixate srcpad caps fails
Víctor Manuel Jáquez Leal [Wed, 8 Apr 2020 17:41:09 +0000 (19:41 +0200)]
vaapipostproc: early return if fixate srcpad caps fails

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/371>

3 years agovaapipluginutil: simplify gst_vaapi_find_preferred_caps_feature()
Víctor Manuel Jáquez Leal [Wed, 29 Jul 2020 11:39:44 +0000 (13:39 +0200)]
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>

3 years agolibs: profile: Use get_codec_from_caps to get codec type.
He Junyan [Wed, 29 Jul 2020 06:22:18 +0000 (14:22 +0800)]
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>

3 years agolibs: profile: h265: Fix return value of from_codec_data_h265.
He Junyan [Sun, 12 Jul 2020 11:42:40 +0000 (19:42 +0800)]
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>

3 years agoplugins: encode: vp9: Implement vp9's allowed_profiles() func.
He Junyan [Mon, 6 Jul 2020 16:46:23 +0000 (00:46 +0800)]
plugins: encode: vp9: Implement vp9's allowed_profiles() func.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/188>

3 years agoplugin: util: rename h26x_encoder_get_profiles_from_caps().
He Junyan [Wed, 8 Jul 2020 08:30:17 +0000 (16:30 +0800)]
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>

3 years agolibs: utils: vpx: Add utils vpx to handle VP8/9 misc things.
He Junyan [Mon, 6 Jul 2020 15:35:12 +0000 (23:35 +0800)]
libs: utils: vpx: Add utils vpx to handle VP8/9 misc things.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/188>

3 years agolibs: display, context: handle broken jpeg decoder for i965 driver
Víctor Manuel Jáquez Leal [Wed, 29 Jul 2020 08:17:31 +0000 (10:17 +0200)]
libs: display, context: handle broken jpeg decoder for i965 driver

JPEG decoding in i965 driver is pretty much broken, and the driver is
deprecated which mean authors only accept trivial fixes.

Surfaces for JPEG decoder context in i965 only handle IMC3[1] color
format which is not a common format in GStreamer. It can export it to
I420 at mapping raw bytes, but DMABuf exporting is problematic.

This patch artificially adds NV12 to the context format list when it's
JPEG decoder for i965 and force the usage of old VA-API for surface
creation without specifying color format. Also it artificially
disables the DMABuf announcement.

1. https://docs.microsoft.com/en-us/windows/win32/medfound/recommended-8-bit-yuv-formats-for-video-rendering#420-formats-16-bits-per-pixel

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/369>

3 years agolibs: context: change function to internal code style
Víctor Manuel Jáquez Leal [Wed, 29 Jul 2020 10:02:50 +0000 (12:02 +0200)]
libs: context: change function to internal code style

Instead of a getter the function `get_preferred_format()` to
`ensure_preferred_format()` which aligns to the code style.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/369>

3 years agovaapidecode: always merge profile caps in sink caps
Víctor Manuel Jáquez Leal [Tue, 28 Jul 2020 18:00:09 +0000 (20:00 +0200)]
vaapidecode: always merge profile caps in sink caps

This commit fixes a regression of e962069d, where if the profile's
caps doesn't have a caps profile, it's ignored.

This patch add a conditional jump if the caps doesn't have a profile
field to merge it.

Fixes: #271
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/368>

3 years agobuild: request libdrm >= 2.4.98 and fallback
Víctor Manuel Jáquez Leal [Tue, 28 Jul 2020 10:22:40 +0000 (12:22 +0200)]
build: request libdrm >= 2.4.98 and fallback

Fixes: #270
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/367>

3 years agovaapidecode: dma caps only use reported color format
Víctor Manuel Jáquez Leal [Mon, 18 May 2020 15:32:27 +0000 (17:32 +0200)]
vaapidecode: dma caps only use reported color format

This fix pipelines without vaapipostproc after vaapi decoder, such as

gst-launch-1.0 filesrc location=~/file.mp4 ! parsebin ! vaapih264dec ! glimagesink

On EGL platforms, so DMABuf is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/366>

3 years agovaapidecode: use allowed srcpad caps for caps query
Víctor Manuel Jáquez Leal [Fri, 7 Feb 2020 16:10:45 +0000 (17:10 +0100)]
vaapidecode: use allowed srcpad caps for caps query

Instead of using just the template caps use the current allowed
srcpad caps, which is created considering the current decoder
context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/366>

3 years agovaapidecode: build allowed srcpad caps from va context
Víctor Manuel Jáquez Leal [Wed, 22 Jan 2020 16:41:28 +0000 (17:41 +0100)]
vaapidecode: build allowed srcpad caps from va context

Instead of generating allowed srcpad caps with generic information,
now it takes the size an formats limits from the decoder's context.

This is possible since srcpad caps are generated after the internal
decoder is created.

The patch replaces gst_vaapi_decoder_get_surface_formats() with
gst_vaapi_decoder_get_suface_attributes().

From these attributes, formats are only used for VASurface memory
caps feature. For system memory caps feature, the old
gst_vaapi_plugin_get_allowed_srcpad_caps() is still used, since
i965 jpeg decoder cannot deliver mappable format for gstreamer.
And for the other caps features (dmabuf and texture upload) the
same static list are used.

This patch also adds DMABuf caps feature only if the context
supports that memory type. Nonetheless, we keep the pre-defined
formats since they are the subset of common derive formats formats
supported either by amd/gallium and both intel drivers, since,
when exporting the fd through vaAcquireBufferHandle()/
vaReleaseBufferHandle(), the formats of the derivable image cannot
be retriebable from the driver. Later we'll use the attribute
formats for the DMABuf feature too, when the code be ported to
vaExportSurfaceHandle().

Finally, the allowed srcpad caps are removed if the internal decoder
is destroyed, since context attribues will change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/366>

3 years agovaapidecode: reorder src caps template
Víctor Manuel Jáquez Leal [Fri, 7 Feb 2020 15:50:52 +0000 (16:50 +0100)]
vaapidecode: reorder src caps template

Since negotiation depends on caps order, first is VA, then DMABuf,
later GLUploadTexture (deprecated) and finally raw.

Also, for decoders, the possible available color formats for DMABuf
is extended to all the possible VA color formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/366>

3 years agolibs: window: wayland: use dmabuf protocol if available
Michael Olbrich [Wed, 22 Jul 2020 08:01:41 +0000 (10:01 +0200)]
libs: window: wayland: use dmabuf protocol if available

Currently vaGetSurfaceBufferWl() is used to create wayland buffers.
Unfortunately this is not implemented by the 'media-driver' and Mesa VA-API
drivers. And the implementation provided by 'intel-vaapi-driver' is not
compatible with a Wayland server that uses the iris Mesa driver.

So create the Wayland buffers manually with the zwp_linux_dmabuf_v1 wayland
protocol. Formats and modifiers supported by the Wayland server are taken
into account. If necessary, VPP is enabled to convert the buffer into a
supported format.

Fall back to vaGetSurfaceBufferWl() if creating buffers via dambuf protocol
fails.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/346>

3 years agolibs: window: allow choosing the format for the vpp pool
Michael Olbrich [Tue, 21 Jul 2020 08:03:19 +0000 (10:03 +0200)]
libs: window: allow choosing the format for the vpp pool

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/346>

3 years agovideo-format: add DRM formats to the mapping table
Michael Olbrich [Sun, 28 Jun 2020 15:42:29 +0000 (17:42 +0200)]
video-format: add DRM formats to the mapping table

This will be needed for the DMABuf protocol support to map DRM formats to
vaapi and gstreamer formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/346>

3 years agolibs: display: wayland: add basic dmabuf protocol support
Michael Olbrich [Wed, 22 Jul 2020 07:36:18 +0000 (09:36 +0200)]
libs: display: wayland: add basic dmabuf protocol support

This is just the basic infrastructure. Hook up the interface and collect
all supported formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/346>

3 years agolibs: window: wayland: wait for configure before committing the first buffer
Michael Olbrich [Mon, 6 Jul 2020 07:59:40 +0000 (09:59 +0200)]
libs: window: wayland: wait for configure before committing the first buffer

Committing the first buffer for a surface must not be done before
ack_configure() has been sent for the xdg_surface.

With weston, the commit will fail with "error 3: xdg_surface has never been
configured".

Wait in gst_vaapi_window_wayland_show() until configure is done to avoid
this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/346>

3 years agolibs: encoder: h265: set no P frame automatically.
He Junyan [Wed, 1 Jul 2020 06:50:51 +0000 (14:50 +0800)]
libs: encoder: h265: set no P frame automatically.

The double reference lists may be required by drivers and there should
be no P frames in the of stream. The old way of converting P frames to
B frames is by setting `low-delay-b` property, which is unconvenient
and has bad user experience, since most of the users do not know when
to set this property, and if it is not set correctly, the encoding
pipeline fails or even hangs on some platforms. VA driver now provides
a attribute to query whether both reference lists must be un-NULL for
a profile/entrypoint pair.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/284>

3 years agolibs: encoder: h265: Deprecate the low-delay-b property.
He Junyan [Wed, 15 Apr 2020 08:26:55 +0000 (16:26 +0800)]
libs: encoder: h265: Deprecate the low-delay-b property.

In HEVC, P and B definitions are different from AVC: P frames have
just one reference list and so 1 MV, while B frames have two reference
lists and so 2 MVs. No matter B or P, ist reference lists can contain
forward/backward reference. So P and B can both have bi-directions
dependency, the difference is just their reference list
number (i.e. MV number). This is different from the AVC.

The *low delay b mode* refers to a special HEVC mode, in which the
stream just contain I and B frames, without P frames, and all B frames
only have forward direction dependencies (i.e. all inter frames have 2
reference lists but no backward reference in both lists).  This is
similar to AVC I/P mode, but changing the P to the forward dependent
B.

The `low-delay-b` property is now just used to simply convert all P
frames to B frames when driver does not support P frames (so both
reference lists have the same references frames). This is a little
different from the meaning of low delay b mode (the two ref lists may
have the different reference frames). And the driver now can report
whether it supports P frames correctly, so there is no need to use
this property and deprecate it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/284>

3 years agopostproc: reconfigure after changing cropping values
Marc Leeman [Fri, 24 Jul 2020 10:54:31 +0000 (12:54 +0200)]
postproc: reconfigure after changing cropping values

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/365>

4 years agoplugin: encode: Add static caps for template documentation.
He Junyan [Thu, 9 Jul 2020 05:49:29 +0000 (13:49 +0800)]
plugin: encode: Add static caps for template documentation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: encode: vp9: Use the dynamically built src template caps.
He Junyan [Wed, 8 Jul 2020 11:03:14 +0000 (19:03 +0800)]
plugin: encode: vp9: Use the dynamically built src template caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: encode: vp8: Use the dynamically built src template caps.
He Junyan [Wed, 8 Jul 2020 11:02:45 +0000 (19:02 +0800)]
plugin: encode: vp8: Use the dynamically built src template caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: encode: jpeg: Use the dynamically built src template caps.
He Junyan [Wed, 8 Jul 2020 11:02:23 +0000 (19:02 +0800)]
plugin: encode: jpeg: Use the dynamically built src template caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: encode: mpeg2: Use the dynamically built src template caps.
He Junyan [Wed, 8 Jul 2020 11:00:39 +0000 (19:00 +0800)]
plugin: encode: mpeg2: Use the dynamically built src template caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: encode: h265: Use the dynamically built src template caps.
He Junyan [Wed, 8 Jul 2020 10:59:18 +0000 (18:59 +0800)]
plugin: encode: h265: Use the dynamically built src template caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: encode: h264: Use the dynamically built src template caps.
He Junyan [Wed, 8 Jul 2020 10:57:26 +0000 (18:57 +0800)]
plugin: encode: h264: Use the dynamically built src template caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: encode: Store the coded caps in type's init data.
He Junyan [Wed, 8 Jul 2020 10:46:58 +0000 (18:46 +0800)]
plugin: encode: Store the coded caps in type's init data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugin: util: add helper function build_template_coded_caps_by_codec()
He Junyan [Wed, 8 Jul 2020 10:30:00 +0000 (18:30 +0800)]
plugin: util: add helper function build_template_coded_caps_by_codec()

Like build_template_raw_caps_by_codec(), this function can detect and
build the caps for specified codec based on the query of the profiles.
The result is coded caps such as video/x-h265, video/x-h264. The result
can be used as the template of encode's src or decode's sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agoplugins: utils: rename build_template_caps_by_codec.
He Junyan [Tue, 7 Jul 2020 09:16:41 +0000 (17:16 +0800)]
plugins: utils: rename build_template_caps_by_codec.

Rename the function build_template_caps_by_codec() to the name of
build_template_raw_caps_by_codec(). It can be used to collect all
raw video formats for encode's sink and decode's src.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>

4 years agovaapidecode: merge common profiles before setting size range
Víctor Manuel Jáquez Leal [Tue, 21 Jul 2020 18:14:57 +0000 (20:14 +0200)]
vaapidecode: merge common profiles before setting size range

The synthetic profiles, such as H264 baseline, H265 intra, etc. are
added at the end of processing all available VA profiles. This
generated an non-optimal caps for negotiation, since the synthetic
profiles don't have frame size ranges.

This patch adds those possible synthetic profiles when the associated
profile is processed, with its frame size ranges.

Now allowed sink caps are simpler.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/363>

4 years agoplugin: util: Add the missing DMA buffer input in template caps.
He Junyan [Tue, 21 Jul 2020 14:05:08 +0000 (22:05 +0800)]
plugin: util: Add the missing DMA buffer input in template caps.

We pass the wrong parameter to gst_vaapi_build_caps_from_formats()
and lose the DMA feature in caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/362>

4 years agolibs: decoder: H265: Add MAIN_12 profile supporting.
He Junyan [Tue, 14 Jul 2020 10:13:56 +0000 (18:13 +0800)]
libs: decoder: H265: Add MAIN_12 profile supporting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/359>

4 years agovideo-format: Add P012_LE format.
He Junyan [Thu, 9 Jul 2020 15:07:38 +0000 (23:07 +0800)]
video-format: Add P012_LE format.

It can be used as HEVC YUV_4:2:0 12bits stream's decoder output, and
also can be used as the input format for encoding HEVC YUV_4:2:0 12bits
stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/359>

4 years agoplugin: decode: correct ensure_allowed_sinkpad_caps's caps.
He Junyan [Thu, 16 Jul 2020 16:45:53 +0000 (00:45 +0800)]
plugin: decode: correct ensure_allowed_sinkpad_caps's caps.

The decode allowed caps returned by ensure_allowed_sinkpad_caps()
contains all profiles of the whole VAAPI, like:
  image/jpeg, width=(int)[ 0, 1638 4 ], height=(int)[ 0, 16384 ];
  video/mpeg, mpegversion=(int)2, profile=(string){ simple, main },
  width=(int)[ 0, 2048 ], height=(int)[ 0, 2048 ]; video/x-h264,
  profile=(string){ main, high, constrained-baseline }, width=(int)[ 0,
  4096 ], height=(int)[ 0, 4096 ]; video/x-h264, profile=(string){
  constrained-high, progressive-high, baseline }; video/x-h265,
  profile=(string){ main, main-intra }, width=(int)[ 0, 8192 ],
  height=(int)[ 0, 8192 ]; video/x-vp8, width=(int)[ 0, 4096 ],
  height=(int)[ 0, 4096 ]; video/x-wmv, wmvversion=(int)3,
  format=(string)WVC1, profile=(string)advanced, width=(int)[ 0, 3840 ],
  height=(int)[ 0, 3840 ]; video/x-wmv, wmvversion=(int)3,
  profile=(string){ simple, main }, width=(int)[ 0, 3840 ],
  height=(int)[ 0, 3840 ]

Which is verbose and may have latent problems. It should only contains
the profiles belong to its codec type. For example, h265 should only
return:
  video/x-h265, profile=(string){ main, main-intra },
  width=(int)[ 0, 8192 ], height=(int)[ 0, 8192 ]

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/361>

4 years agovaapidecodebin: don't force NV12 since P010_10LE is now possible
Víctor Manuel Jáquez Leal [Mon, 13 Jul 2020 09:06:18 +0000 (11:06 +0200)]
vaapidecodebin: don't force NV12 since P010_10LE is now possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/360>

4 years agolibs: profile: The VP9 profiles' name should be just "0,1,2,3"
He Junyan [Sun, 12 Jul 2020 12:34:31 +0000 (20:34 +0800)]
libs: profile: The VP9 profiles' name should be just "0,1,2,3"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/357>

4 years agovaapidecode: Remove NO_SURFACE error handling
Víctor Manuel Jáquez Leal [Wed, 8 Jul 2020 15:33:32 +0000 (17:33 +0200)]
vaapidecode: Remove NO_SURFACE error handling

Since surfaces are not bounded to decoding context it makes no sense
to keep the surface semaphore. This patch removes the handling of
this error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/353>

4 years agoRevert "vaapidecode: drop non-keyframe in reverse playback"
Víctor Manuel Jáquez Leal [Wed, 8 Jul 2020 15:48:57 +0000 (17:48 +0200)]
Revert "vaapidecode: drop non-keyframe in reverse playback"

Since the number of surfaces are not bounded to decoder context,
this hack is no longer needed.

This reverts commit 19c0c8a97385ce119440c4aad2d689fc79297435.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/353>

4 years agolibs: decoder: context: remove surfaces binding from context.
He Junyan [Fri, 6 Dec 2019 06:21:33 +0000 (14:21 +0800)]
libs: decoder: context: remove surfaces binding from context.

The vaCreateContext do not need to specify the surfaces for the
context creation now. So we do not need to bind any surface to the
context anymore. Surfaces should be the resource belong to display
and just be used in encoder/decoder context.

The previous manner has big limitation for decoder. The context's
surface number is decided by dpb size. All the surfaces in dpb will
be attached to a gstbuffer and be pushed to down stream, and the
decoder need to wait down stream free the surface and go on if not
enough surface available. For more and more use cases, this causes
deadlock. For example,

gst-launch-1.0 filesrc location=a.h264 ! h264parse ! vaapih264dec
! x264enc ! filesink location=./output.h264

will cause deadlock and make the whole pipeline hang.
the x264enc encoder need to cache more than dpb size surfaces.

The best solution is seperating the surfaces number and the dpb size.
dpb and dpb size shoule be virtual concepts maintained by the decoder.
And let the surfaces_pool in context maintain the re-use of all surfaces.

For encoder, the situation is better, all the surfaces are just used
as reference frame and no need to be pushed to down stream. We can
just reserve and set the capacity of the surfaces_pool to meet the
request.

Fix: #147
Fix: #88

Co-Author: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/353>

4 years agomeson: set release date from .doap file for releases
Tim-Philipp Müller [Wed, 8 Jul 2020 16:50:51 +0000 (17:50 +0100)]
meson: set release date from .doap file for releases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/355>

4 years agoplugins: use VA allocator by default on raw caps
Víctor Manuel Jáquez Leal [Wed, 8 Jul 2020 09:57:52 +0000 (11:57 +0200)]
plugins: use VA allocator by default on raw caps

Instead of using dmabuf allocator in source pad, when raw video caps
are negotiated, it uses VA allocator as before, since it is stable
in more use cases, for example transcoding, and more backend drivers.

Dmabuf allocator is only used when dmabuf caps feature is negotiated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/352>

4 years agovaapisink: rank it as secondary
Víctor Manuel Jáquez Leal [Sat, 6 Jun 2020 16:47:35 +0000 (18:47 +0200)]
vaapisink: rank it as secondary

iHD doesn't provide a full implemention for rendering surfaces and
i965 has problems in wayland. And I suspect this path is followed
by other driver implementations.

This patch demotes the rank of vaapisink to secondary, so it will
not be autoplugged avoiding bad experience of users.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/336>

4 years agolibs: decoder: h264, h265: in context at least 16 reference surfaces
Víctor Manuel Jáquez Leal [Fri, 19 Jun 2020 08:44:50 +0000 (10:44 +0200)]
libs: decoder: h264, h265: in context at least 16 reference surfaces

Registering only stream's DBP size number of surfaces for decoding VA
surfaces brings issues for certain streams. This change register all
possible number of reference surfaces in a stream, which is 16.

Fixes: #94

4 years agoplugins: encode: h265: Add profile,level,tier to output caps.
He Junyan [Sat, 4 Jul 2020 13:21:57 +0000 (21:21 +0800)]
plugins: encode: h265: Add profile,level,tier to output caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/350>

4 years agolibs: encoder: h265: init tier to GST_VAAPI_TIER_H265_UNKNOWN.
He Junyan [Sat, 4 Jul 2020 13:08:20 +0000 (21:08 +0800)]
libs: encoder: h265: init tier to GST_VAAPI_TIER_H265_UNKNOWN.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/350>

4 years agolibs: encoder: h265: fix a bug to get get_profile_tier_level.
He Junyan [Sat, 4 Jul 2020 13:05:49 +0000 (21:05 +0800)]
libs: encoder: h265: fix a bug to get get_profile_tier_level.

0 is a valid value for h265 tier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/350>

4 years agolibs: encoder: h265: no need to check the high compression tune.
He Junyan [Thu, 2 Jul 2020 11:19:35 +0000 (19:19 +0800)]
libs: encoder: h265: no need to check the high compression tune.

The h265 encoder just support tune mode:
  (0): none             - None
  (3): low-power        - Low power mode
So, no need to check and set the high compression parameters.

And by the way, the current ensure_tuning_high_compression manner
of choosing the hightest profile idc as the best compression profile
is not correct. Unlike h264, in h265 the higher profile idc number
does not mean it has more compression tools, and so it has better
compression performance. It may even be un-compatible with the lower
profile idc. For example, the SCREEN_CONTENT_CODING profile with idc
9 is not compatible with 3D_MAIN profile with idc 8.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/348>

4 years agoBack to development
Tim-Philipp Müller [Fri, 3 Jul 2020 01:04:14 +0000 (02:04 +0100)]
Back to development

4 years agoRelease 1.17.2
Tim-Philipp Müller [Thu, 2 Jul 2020 23:36:40 +0000 (00:36 +0100)]
Release 1.17.2

4 years agodocs: Mark parent classes as plugin API
Thibault Saunier [Tue, 23 Jun 2020 14:20:46 +0000 (10:20 -0400)]
docs: Mark parent classes as plugin API

4 years agomeson: mark plugins cache target as always stale
Mathieu Duponchelle [Mon, 22 Jun 2020 22:07:57 +0000 (00:07 +0200)]
meson: mark plugins cache target as always stale

4 years agodoc: Stop documenting properties from parents
Thibault Saunier [Sat, 20 Jun 2020 03:34:11 +0000 (23:34 -0400)]
doc: Stop documenting properties from parents

4 years agoBack to development
Tim-Philipp Müller [Fri, 19 Jun 2020 23:28:35 +0000 (00:28 +0100)]
Back to development

4 years agoRelease 1.17.1
Tim-Philipp Müller [Fri, 19 Jun 2020 18:27:11 +0000 (19:27 +0100)]
Release 1.17.1

4 years agoUpdate plugin docs and add more plugins
Tim-Philipp Müller [Fri, 19 Jun 2020 14:21:56 +0000 (15:21 +0100)]
Update plugin docs and add more plugins

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/344>

4 years agolibs: wayland: display: only handle the first output
Michael Olbrich [Thu, 11 Jun 2020 06:32:05 +0000 (08:32 +0200)]
libs: wayland: display: only handle the first output

Right now, all outputs are handled. The means that the registry object for
all but the last are leaked. As a result the sizes are not used correctly.

With two outputs, at first the mode and physical size of the second output
are used. If the first output changes the mode, then the physical size of
the second output is used in combination with the resolution of the first
output. The resulting pixel aspect ratio is incorrect.

There seems to be no way to determine on which output the window is shown,
so just use the first one to get consistent results.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/341>

4 years agoplugins: pluginbase: Do not destroy display when _close()
He Junyan [Thu, 11 Jun 2020 10:15:17 +0000 (18:15 +0800)]
plugins: pluginbase: Do not destroy display when _close()

When the element's state changes to NULL, it can still receive
queries, such as the image formats. The display is needed in such
queries but not well protected for MT safe.
For example, ensure_allowed_raw_caps() may still use the display
while it is disposed by gst_vaapi_plugin_base_close() because of
the state change.

We can keep the display until the element is destroyed. When the
state changes to NULL, and then changes to PAUSED again, the display
can be correctly set(if type changes), or leave untouched.

Fix: #260
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/343>

4 years agolibs: context: use correct printing modifier
Víctor Manuel Jáquez Leal [Tue, 9 Jun 2020 19:19:11 +0000 (21:19 +0200)]
libs: context: use correct printing modifier

GstVaapiID is an alias of gsize, thus its modifier is platform
dependant.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/340>

4 years agoplugins: uddate gst_type_mark_as_plugin_api() calls
Mathieu Duponchelle [Fri, 5 Jun 2020 22:42:46 +0000 (00:42 +0200)]
plugins: uddate gst_type_mark_as_plugin_api() calls

4 years agolibs: encoder: h265: Enable tile in VA command.
He Junyan [Thu, 5 Mar 2020 10:12:27 +0000 (18:12 +0800)]
libs: encoder: h265: Enable tile in VA command.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: encoder: h265: Add ensure_tile to calculate tiles.
He Junyan [Thu, 5 Mar 2020 09:56:51 +0000 (17:56 +0800)]
libs: encoder: h265: Add ensure_tile to calculate tiles.

We need consider tiles and slices together, separate tiles uniformly
and then assign slices uniformly to each tiles.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: display: add a quirk for iHD driver tile encoding.
He Junyan [Thu, 30 Apr 2020 06:19:29 +0000 (14:19 +0800)]
libs: display: add a quirk for iHD driver tile encoding.

The iHD driver has a requirement that one slice can not span tiles
when tile is enabled, which is not required by hevc spec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: encoder: h265: Add tile info to bitstream.
He Junyan [Thu, 5 Mar 2020 09:40:43 +0000 (17:40 +0800)]
libs: encoder: h265: Add tile info to bitstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: encoder: h265: promote level if tile is enabled.
He Junyan [Thu, 5 Mar 2020 09:29:41 +0000 (17:29 +0800)]
libs: encoder: h265: promote level if tile is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: encoder: h265: Add num-tile-cols/rows properties.
He Junyan [Thu, 5 Mar 2020 09:07:28 +0000 (17:07 +0800)]
libs: encoder: h265: Add num-tile-cols/rows properties.

These properties are used for support of tile encoding. We just
support uniform mode of tile encoding, that is, separating picture
equally by (num-tile-cols X num-tile-rows).
According to HEVC spec A1, the max number of tiles in column is 20
and in rows is 22, so add two constant definitions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: encoder: h265: extract slice creation from add_slice_headers
He Junyan [Thu, 5 Mar 2020 08:21:24 +0000 (16:21 +0800)]
libs: encoder: h265: extract slice creation from add_slice_headers

extract slice creation details from add_slice_headers, and let the
add_slice_headers just focuses on calculating slice start address
and CTU number.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: encoder: Add a helper function to check the tile support.
He Junyan [Thu, 5 Mar 2020 04:44:45 +0000 (12:44 +0800)]
libs: encoder: Add a helper function to check the tile support.

Encoding by tiles separation now is a very common feature for all
relative new codecs, such as HEVC, AV1, and VP9. Just make this
check as a common helper function of the encoder base class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>

4 years agolibs: decoder: H265: Add SCC_MAIN_444_10 profile support.
He Junyan [Wed, 13 May 2020 10:02:07 +0000 (18:02 +0800)]
libs: decoder: H265: Add SCC_MAIN_444_10 profile support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/311>

4 years agolibs: decoder: update reference list for SCC.
He Junyan [Wed, 13 May 2020 08:05:59 +0000 (16:05 +0800)]
libs: decoder: update reference list for SCC.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/311>

4 years agolibs: decoder: H265: Fill picture and slice SCC parameters.
He Junyan [Wed, 13 May 2020 07:46:29 +0000 (15:46 +0800)]
libs: decoder: H265: Fill picture and slice SCC parameters.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/311>

4 years agolibs: util: H265: recognize the SCC profiles.
He Junyan [Wed, 13 May 2020 07:00:53 +0000 (15:00 +0800)]
libs: util: H265: recognize the SCC profiles.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/311>

4 years agolibs: profile: Add screen extended main/main10/main444 define.
He Junyan [Wed, 13 May 2020 06:53:46 +0000 (14:53 +0800)]
libs: profile: Add screen extended main/main10/main444 define.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/311>

4 years agolibs: encoder: h265: Add support for MAIN 4:2:2 10 profile.
He Junyan [Fri, 3 Apr 2020 06:53:40 +0000 (14:53 +0800)]
libs: encoder: h265: Add support for MAIN 4:2:2 10 profile.

Using YUY2 as the input of the encoder can generate main 4:2:2 bit
streams and using Y210 as the input of the encoder can generate main
4:2:2 10 bit streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/334>

4 years agolibs: encoder: h265: Use correct index for SubWidthC and SubHeightC.
He Junyan [Fri, 29 May 2020 08:40:20 +0000 (16:40 +0800)]
libs: encoder: h265: Use correct index for SubWidthC and SubHeightC.

We need to use the chroma_format_idc as the index for getting the
SubWidthC and SubHeightC values as the spec 6.1(table 6-1) defines.
The wrong SubWidthC or SubHeightC make us calculate a wrong right
or bottom offset for crop size and generate garbage in output.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/334>

4 years agolibs: encoder: h265: Fix chrome idc for 444 10 bits
He Junyan [Fri, 29 May 2020 07:37:24 +0000 (15:37 +0800)]
libs: encoder: h265: Fix chrome idc for 444 10 bits

GST_VAAPI_CHROMA_TYPE_YUV444_10BPP should also set chroma_format_idc
to 3 as GST_VAAPI_CHROMA_TYPE_YUV444 does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/334>

4 years agodoc: Require hotdoc >= 0.11.0
Thibault Saunier [Wed, 3 Jun 2020 22:37:22 +0000 (18:37 -0400)]
doc: Require hotdoc >= 0.11.0

4 years agodoc: Fix wrong link to GstVideoDirectionMethod
Thibault Saunier [Wed, 3 Jun 2020 22:49:53 +0000 (18:49 -0400)]
doc: Fix wrong link to GstVideoDirectionMethod

4 years agodocs: Update plugin cache with the new format
Thibault Saunier [Wed, 3 Jun 2020 21:38:10 +0000 (17:38 -0400)]
docs: Update plugin cache with the new format

And fix the default URL which should not be inside quotes.

4 years agoUse gst_type_mark_as_plugin_api() for all non-element plugin types
Thibault Saunier [Wed, 3 Jun 2020 21:37:48 +0000 (17:37 -0400)]
Use gst_type_mark_as_plugin_api() for all non-element plugin types

4 years agolibs: delete all gstvaapiobject related files.
He Junyan [Sat, 23 May 2020 14:09:17 +0000 (22:09 +0800)]
libs: delete all gstvaapiobject related files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/331>

4 years agolibs: surface: return fail immediately if can not create subpicture
He Junyan [Sat, 23 May 2020 12:48:54 +0000 (20:48 +0800)]
libs: surface: return fail immediately if can not create subpicture

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/331>

4 years agolibs: subpicture: Make subpicture a standard GstMiniObject.
He Junyan [Sat, 23 May 2020 06:00:58 +0000 (14:00 +0800)]
libs: subpicture: Make subpicture a standard GstMiniObject.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/331>

4 years agolibs: decoder: h264: Add ref flags for splited field.
He Junyan [Mon, 25 May 2020 18:19:15 +0000 (02:19 +0800)]
libs: decoder: h264: Add ref flags for splited field.

When split one frame into fields, the second field should also
copy the reference flags.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/333>

4 years agolibs: decoder: h264: disallow multiple slice group
Víctor Manuel Jáquez Leal [Mon, 25 May 2020 13:46:58 +0000 (15:46 +0200)]
libs: decoder: h264: disallow multiple slice group

As far as we know there are no VAAPI drivers supporting FMO, which
migth be used in baseline streams.

This commit is a continuation of
https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/328

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/332>

4 years agovaapidecoder: h264: remove baseline as constrained property
Víctor Manuel Jáquez Leal [Wed, 20 May 2020 08:50:05 +0000 (10:50 +0200)]
vaapidecoder: h264: remove baseline as constrained property

From now on always the baseline is going to be treated as constrained without
need of setting a property.

Since the property was added along the development cycle (1.17 / commit
866a9f06) and never released, we assume that it is safe to remove it.

Fixes: #252
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/328>