Commit graph

243 commits

Author SHA1 Message Date
He Junyan c24c4e9b3f jpegdecoder: fail early if no input caps have been provided
The jpegdecoder class does not implement the ->parse() virtual function,
and we always need to add the jpegparse element before it. So we should
set_needs_format of the decoder to TRUE, then if no parse before it, it
can fail with a "not-negotiated" error early, rather than go on and
generate unexpected error.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1829
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:41:53 +08:00
He Junyan cbbfab0f3b va: jpegdecoder: Do not check SOS state when parsing DRI marker.
According to spec, the JPEG_MARKER_DRI(Restart interval definition)
marker can come before the SOS marker. So we should not check the SOS
state when parsing the DRI marker.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3943>
2023-02-22 11:24:57 +00:00
Víctor Manuel Jáquez Leal 573eecac30 vah265enc: Use helper to update properties.
This is a continuation of the original patch by
 Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3996>
2023-02-20 18:18:27 +00:00
Mengkejiergeli Ba 735b6af5b9 va: Fix some code defects
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3919>
2023-02-20 16:02:38 +00:00
He Junyan 60731adea6 va: Avoid the array index overflow when filling 8x8 scaling list.
The VA API has not defined the scaling list entries for U/V planes
for the 4:4:4 stream. In fact, we do not meet the 4:4:4 format output
for H264 so far, and scaling list is not used frequently, so we just
print out some warning and ignore these scaling list values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3749>
2023-02-02 00:41:42 +00:00
Edward Hervey b01ed725be va: Fix path leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3755>
2023-01-19 16:41:44 +01:00
Seungha Yang aba7f7c7eb vajpegdec: Set maybe-leaked flag on template caps
The fixup function could return new caps object

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3642>
2022-12-27 17:15:20 +00:00
He Junyan ad0ba3ab7d va: Delay the VAProcPipelineCaps query after context created.
The VAAPI vaQueryVideoProcPipelineCaps() requires the context as the
parameter. So far, we always pass VA_INVALID_ID and it can succeed.
But the API does not say that and in theory, a valid context is required.
Now the new platform really needs a valid context and so we have to
delay that query until the context is created.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3613>
2022-12-21 14:31:23 +00:00
Victor Manuel Jaquez Leal 171a626c6c vaav1dec: Remove double caps unref.
There was a duplicated caps unref raising a warning.

Also it reorgs the sorrounding code for simplicity.

Fixes: #1196
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3587>
2022-12-16 19:18:25 +00:00
Víctor Manuel Jáquez Leal 901ad2b4f5 vajpegdec: Reenable element negotiation.
negotiation vmethod were overwritten by vabasedec, leading to errors.

This was a regression of commit b6538e0560.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3509>
2022-12-02 08:37:02 +00:00
Victor Manuel Jaquez Leal 4cbdf43e7d va: Handle input caps change.
Update output caps if it's notified by baseclass

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3328

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Victor Manuel Jaquez Leal 19b83bc156 vaav1dec: Use gst_va_base_dec_set_output_state().
And even that vaav1dec doesn't use vabasedec negotiate vmethod, it should align
with the new scheme of using base's width & height for surface size and
output_info structure for downstream display size negotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Victor Manuel Jaquez Leal e5417b2db7 vavp9dec: Use gst_va_base_dec_set_output_state().
As this element reopen the internal decoder differently, it only uses the helper
function to negotiate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Victor Manuel Jaquez Leal 6dfca46ada vampeg2dec: Streams are progressive by default.
By initializating progressive, then interlaced streams are detected correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Victor Manuel Jaquez Leal b6538e0560 va: Add and use common decode negotiate vmethod.
This vmethod can be used by decoders with the same VA decoder reopen logic:
same profile, chroma, width and height.

Also a new public method called gst_va_base_dec_set_output_state() with the
common GStreamer code for setting the output state, which is always called by
the negotiate vmethod.

In order to do this refactoring, new variables in vabasedec have to be populated
by the decoders:

* width and height define the resolution set in VA decoder. In the case of H264
  would be de coded_width and codec_height, or max_width and max_height in AV1.
* output_info is the downstream video info used for negotiation in
  gst_va_base_dec_set_output_state().
* input_state, from codec parent class shall be also held by vabasedec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Víctor Manuel Jáquez Leal 31c63a6e6c vaav1dec: Use gst_va_base_dec_prepare_output_frame().
And simplify a bit the code flow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Víctor Manuel Jáquez Leal 4a8ecc2dba va: Add and use gst_va_base_dec_prepare_output_frame().
This helper will do downstream negotiation and later will
allocate the output frame.

H265 and AV1 decoders don't use this approach since their output
frame allocation is different.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Víctor Manuel Jáquez Leal f1a9728b30 va: Remove last_ret error handling in decoders.
It was used in the early development of the base classes. Now it
shouldn't be needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
Víctor Manuel Jáquez Leal de5b76a922 va: Add and use gst_va_base_dec_process_output().
This function will copy the frame, if it's needed, and will apply buffer flags.

The function is used by all the decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
2022-12-01 18:54:14 +00:00
He Junyan 765adf5325 va: Fix the caps memory leak by gst_va_pool_new_with_config().
The gst_va_pool_new_with_config() will ref the caps, and so we need
to unref after that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3503>
2022-12-01 17:31:16 +00:00
Víctor Manuel Jáquez Leal c8a0d706ca va: Add render node name in non-first devices.
There could be multi-GPU setups where the non-first has more
entrypoints than the first one, and the elements names are not
homogeneous, leading to pipeline building error.

This patch add the render node in the elements names when they belong
to the non-first device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3491>
2022-12-01 16:00:55 +00:00
Victor Manuel Jaquez Leal cccbf1f02d vafilter: Increase the caps for HDR.
As they might be other medatadata types.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3473>
2022-12-01 15:17:49 +00:00
Victor Manuel Jaquez Leal b25b1be70d vafilter: Increase the number of 3DLUT caps to 16.
To fix the warning on Alderlake

vafilter gstvafilter.c:534:gst_va_filter_ensure_filters:<vafilter0>
vaQueryVideoProcFiltersCaps: list argument exceeds maximum number

Increase the number of caps to 16 as vadumpcaps does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3473>
2022-12-01 15:17:49 +00:00
He Junyan c365389930 va: Add H265 SCC profile support.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:45:19 +08:00
He Junyan 0952c556dc va: Add extended formats support such as 10/12 bits, 4:2:2 and 4:4:4.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:45:14 +08:00
He Junyan 17c416ca92 va: enable multi tile support for H265 encoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:45:07 +08:00
He Junyan 2f8ce208e8 va: enable vah265lpenc for low power mode H265 encoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:45:00 +08:00
He Junyan 2677d4c6db va: Add the low-delay-b frame support for H265.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:44:41 +08:00
He Junyan 9ee657cdee va: Add prediction direction attribute support for H265 encoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:44:33 +08:00
He Junyan 4e7eddeafe va: Register and enable and the vah265enc plugin.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:44:26 +08:00
He Junyan 3d99f24843 va: Implement the vah265enc plugin for va HEVC encoding.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
2022-12-01 09:44:08 +08:00
Víctor Manuel Jáquez Leal b2bfb066ec vabaseenc: Reduce logging noise if finish_frame fails.
Fixes: #1579
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3423>
2022-11-17 05:25:18 +00:00
Colin Kinloch 99fc124f25 videocrop, videobox: Simplify navigation event handling and support touch events
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3053>
2022-11-11 06:45:49 +00:00
Colin Kinloch 841f50f0d9 va: Fix vapostproc navigation event co-ordinate mapping
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3053>
2022-11-11 06:45:49 +00:00
Colin Kinloch d54e597278 va: Use gst_video_orientation_from_tag to parse orientation
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3053>
2022-11-11 06:45:48 +00:00
Víctor Manuel Jáquez Leal eb0f90f6ec vafilter: Log out processed surfaces for debug.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3373>
2022-11-11 04:19:54 +00:00
Víctor Manuel Jáquez Leal bc4aa017ac vadeinterlace, vapostproc: Drop output buffer if process failed.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3373>
2022-11-11 04:19:54 +00:00
Víctor Manuel Jáquez Leal 1f7cf1d408 va: caps: Fix raw caps for H264 encoding.
Mesa gallium and Intel i965 ill reports unsupported video formats.

This commit reverts ecb12a05 and adds a deeper workaround, since
ecb12a05 only fix the template caps, but not when renegotation
happens.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2466>
2022-11-09 06:15:23 +01:00
Víctor Manuel Jáquez Leal 4994487b8f vabaseenc: Log out the flow error name.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2466>
2022-11-09 06:15:23 +01:00
Víctor Manuel Jáquez Leal dbf8c38667 vah264enc: Enable parameters change while running.
1. Removes the verification if the internal encoder is not opened
   yet to allow the property setting.

2. And toggles on the base class' reconf flag for each property
   variable that can be modified at run time.

3. Mark those modifiable properties as mutable while playing.

Currently the run-time modifiable properties are:

qpi, qpp, qpb, bitrate, target percentage, target usage and rate control

Other properties can be enabled too, but they need testing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2466>
2022-11-09 06:15:21 +01:00
Víctor Manuel Jáquez Leal bd3c50e50f vabaseenc: Enable encoder reconfiguration.
Adds an internal function reset() which drains the internal queues and
calls the reconfig() vmethod.

This reset() method is called inconditionally at set_format() and in
handle_frame() if the instance's reconf flag is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2466>
2022-11-09 06:13:26 +01:00
Víctor Manuel Jáquez Leal 351a107ecc vah264enc: Avoid reopen encoder or renegotiate.
If parameters remain similar enough to avoid either encoder reopening
or downstream renegotiation, avoid it.

This is going to be useful for dynamic parameters setting.

To check if the stream parameters changed, so the internal encoder has
to be closed and opened again, are required two steps:

1. If input caps, profile, chroma or rate control mode have changed.
2. If any of the calculated variables and element properties have
   changed.

Later on, only if the output caps also changed, the pipeline
is renegotiated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2466>
2022-11-09 06:13:26 +01:00
Víctor Manuel Jáquez Leal 38f1a4ee3d vaencoder: Add gst_va_encoder_get_reconstruct_pool_config()
This method will return the caps configured in the reconstruct buffer
pool, and its maxium number of buffers to allocate.

The caps are needed later to know if the internal encoder has to be
reopened if the stream properties change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2466>
2022-11-09 06:13:25 +01:00
Victor Manuel Jaquez Leal bb86728a1a vah264enc: Fix properties documentation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3361>
2022-11-08 21:49:05 +00:00
Victor Manuel Jaquez Leal c60504bd9e va: Document device-path property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3361>
2022-11-08 21:49:05 +00:00
Victor Manuel Jaquez Leal 0918910a7d vavp8dec, vampeg2dec: Fix type name.
The camel case name is wrong when registering the type.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3361>
2022-11-08 21:49:05 +00:00
Víctor Manuel Jáquez Leal 96a6b33029 vacaps: Sort raw caps according their efficiency.
Caps negotiations considers template caps order. This patch sets the
correct order according the feture caps: VAMemory, DMABuf and
SystemMemory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3349>
2022-11-08 05:15:09 +00:00
Víctor Manuel Jáquez Leal bbd2bce11d vabasetransform: Fail if cannot import the input buffer.
Otherwise got a buffer double free.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3348>
2022-11-07 17:57:05 +00:00
He Junyan 1881d1826a va: baseenc: Do not import the VA surface from other display.
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1167
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3322>
2022-11-05 13:39:34 +08:00
He Junyan d51b29b1dc va: compositor: Do not use allocator and pool from other display.
Just like the va decoder, the compositor should not use allocator
and pool from other display. Also, when importing the input buffer,
if it is from other display, we should fallback to memory copy.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1167
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3322>
2022-11-05 13:39:34 +08:00