Commit graph

3639 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
8c08ef31a5 libs: surface: surfacepool: Add allocation flags in constructors. 2020-02-23 13:12:15 +01:00
He Junyan
3ff51a6e52 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.
2020-02-22 12:59:13 +00:00
He Junyan
b7af4205aa 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.
2020-02-22 12:59:13 +00:00
He Junyan
7e7ab6e1f8 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.
2020-02-22 12:59:13 +00:00
Haihao Xiang
17d82e14e7 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
2020-02-21 17:30:29 +00:00
U. Artie Eoff
4573d3eefe 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.
2020-02-21 08:49:06 -08:00
U. Artie Eoff
39f2c932ee 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.
2020-02-21 08:28:10 -08:00
He Junyan
15e169fbf1 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
2020-02-21 15:52:43 +00:00
Víctor Manuel Jáquez Leal
57e792136c 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.
2020-02-21 15:11:31 +00:00
U. Artie Eoff
13c3b8ba5b 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
2020-02-21 14:40:26 +00:00
Víctor Manuel Jáquez Leal
c4d8b5c44c 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>
2020-02-17 09:08:34 +01:00
Víctor Manuel Jáquez Leal
566af572af vaapipostproc: demote log message to trace level 2020-02-16 12:22:16 +00:00
Víctor Manuel Jáquez Leal
c55309c2ed libs: video-format: set general vaapi log category
Instead of logging in an unspecified category, set the default vaapi.
2020-02-16 11:59:07 +00:00
U. Artie Eoff
5df8cf0cdb libs: utils: guard EncSliceLP for VA-API < 0.39.1
Relates to #234
2020-02-15 11:51:02 -08:00
Haihao Xiang
2aec396efd libs: h265enc: Set VA_PICTURE_HEVC_INVALID flag for invalid picture 2020-02-14 20:21:11 +08:00
Víctor Manuel Jáquez Leal
96cdebf185 libs: remove crumbs of libva < 0.39
All these guarded code seem like leftovers of commit 920b1ec7a. This
patch completes that missing clean up.
2020-02-11 12:32:33 +01:00
U. Artie Eoff
0f1b1f40e5 libs: VA explicit color standard not supported until 1.2.0
VAProcColorStandardExplicit and associated VAProcColorProperties
(primaries, transfer and matrix) are not supported until
VA-API 1.2.0.

Use VAProcColorStandardNone instead of VAProcColorStandardExplicit
if VA-API < 1.2.0.

Fixes #231
2020-02-11 00:38:40 -08:00
U. Artie Eoff
9d865453e1 libs: utils: WA: use explicit for sRGB colorimetry
Addresses #228 on iHD side.  It seems iHD can't handle
VAProcColorStandardSRGB in all situations for vpp.  But
it has no problem when we specify the sRGB parameters
via VAProcColorStandardExplicit parameters.
2020-02-10 09:36:46 -08:00
U. Artie Eoff
5fe553f4c7 libs: filter: set vpp input/output color range
We've always sent VA_SOURCE_RANGE_UNKNOWN to the driver.
And, the [iHD] driver essentially computes the same color
range as gstreamer when we send VA_SOURCE_RANGE_UNKNOWN for
cases were gstreamer computes it automatically.  But,
if the user wants to make it explicit, we should try
to honor it.
2020-02-08 10:07:58 +00:00
U. Artie Eoff
9542d55efb libs: utils: map GstVideoColorRange to VAAPI VPP 2020-02-08 10:07:58 +00:00
Víctor Manuel Jáquez Leal
33c80bccfe vaapidecode: don't remove chroma-site nor colorimetry
Since now they can be handled by vaapipostproc.
2020-02-07 15:54:27 +01:00
U. Artie Eoff
2b6fa19665 vaapipostproc: use sink resolution to calculate src colorimetry
The default output colorimetry is persuaded by the output
resolution, which is too naive when doing VPP cropping
and/or scaling.  For example, scaling 4K(sink)->1080P(src)
resolution (i.e. both YUV) results in bt2020(sink)->bt709(src)
colorimetry selection and some drivers don't support that
mode in vpp.

Thus, if output (i.e. downstream) does not specify a
colorimetry then we use the input resolution instead of the
output resolution to create the default colorimetry.  Also,
note that we still use the output format since it may be a
different color space than the input.  As in the example
above, this will result in bt2020(sink)->bt2020(src)
colorimetry selection and all drivers (afaik) should support
that in vpp.
2020-02-05 10:33:23 -08:00
U. Artie Eoff
c6d8ee737f vaapipostproc: set srcpad colorimetry unconditionally
We always need a srcpad colorimetry for VAAPI VPP
operations.

Also, check the return value of _set_colorimetry.
2020-02-05 10:16:16 -08:00
U. Artie Eoff
654e824555 vaapipostproc: do not override explicit srcpad colorimetry
If colorimetry has been set by a capsfilter (e.g.
vaapipostproc ! video/x-raw,colorimetry=bt709) then
don't try to override it.  Previously, the aforementioned
capsfilter will fail to negotiate if default colorimetry
is not the same as the capsfilter (e.g. 4K resolutions).
2020-02-05 10:16:16 -08:00
U. Artie Eoff
c01f2e30d6 vaapipostproc: set vpp filter colorimetry
Set the input and output colorimetry for vpp filter.
2020-02-05 10:16:16 -08:00
U. Artie Eoff
1c7e820805 libs: filter: support vpp input/output color standard
Add API function to allow setting the input and output vpp
color standard from GstVideoColorimetry.
2020-02-05 10:16:16 -08:00
U. Artie Eoff
bc2c483f13 libs: utils: map GstVideoColorimetry to VAAPI VPP
Fallback to VAProcColorStandardExplicit if there is no
1:1 mapping.
2020-02-05 09:59:43 -08:00
U. Artie Eoff
c42938fd53 libs: display: add vpp color standard quirk for i965 driver
The i965 does not properly report supported vpp color
standards.
2020-02-04 13:59:59 -08:00
Víctor Manuel Jáquez Leal
7f61ad7938 vaapivideobufferpool: dmabuf implies allocator
Some code can be optimized since only if the dmabuf allocator is set,
the internal flag of dmabuf is TRUE, thus there's no need to evaluate
the allocator address.
2020-02-02 18:04:35 +01:00
Víctor Manuel Jáquez Leal
62f3329455 vaapivideobufferpool: reject configuration if allocator isn't vaapi
If the requested allocator in set_config() is not a VAAPI valid one,
reject the configuration, instead of lying and using a private one.

This patch superseeds !254 and !24
2020-02-02 17:22:43 +01:00
Víctor Manuel Jáquez Leal
5eca31b5e8 vaapivideobufferpool: add explanation for allocator reconfig 2020-02-02 17:22:43 +01:00
Víctor Manuel Jáquez Leal
377dd0cc6c vaapivideobufferpool: check for vaapi meta first
If the configured meta doesn't request vaapi meta then it is not a
vaapi buffer pool. Bail out as soon as possible.
2020-02-02 17:22:43 +01:00
Víctor Manuel Jáquez Leal
ed505f5ed4 vaapivideobufferpool: turn errors into warnings
set_config() vmethod should fail gracefully, thus upstream could
negotiate another pool if possible.

Instead of sending error messages to the bus, let demote the level
to warning.
2020-02-02 17:22:43 +01:00
Víctor Manuel Jáquez Leal
67c0bf2cdb libs: display: log out vendor string when available
This is useful while asking for logs to know the used driver.
2020-01-29 18:27:50 +01:00
Víctor Manuel Jáquez Leal
9bb65e4c10 libs: surface: initialize VASurfaceAttribExternalBuffers
Initialize VASurfaceAttribExternalBuffers using compiler's syntax
rather than using memset().
2020-01-28 12:01:58 +01:00
Víctor Manuel Jáquez Leal
bb72efb2e7 libs: surface: merge two loops into one
Merge two loops into one for setting offsets and strides in the
external buffer descriptor.
2020-01-28 12:01:35 +01:00
Víctor Manuel Jáquez Leal
dd3df4589d libs: surface: surfacepool: rename variable for clearity
In order to be readable, the meaningless 'flags' is renamed to
surface_allocation_flags, which is clearer.
2020-01-28 12:00:12 +01:00
Víctor Manuel Jáquez Leal
4778882728 vaapivideobufferpool: Reuse internal allocator is possible.
Instead of creating a new allocator when upstream requests a different
allocator, this patch tries to reuse the internal allocator if it was
already initializated.

If the stream changes, then either one will be unref and a new
allocator is created.
2020-01-27 20:31:12 +00:00
Víctor Manuel Jáquez Leal
9fa177951e vaapivideobufferpool: Log messages in proper category.
The log messages where logged in the GstBufferPool category because
the instance was not properly casted. This fix that situation.
2020-01-27 19:08:37 +01:00
Víctor Manuel Jáquez Leal
ee3d4c3206 libs: display: driver quirks mechanism
This mechanism comes from ffmpeg vaapi implementation, where they have
their own quirks.

A specific driver is identified by a substring present in the vendor
string. If that substring is found, a set of bitwise flags are store.
These flags can be accessed through the function
gst_vaapi_display_has_driver_quirks().

The purpose for this first quirks is to disable the put image try for
AMD Gallium driver (see [1]).

1. https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/merge_requests/72
2020-01-24 12:21:59 +00:00
Víctor Manuel Jáquez Leal
7a186975cc plugins: renable Mesa Gallium driver 2020-01-24 12:21:59 +00:00
Víctor Manuel Jáquez Leal
0815899121 vaapivideobufferpool: validate returned meta
Validate if the meta returned by gst_buffer_get_vaapi_video_meta() in
the acquired buffer is not null.

This situation should be very "pathological", but still it is better
be safe since that meta might be used later to create a new dma
buffer.
2020-01-24 11:55:22 +01:00
Philipp Zabel
89f202ea2e vaapivideobufferpool: always update/release the underlying surface proxy
gst_vaapi_video_buffer_pool_reset_buffer() is called when the sink
releases the last reference on an exported DMA buffer. This should
release the underlying surface proxy. To avoid releasing the wrong
surface due to a stale surface proxy reference in the buffer's
GstVaapiVideoMeta, always update the reference to the correct surface
in gst_vaapi_video_buffer_pool_acquire_buffer().
2020-01-24 09:10:44 +00:00
Víctor Manuel Jáquez Leal
21dd66b5e4 libs: context: select vaCreateSurfaces version according attributes
This commit tries to centralize the selection of vaCreateSurfaces
version, instead of having fallbacks everywhere.

These fallbacks are hacks, added because new drivers use the latest
version of vaCreateSurfaces (with surface attributes) [1], meanwhile
old drivers (or profiles as JPEG decoder in i965) might rather use the
old version.

In order to select which method, there's detected hack: each config
context has a list of valid formats, in the case of JPEG decoder the
list only contains "rare" 4:2:2 formats (ICM3, GRAY8) which aren't
handled correctly by the current gstreamer-vaapi code [2].

The hack consist in identify if the format list contains an arbitrary
preferred format (which is suposedly well supported by
gstreamer-vaapi, mostly NV12). If no prefered colour format is found,
the the old version of vaCreateSurfaces is used, and the surfaces wil
be mapped into a image with their own color format.

1. https://bugzilla.gnome.org/show_bug.cgi?id=797143
2. https://bugzilla.gnome.org/show_bug.cgi?id=797222
2020-01-23 21:24:28 +01:00
Víctor Manuel Jáquez Leal
78c3afea71 libs: context: add debug category for context 2020-01-22 19:52:52 +00:00
Víctor Manuel Jáquez Leal
35e5721047 libs: blend: guard VA_BLEND_GLOBAL_ALPHA 2020-01-22 20:22:07 +01:00
Víctor Manuel Jáquez Leal
e25ef7dfc2 vaapiencode: promote info to warning
Let's notify user about using constrained-baseline instead on
requested basline profile.
2020-01-21 14:12:29 +01:00
Nicolas Dufresne
866a9f069d vaapih264dec: Add a property to assume constrained-baseline
When baseline-as-constrained is set, the decoder will expose support
for baseline decoding and assume that the baseline content is
constrained-baseline. This can be handy to decode streams in hardware
that would otherwise not be possible to decode. A lot of baseline
content is in fact constrained.
2020-01-19 15:55:47 +00:00
Víctor Manuel Jáquez Leal
73159cdc5d vaapih264enc: accept baseline as constrained baseline compatible 2020-01-19 15:14:14 +00:00
Víctor Manuel Jáquez Leal
9f627ef234 vaapih264enc: update level in src caps
And, if downstream requests a specific level, the caps are not
negotiated, because there is no mechanism right now to specify a
custom level in the internal encoder.
2020-01-19 14:26:18 +00:00