Commit graph

1860 commits

Author SHA1 Message Date
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
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
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
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
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
He Junyan
5e612aeb84 libs: videopool: fix a condition race for pool allocate. 2020-03-06 12:40:48 +00: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
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
Víctor Manuel Jáquez Leal
8c08ef31a5 libs: surface: surfacepool: Add allocation flags in constructors. 2020-02-23 13:12:15 +01: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
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
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
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
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
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
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
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
3df5bfc06d libs: encoder: h264: document gst_vaapi_encoder_h264_supports_avc() 2020-01-19 14:57:38 +01:00
Philipp Zabel
209e1b5bf0 libs: encoder: h264: Add gst_vaapi_encoder_h264_supports_avc()
AVC output requires packed header support in the driver.
2020-01-19 14:57:04 +01:00