Commit graph

3689 commits

Author SHA1 Message Date
He Junyan
5f5182f9ad 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>
2020-05-16 19:58:15 +00:00
He Junyan
53a17f9c98 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>
2020-05-16 19:58:15 +00:00
He Junyan
d674d457ab 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>
2020-05-16 19:58:15 +00:00
He Junyan
3b3e987237 plugin: encode: add a helper macro to register encode type.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/315>
2020-05-16 19:58:15 +00:00
He Junyan
0e4c750918 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>
2020-05-16 19:58:15 +00:00
He Junyan
3583a4b86c 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>
2020-05-16 19:58:15 +00:00
He Junyan
2b1809e9d3 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>
2020-05-16 19:58:15 +00:00
Víctor Manuel Jáquez Leal
5d56ce6927 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>
2020-05-16 21:05:20 +02:00
Víctor Manuel Jáquez Leal
e20d06e64d 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>
2020-05-16 20:01:59 +02:00
He Junyan
f20bd8bfd1 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>
2020-05-16 19:18:46 +02:00
Víctor Manuel Jáquez Leal
808247a963 Update README
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/320>
2020-04-26 10:59:12 +00:00
Víctor Manuel Jáquez Leal
d195417758 libs: display: drm: use g_strcmp0 to be null safe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/321>
2020-04-26 10:40:38 +00:00
Haihao Xiang
336c2b76d1 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>
2020-04-26 14:55:30 +08:00
Víctor Manuel Jáquez Leal
8b7a5a36f1 build: use join_paths() for driverdir 2020-04-21 11:23:35 +02:00
Veerabadhran G
a53f0834b3 README: Update supported hardware
Added the AMD hardware list to the "Hardware Requirements" section.
2020-04-21 09:04:51 +00:00
He Junyan
f1d13d1e08 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.
2020-04-04 14:30:44 +02:00
He Junyan
e54671d4b3 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.
2020-04-04 14:22:04 +02:00
He Junyan
c80668c337 libs: bufferproxy: rename parent memeber as surface 2020-04-04 14:22:04 +02:00
He Junyan
ce3bf2c2ae 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.
2020-04-04 14:21:57 +02:00
He Junyan
7701844813 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.
2020-04-04 13:47:51 +02:00
U. Artie Eoff
4913d2b595 vaapipostproc: enable HDR10 tone mapping 2020-04-03 09:23:32 -07:00
U. Artie Eoff
5f9e3ceef3 libs: filter: HDR10 tone mapping support
Add support for HDR10 tone mapping (since VA-API 1.4.0).
2020-04-03 09:23:32 -07:00
He Junyan
026c01875c 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.
2020-04-02 23:01:46 +08:00
He Junyan
80b6e006bc libs: encoder: fix an inexact trace info in chroma type check. 2020-04-02 15:23:05 +08:00
Haihao Xiang
f680a8cba1 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
2020-03-31 15:03:30 +08:00
Víctor Manuel Jáquez Leal
ecbf070fa4 libs: extend g_autoptr support 2020-03-27 10:40:20 +00:00
Víctor Manuel Jáquez Leal
b1f859116d vaapivideometa: remove compiler warning 2020-03-27 10:35:31 +01:00
Víctor Manuel Jáquez Leal
4c9f49437d 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.
2020-03-22 20:59:20 +01:00
Víctor Manuel Jáquez Leal
222dc8d7d8 vaapipostproc: deprecate format, width and size parameters
Since they should only be controlled by caps negotiation.
2020-03-20 16:07:43 +00:00
He Junyan
532a1e5509 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>
2020-03-20 14:57:49 +01:00
U. Artie Eoff
a28046a8df 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 9e0c133a24.
2020-03-20 11:58:15 +00:00
U. Artie Eoff
861b4cc4b6 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.
2020-03-19 12:09:03 -07:00
Haihao Xiang
61516dd5e1 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.
2020-03-17 16:10:06 +00:00
Víctor Manuel Jáquez Leal
bb38055745 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.
2020-03-17 15:46:46 +00:00
He Junyan
f303b4a30f libs: utils: Add HEVC Main444 sting in string_of_VAProfile
HEVCMain444_10 is already a supported profile and misses the strings.
2020-03-17 12:43:16 +00:00
Víctor Manuel Jáquez Leal
d6bcbe47e9 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.
2020-03-17 12:49:12 +01:00
He Junyan
5eb8716598 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.
2020-03-09 16:34:16 +08:00
He Junyan
5e612aeb84 libs: videopool: fix a condition race for pool allocate. 2020-03-06 12:40:48 +00:00
U. Artie Eoff
da008baac2 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
2020-03-06 12:08:44 +00:00
Víctor Manuel Jáquez Leal
385892dd32 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().
2020-03-05 14:18:32 +01:00
Víctor Manuel Jáquez Leal
6e65356017 vaapidecode: unlock stream if caps update fails
If caps update fail a dead lock occurs since the stream mutex is not
unlocked.
2020-03-05 13:26:38 +01:00
Xu Guangxin
bf2299279f 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
2020-03-04 11:37:06 +08:00
Víctor Manuel Jáquez Leal
a8031bcb0e 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.
2020-02-28 12:20:18 +01:00
Víctor Manuel Jáquez Leal
ae0261023a 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.
2020-02-28 12:10:25 +01:00
U. Artie Eoff
acf90c1070 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
2020-02-28 11:09:11 +00:00
U. Artie Eoff
13601f4071 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.
2020-02-28 11:09:11 +00:00
Víctor Manuel Jáquez Leal
164656ee1d Revert "vaapivideomemory: Store surface allocation flags."
This reverts commit dd428cc4a1 because
it rewrites the buffer size whilst surface allocation flags are
stored when allocator_params_init() is called since fab890ce.

Fix: #239
2020-02-28 11:37:06 +01:00
Víctor Manuel Jáquez Leal
fab890ceb5 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.
2020-02-23 13:12:15 +01:00
Víctor Manuel Jáquez Leal
dd428cc4a1 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.
2020-02-23 13:12:15 +01:00
Víctor Manuel Jáquez Leal
96fdc3d322 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.
2020-02-23 13:12:15 +01:00