platform/upstream/gstreamer.git
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>

4 years agoREADME: update VP9 decoder and encoder
Víctor Manuel Jáquez Leal [Thu, 21 May 2020 09:37:36 +0000 (11:37 +0200)]
README: update VP9 decoder and encoder

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

4 years agovaapiencoder_h264: set direct_spatial_mv_pred_flag to true by default
Haihao Xiang [Thu, 21 May 2020 05:42:47 +0000 (13:42 +0800)]
vaapiencoder_h264: set direct_spatial_mv_pred_flag to true by default

This flag is set to true by default in both MediaSDK and FFmpeg-vaapi,
so let's align this plugin with other libraries / softwares.

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

4 years agovaapivideobufferpool: fix meta overwrite
Víctor Manuel Jáquez Leal [Mon, 18 May 2020 16:29:05 +0000 (18:29 +0200)]
vaapivideobufferpool: fix meta overwrite

commit 7ac2a207 added a regression by erroneously assumed that
GstVaapiVideoMeta is actually a GstMeta, which is not.

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

4 years agovaapivideopool: Set pooled flag to added metas.
Víctor Manuel Jáquez Leal [Sun, 17 May 2020 07:55:42 +0000 (09:55 +0200)]
vaapivideopool: Set pooled flag to added metas.

So this could hint filters how to use these metas.

Had to change the return value for texutre upload meta in order
to flag it.

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

4 years agolibs: use array_unref() rather than array_free()
Víctor Manuel Jáquez Leal [Sat, 16 May 2020 18:49:31 +0000 (20:49 +0200)]
libs: use array_unref() rather than array_free()

It is more convinience and thread-safe.

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

4 years agoplugin: use register_type to replace get_type for encode init.
He Junyan [Fri, 10 Apr 2020 14:20:35 +0000 (22:20 +0800)]
plugin: use register_type to replace get_type for encode init.

xxx_register_type will detect the template sink caps and is needed
to be called at init time.

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

4 years agoplugins: encode: Modify sink template of vp9 encode.
He Junyan [Fri, 10 Apr 2020 14:05:50 +0000 (22:05 +0800)]
plugins: encode: Modify sink template of vp9 encode.

Use gst_vaapi_detect_codec_caps to get more precise template caps.
Also implement gst_vaapiencode_vp9_register_type, which should be
called at plugin register time.

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

4 years agoplugins: encode: Modify sink template of vp8 encode.
He Junyan [Fri, 10 Apr 2020 14:05:18 +0000 (22:05 +0800)]
plugins: encode: Modify sink template of vp8 encode.

Use gst_vaapi_detect_codec_caps to get more precise template caps.
Also implement gst_vaapiencode_vp8_register_type, which should be
called at plugin register time.

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

4 years agoplugins: encode: Modify sink template of mpeg2 encode.
He Junyan [Fri, 10 Apr 2020 14:04:34 +0000 (22:04 +0800)]
plugins: encode: Modify sink template of mpeg2 encode.

Use gst_vaapi_detect_codec_caps to get more precise template caps.
Also implement gst_vaapiencode_mpeg2_register_type, which should be
called at plugin register time.

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

4 years agoplugins: encode: Modify sink template of h265 encode.
He Junyan [Fri, 10 Apr 2020 14:03:49 +0000 (22:03 +0800)]
plugins: encode: Modify sink template of h265 encode.

Use gst_vaapi_detect_codec_caps to get more precise template caps.
Also implement gst_vaapiencode_h265_register_type, which should be
called at plugin register time.

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

4 years agoplugins: encode: Modify sink template of h264 encode.
He Junyan [Fri, 10 Apr 2020 14:00:38 +0000 (22:00 +0800)]
plugins: encode: Modify sink template of h264 encode.

Use gst_vaapi_detect_codec_caps to get more precise template caps.
Also implement gst_vaapiencode_h264_register_type, which should be
called at plugin register time.

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

4 years agoplugins: encode: Modify sink template of jpeg encode.
He Junyan [Fri, 10 Apr 2020 14:11:34 +0000 (22:11 +0800)]
plugins: encode: Modify sink template of jpeg encode.

Use gst_vaapi_detect_codec_caps to get more precise template caps.
Also implement gst_vaapiencode_jpeg_register_type, which should be
called at plugin register time.

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

4 years agoplugin: encode: add a helper macro to register encode type.
He Junyan [Wed, 22 Apr 2020 16:02:02 +0000 (00:02 +0800)]
plugin: encode: add a helper macro to register encode type.

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

4 years agoplugins: util: Add a helper function to detect supported caps.
He Junyan [Fri, 10 Apr 2020 13:44:05 +0000 (21:44 +0800)]
plugins: util: Add a helper function to detect supported caps.

This helper function iterate all profiles and entrypoints belong
to the specified codec, query the VAConfigAttribRTFormat and list
all possible video formats.
This function is used by each codec to get the template sink caps
(for encode) or src caps(for decode) at register time, when just
all possible formats are listed and no need to be very accurate.
So there is no context created for the performance reason. Most
codecs just use YUV kinds of formats as the input/output, so we do
not include RGB kinds of formats. User can specified more formats
in extra_fmts(For example, jpeg may need BGRA) if needed.

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

4 years agoplugin: encode: extract the allowed caps maker as a helper function.
He Junyan [Fri, 10 Apr 2020 13:27:32 +0000 (21:27 +0800)]
plugin: encode: extract the allowed caps maker as a helper function.

Extract all logic about making caps for encode's sink as a standalone
helper function. It can be reused.

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

4 years agolibs: video-format: add a helper function of get_formats_by_chroma.
He Junyan [Fri, 10 Apr 2020 13:21:43 +0000 (21:21 +0800)]
libs: video-format: add a helper function of get_formats_by_chroma.

The function iterates all supported video formats and returns the
formats belong to the specified chroma type.

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

4 years agolibs: texture: remove unused headers include
Víctor Manuel Jáquez Leal [Sat, 16 May 2020 19:03:32 +0000 (21:03 +0200)]
libs: texture: remove unused headers include

This is continuation of
https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/317

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

4 years agolibs: removed duplicated function declarations
Víctor Manuel Jáquez Leal [Sat, 16 May 2020 17:58:25 +0000 (19:58 +0200)]
libs: removed duplicated function declarations

Some headers had duplicated inlined function declaration. This was
for gtkdoc, but now GStreamer uses hotdoc and the internal library
documentation is not generated. So let's remove these extra lines.

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

4 years agolibs: texture: Make texture a standard GstMiniObject.
He Junyan [Sat, 18 Apr 2020 11:32:24 +0000 (19:32 +0800)]
libs: texture: Make texture a standard GstMiniObject.

We store GstVaapiTextureGLX and GstVaapiTextureEGL's private data in
the qdata of miniobject and avoid extending the base texture class.

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

4 years agoUpdate README
Víctor Manuel Jáquez Leal [Sun, 26 Apr 2020 10:33:29 +0000 (12:33 +0200)]
Update README

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

4 years agolibs: display: drm: use g_strcmp0 to be null safe
Víctor Manuel Jáquez Leal [Tue, 21 Apr 2020 16:00:26 +0000 (18:00 +0200)]
libs: display: drm: use g_strcmp0 to be null safe

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

4 years agovaapipluginutil: Use GST_VAAPI_DISPLAY_TYPE_DRM for Mesa3D GBM
Haihao Xiang [Sun, 26 Apr 2020 05:30:16 +0000 (13:30 +0800)]
vaapipluginutil: Use GST_VAAPI_DISPLAY_TYPE_DRM for Mesa3D GBM

We may build this plugin with window system support but run it without
window system. Without this patch, the following pipeline will trigger a
segfault when running it without window system.

gst-launch-1.0 filesrc location=input.264 ! h264parse ! vaapih264dec ! fakesink

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

4 years agobuild: use join_paths() for driverdir
Víctor Manuel Jáquez Leal [Tue, 21 Apr 2020 09:16:37 +0000 (11:16 +0200)]
build: use join_paths() for driverdir

4 years agoREADME: Update supported hardware
Veerabadhran G [Tue, 21 Apr 2020 09:04:51 +0000 (09:04 +0000)]
README: Update supported hardware

Added the AMD hardware list to the "Hardware Requirements" section.

4 years agolibs: bufferproxy: remove GstMemory reference
He Junyan [Sat, 4 Apr 2020 11:58:00 +0000 (13:58 +0200)]
libs: bufferproxy: remove GstMemory reference

Since bufferproxy and surface are not referenced circularly, there's
no need to keep, in the buffer proxy, a reference to the GstMemory
where it is held. This patch removes that handling.

4 years agolibs,plugin: break surface-bufferproxy circular reference
He Junyan [Sun, 15 Mar 2020 15:29:05 +0000 (23:29 +0800)]
libs,plugin: break surface-bufferproxy circular reference

The bufferproxy may reference the surface and the surface may also
reference the bufferproxy, producing a circular reference, which might
lead to serious resource leak problems.

Now make the relationship clearer, the bufferproxy's references is
transfered to surface, while bufferproxy just keeps the surface's
address without increasing its reference count.

The surface can be created through a bufferproxy like in
gst_vaapi_surface_new_with_dma_buf_handle(), and the surface might
get its bufferproxy via gst_vaapi_surface_get_dma_buf_handle(). In
both cases the surface holds a bufferproxy's reference.

4 years agolibs: bufferproxy: rename parent memeber as surface
He Junyan [Fri, 3 Apr 2020 16:43:52 +0000 (18:43 +0200)]
libs: bufferproxy: rename parent memeber as surface

4 years agoplugin: bufferpool: use hashmap to cache dmabuf mem-surface
He Junyan [Sun, 15 Mar 2020 14:07:31 +0000 (22:07 +0800)]
plugin: bufferpool: use hashmap to cache dmabuf mem-surface

The old way of refer memory by bufferproxy is not a good one, since it
make the logic error prone.

Now it is established a map between surface-bufferproxy and its GstMemory,
caching the memory bound by a surface looked for the specified surface.

4 years agoplugin: bufferpool: Delete ACQUIRE_FLAG_NO_ALLOC flag.
He Junyan [Sun, 15 Mar 2020 13:50:24 +0000 (21:50 +0800)]
plugin: bufferpool: Delete ACQUIRE_FLAG_NO_ALLOC flag.

Delete the GST_VAAPI_VIDEO_BUFFER_POOL_ACQUIRE_FLAG_NO_ALLOC flag.
In fact, no one is using that flag, and all vaapi buffers should
have GstVaapiVideoMeta.

4 years agovaapipostproc: enable HDR10 tone mapping
U. Artie Eoff [Thu, 13 Feb 2020 17:43:38 +0000 (09:43 -0800)]
vaapipostproc: enable HDR10 tone mapping

4 years agolibs: filter: HDR10 tone mapping support
U. Artie Eoff [Thu, 13 Feb 2020 17:00:18 +0000 (09:00 -0800)]
libs: filter: HDR10 tone mapping support

Add support for HDR10 tone mapping (since VA-API 1.4.0).

4 years agolibs: encoder: h265: Support MAIN 4:4:4 10 profile.
He Junyan [Thu, 2 Apr 2020 07:14:15 +0000 (15:14 +0800)]
libs: encoder: h265: Support MAIN 4:4:4 10 profile.

Using Y410 as the input of the encoder can generate main_444_10 bit
streams.

4 years agolibs: encoder: fix an inexact trace info in chroma type check.
He Junyan [Thu, 2 Apr 2020 07:19:41 +0000 (15:19 +0800)]
libs: encoder: fix an inexact trace info in chroma type check.

4 years agolibs: encoder: make sure format array is not NULL when returning TRUE
Haihao Xiang [Tue, 31 Mar 2020 04:22:31 +0000 (12:22 +0800)]
libs: encoder: make sure format array is not NULL when returning TRUE

This fixed segfault when running the pipeline below with iHD driver
(commit efe5e9a) on ICL

gst-launch-1.0 videotestsrc ! vaapivp9enc tune=low-power ! vaapivp9dec ! \
fakesink

4 years agolibs: extend g_autoptr support
Víctor Manuel Jáquez Leal [Wed, 18 Mar 2020 12:28:00 +0000 (13:28 +0100)]
libs: extend g_autoptr support

4 years agovaapivideometa: remove compiler warning
Víctor Manuel Jáquez Leal [Thu, 26 Mar 2020 21:40:40 +0000 (22:40 +0100)]
vaapivideometa: remove compiler warning

4 years agobuild: Add meson's option package-origin.
Víctor Manuel Jáquez Leal [Sun, 22 Mar 2020 19:59:20 +0000 (20:59 +0100)]
build: Add meson's option package-origin.

This options is added to synchronize with other gstreamer packages
build configuration.

Though, to avoid breaking distro configuration it is set, as default,
the issues gitlab's url, instead of the used string
"Unkown package origin".

Also, set_quoted is used for string based cdata.

4 years agovaapipostproc: deprecate format, width and size parameters
Víctor Manuel Jáquez Leal [Tue, 25 Feb 2020 12:45:05 +0000 (13:45 +0100)]
vaapipostproc: deprecate format, width and size parameters

Since they should only be controlled by caps negotiation.

4 years agolibs,plugins: decoder: Add -intra profile support for hevc.
He Junyan [Wed, 18 Mar 2020 08:41:01 +0000 (16:41 +0800)]
libs,plugins: decoder: Add -intra profile support for hevc.

In hevc, we can consider the -intra profile a subset of the none
-intra profile. The -intra profiles just contain I frames and we
definitely can use the none -intra profiles's context to decode
them.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
4 years agolibs: encoder: h265: support ICQ/QVBR BRC
U. Artie Eoff [Wed, 4 Mar 2020 20:35:42 +0000 (12:35 -0800)]
libs: encoder: h265: support ICQ/QVBR BRC

Enable support for ICQ and QVBR bitrate control.

The code is essentially the same for h264 ICQ/QVBR support
which was added in commit 9e0c133a2403.

4 years agolibs: encoder: set VA HRD param before RC param
U. Artie Eoff [Thu, 19 Mar 2020 18:19:18 +0000 (11:19 -0700)]
libs: encoder: set VA HRD param before RC param

This is a workaround for intel-media-driver bug
https://github.com/intel/media-driver/issues/865

The driver will force the RC method to CBR for HEVCe
when it parses the HRD param.  Thus, any RC method
param submitted "prior" to the HRD param will be lost.
Therefore, VBR, ICQ and QVBR for HEVCe can't be
effectively enabled if the RC method param "precedes"
the HRD param.

To work around this issue, set the HRD param before
the RC method param so the driver will parse the RC
method param "after" the HRD param.

Afaict, other codecs in the driver (and other drivers)
do not appear to be dependent on the order of HRD and
RC param submission.

4 years agovaapijpegenc: Add a quantization quirk for iHD driver
Haihao Xiang [Mon, 25 Nov 2019 06:16:30 +0000 (14:16 +0800)]
vaapijpegenc: Add a quantization quirk for iHD driver

iHD driver shifts the value by 50 when calculating quantization for JPEG
encoding, so we should add 50 in this plugin for iHD driver too.

4 years agolibs: remove GstVaapiPixmap
Víctor Manuel Jáquez Leal [Fri, 13 Mar 2020 20:49:15 +0000 (21:49 +0100)]
libs: remove GstVaapiPixmap

GstVaapiPixmap is an abstract base class which only implementation
were GstVaapiPixmapX11. This class were used for a special type of
rendering in the tests apps, utterly unrelated in GStreamer.

Since gstreamer-vaapi is no longer a general-user wrapper for VA-API
we should remove this unused API.

This removal drops libxrender dependency.

4 years agolibs: utils: Add HEVC Main444 sting in string_of_VAProfile
He Junyan [Tue, 17 Mar 2020 10:51:19 +0000 (18:51 +0800)]
libs: utils: Add HEVC Main444 sting in string_of_VAProfile

HEVCMain444_10 is already a supported profile and misses the strings.

4 years agoplugin: don't error if cannot create display
Víctor Manuel Jáquez Leal [Tue, 17 Mar 2020 11:47:33 +0000 (12:47 +0100)]
plugin: don't error if cannot create display

This might generated errors on automatic tools such as CI. Let's
rather just raise a warning and let continue.

4 years agotest: fix a ninja test failure for vaapioverlay.
He Junyan [Sun, 8 Mar 2020 17:52:57 +0000 (01:52 +0800)]
test: fix a ninja test failure for vaapioverlay.

That test case only works with drm display, so the build such as

meson -Dwith_x11=yes -Dwith_wayland=no -Dwith_drm=no -Dwith_egl=no
-Dwith_glx=no

gets a failure when run ninja test. Just enable this test when drm
is enabled.

4 years agolibs: videopool: fix a condition race for pool allocate.
He Junyan [Fri, 7 Feb 2020 15:56:13 +0000 (23:56 +0800)]
libs: videopool: fix a condition race for pool allocate.

4 years agovaapivideobufferpool: force video meta if sizes are different
U. Artie Eoff [Thu, 5 Mar 2020 21:22:23 +0000 (13:22 -0800)]
vaapivideobufferpool: force video meta if sizes are different

The strides and offsets could be the same, but the allocation
size might be different (e.g. alignment).  Thus, ensure we also
set the flag to copy from VA memory to system memory when alloc
size differs.

Fixes #243

4 years agovaapidecode: don't set base sink caps twice
Víctor Manuel Jáquez Leal [Thu, 5 Mar 2020 13:18:32 +0000 (14:18 +0100)]
vaapidecode: don't set base sink caps twice

Base class's sink pad caps are already set when calling set_format().
There's no need to call it again in gst_vaapidecode_negotiate().

4 years agovaapidecode: unlock stream if caps update fails
Víctor Manuel Jáquez Leal [Thu, 5 Mar 2020 12:26:38 +0000 (13:26 +0100)]
vaapidecode: unlock stream if caps update fails

If caps update fail a dead lock occurs since the stream mutex is not
unlocked.

4 years agolibs: decoder: h265: parser state after update dependent slice
Xu Guangxin [Tue, 3 Mar 2020 07:24:32 +0000 (15:24 +0800)]
libs: decoder: h265: parser state after update dependent slice

If the dependent_slice_segment_flag is true, most slice info derived from last slice.
So we need check the slice type after we call populate_dependent_slice_hdr

4 years agolibs: display: force RGBA image format for i965 driver
Víctor Manuel Jáquez Leal [Sun, 16 Feb 2020 11:21:28 +0000 (12:21 +0100)]
libs: display: force RGBA image format for i965 driver

Since commit 32bf6f1e GLTextureUpload is broken because i965
doesn't report properly RGBA support. It could be possible to use RGBx
but GLTextureUpload only regotiates RGBA.

The simplest fix to this regression is adding synthetically the RGBA
format in the internal format map.

4 years agolibs: display: iterate all quirks table
Víctor Manuel Jáquez Leal [Fri, 14 Feb 2020 18:30:54 +0000 (19:30 +0100)]
libs: display: iterate all quirks table

Instead of break at the fist foud quirk in the table, iterate all over
so it would be feasible to add several quirks for one driver per
element in array.

4 years agolibs: filter: handle RGB to/from YUV color primary driver quirk
U. Artie Eoff [Tue, 25 Feb 2020 20:05:28 +0000 (12:05 -0800)]
libs: filter: handle RGB to/from YUV color primary driver quirk

The intel-media-driver (iHD) can't convert output color
primaries when doing YUV to/from RGB CSC.  Thus, we must
keep the output color primaries the same as the input
color primaries for this case.

fixes #238

4 years agolibs: display: add YUV to/from RGB color primary quirk
U. Artie Eoff [Tue, 25 Feb 2020 20:00:36 +0000 (12:00 -0800)]
libs: display: add YUV to/from RGB color primary quirk

The intel-media-driver (iHD) can't convert output color
primaries when doing YUV to/from RGB CSC.

4 years agoRevert "vaapivideomemory: Store surface allocation flags."
Víctor Manuel Jáquez Leal [Fri, 28 Feb 2020 10:33:18 +0000 (11:33 +0100)]
Revert "vaapivideomemory: Store surface allocation flags."

This reverts commit dd428cc4a12c2d5c694fcd3303811cf486002c9d because
it rewrites the buffer size whilst surface allocation flags are
stored when allocator_params_init() is called since fab890ce.

Fix: #239

4 years agovaapivideomemory: Try surface with allocation flags.
Víctor Manuel Jáquez Leal [Mon, 27 Jan 2020 17:19:57 +0000 (18:19 +0100)]
vaapivideomemory: Try surface with allocation flags.

When a vaapi allocator is instantiated, it first try to generate a
surface with the specified configuration.

This patch adds, in this tried buffer, the requested allocation flags.

4 years agovaapivideomemory: Store surface allocation flags.
Víctor Manuel Jáquez Leal [Mon, 27 Jan 2020 17:10:18 +0000 (18:10 +0100)]
vaapivideomemory: Store surface allocation flags.

Store surface allocation flags passed to the vaapi allocator in
GObject's qdata, because it might be used by the vaapivideobufferpool
when recreating the allocator given any resolution change.

4 years agolibs: surface: Add hints to allocation flags.
Víctor Manuel Jáquez Leal [Fri, 24 Jan 2020 18:32:52 +0000 (19:32 +0100)]
libs: surface: Add hints to allocation flags.

When creating surfaces it is possible to pass to VA hints of its usage,
so the driver may do some optimizations.

This commit adds the handling of encoding/decoding hints.

4 years agolibs: surface: surfacepool: Add allocation flags in constructors.
Víctor Manuel Jáquez Leal [Fri, 24 Jan 2020 21:08:50 +0000 (22:08 +0100)]
libs: surface: surfacepool: Add allocation flags in constructors.

4 years agobuild: let the build fail if none if X11, wayland or drm.
He Junyan [Sat, 22 Feb 2020 08:06:13 +0000 (16:06 +0800)]
build: let the build fail if none if X11, wayland or drm.

In fact, gst_vaapi_create_test_display only test x11, wayland and
drm, no glx and egl entries. So if none of them is enabled, no
vaapi element can be detected.

4 years agotest: avoid unused warning for test-display
He Junyan [Thu, 20 Feb 2020 16:58:47 +0000 (00:58 +0800)]
test: avoid unused warning for test-display

meson -Dwith_x11=yes -Dwith_wayland=no -Dwith_drm=no -Dwith_egl=no
-Dwith_glx=no buildir

generate unused warnings.

4 years agobuild: fix meson build error when without x11.
He Junyan [Thu, 20 Feb 2020 16:50:47 +0000 (00:50 +0800)]
build: fix meson build error when without x11.

meson -Dwith_x11=no build_dir
can not success build the project because the glx is still enabled.
We need to disable GLX when X11 is disabled.

4 years agolibs: h265enc: Set max_transform_hierarchy_depth_{inter, intra} to 2
Haihao Xiang [Fri, 14 Feb 2020 11:53:09 +0000 (19:53 +0800)]
libs: h265enc: Set max_transform_hierarchy_depth_{inter, intra} to 2

Intel HW has limitation on max_transform_hierarchy_depth_inter and
max_transform_hierarchy_depth_intra (see [1]). We can provide a quirk for
other HWs if other HWs may support other values

[1] https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol10-hevc.pdf

4 years agovaapipostproc: do not compensate for crop/direction if no VPP
U. Artie Eoff [Fri, 21 Feb 2020 15:37:50 +0000 (07:37 -0800)]
vaapipostproc: do not compensate for crop/direction if no VPP

If we do not have functional VPP, then cropping and video
direction is non-functional and we should avoid calling
any of the gst_vaapi_filter* APIs.

4 years agovaapipostproc: only set VPP colorimetry when VPP is available
U. Artie Eoff [Fri, 21 Feb 2020 14:54:47 +0000 (06:54 -0800)]
vaapipostproc: only set VPP colorimetry when VPP is available

If we don't have functional vpp then we should not call
gst_vaapi_filter_set_colorimetry.

4 years agovideobufferpool: don't reset surface when created internally
He Junyan [Sat, 15 Feb 2020 17:25:37 +0000 (01:25 +0800)]
videobufferpool: don't reset surface when created internally

The bug fixing, in commit 89f202ea, just considers the case when
surface's DMABuf is set through gst_buffer_pool_acquire_buffer(),
which is typically a decoder's behavior. But vaapipostproc doesn't
provide any surface when calling gst_buffer_pool_acquire_buffer(),
thus a surface is created when GstMemory is allocated.

If the surface proxy in buffer's meta is reset at
buffer_pool_reset_buffer(), that surface will be destroyed and it
won't be available anymore. But GstBuffers are cached in the buffer
pool and they are reused again, hence only those images are rendered
repeatedly.

Fixes: #232

4 years agolibs: blend: filter: handle finalize() if display isn't assigned
Víctor Manuel Jáquez Leal [Sun, 16 Feb 2020 16:19:04 +0000 (17:19 +0100)]
libs: blend: filter: handle finalize() if display isn't assigned

I've just discovered iHD driver in Skylake doesn't have VideoProc
entry point, hence, in this platform, when vaapioverlay is tried to be
registered, critical warnings are raised because blend doesn't have a
display assigned.

As it is possible to have drivers without EntryPointVideoProc it is
required to handle it gracefully. This patch does that: only tries to
register vaapioverlay if the testing display has VPP and finalize()
vmethods, in filter and blend, bail out if display is NULL.

4 years agolibs: filter: guard all color properties to VA-API 1.2.0
U. Artie Eoff [Sat, 15 Feb 2020 19:02:49 +0000 (11:02 -0800)]
libs: filter: guard all color properties to VA-API 1.2.0

Older VA-API (0.39.0) doesn't have VAProcColorProperties.

Thus, guard all colorimetry -> VA-API support to version
1.2.0.

Fixes #234

4 years agolibs: decoder: h265: set parser info state at decoding codec data
Víctor Manuel Jáquez Leal [Mon, 17 Feb 2020 07:55:36 +0000 (08:55 +0100)]
libs: decoder: h265: set parser info state at decoding codec data

Commit 1168d6d5 showed up a regression: decode_sps() stores the unit's
parser info in sps array. If that parser info comes from decoding
codec data, that parser info will have an undefined state which might
break ensure_sps().

This patch sets the parser info state, at decoding codec data, with
the internal parser state. This is similar with h264 decoder apprach.

Original-patch-by: Xu Guangxin <guangxin.xu@intel.com>