Commit graph

272 commits

Author SHA1 Message Date
He Junyan 6accb7a1f5 va: Only change video format in gst_va_video_info_from_dma_info()
The current way of using gst_video_info_set_format() will change all
fields of the GstVideoInfo. We only need to change its format, stride
and offset fields.

In order to keep the consistency with th common drm API, we rename the
gst_va_video_info_from_dma_info() into gst_va_dma_drm_info_to_video_info().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4883>
2023-06-26 16:18:23 +00:00
Stéphane Cerveau 53e48ce14d va: use GstH264Level enum in _va_h264_level_limits
The 1B value has been changed to 9 instead of 11 in the list
of level limits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4737>
2023-06-26 10:47:36 +00:00
He Junyan 83e307ac96 va: basedec: Select the best format of the whole caps
The current way only selects the best video format from the first
structure of the caps. The caps like:

  video/x-raw(memory:VAMemory),drm-format=(string)NV12;  \
  video/x-raw(memory:VAMemory),format=(string){ NV12, Y210 }

Will just choose NV12 as the result, even the bitstream is 10 bits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4928>
2023-06-25 10:55:23 +00:00
He Junyan 759857c203 va: basetransform: Copy the interested meta data for importing
The current way of using parent's copy_metadata() virtual function will
selectively filter out some meta such as crop meta. That virtual function
should be used when copying input buffer's meta data into output buffer,
not suitable when importing the input buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4887>
2023-06-21 21:12:23 +00:00
He Junyan ff2a75a2dd va: basetransform: Check the crop meta when importing
When the input buffer has crop meta, and we need to do copy, we
should consider the uncropped video size and copy the full size
of video memory.
The video meta in this case should contain the full uncropped
resolution info. We can use it to create full size va buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4887>
2023-06-21 21:12:23 +00:00
He Junyan 703ab45334 va: basetransform: Only need va pool for internal usage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4887>
2023-06-21 21:12:23 +00:00
Víctor Manuel Jáquez Leal 9825cd8951 vapostproc: evaluate op_flags validations as boolean
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4910>
2023-06-21 13:19:46 +02:00
He Junyan b59b77a02f va: Add helper functions to convert GstVideoInfoDmaDrm into va video info
The VA has its internal video format mapping(because different drivers may
have different interpretation for the same format), so we should convert the
info in GstVideoInfoDmaDrm into the according video info based on that mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4821>
2023-06-14 01:08:37 +00:00
He Junyan c72960b427 va: Replace the tabs into spaces in gstvacaps.h
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4821>
2023-06-14 01:08:37 +00:00
Víctor Manuel Jáquez Leal 53860147c6 va: bump libva version to 1.12
Remove all checks in gstva for all version lower than 1.12

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4781>
2023-06-08 08:50:04 +00:00
He Junyan 3497bbb8a8 va: No need to sort the device after registered
The va devices are already registered by the drm path order, so
there is no need to sort them again after registered.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4643>
2023-05-16 08:37:48 +00:00
He Junyan 8e52e42444 va: Sort udev path name before register the va plugins
The devices list returned by g_udev_client_query_by_subsystem() may
contain udev devices in disorder path name. For example, on some
platform it may contain renderD129 before renderD128 device. This
will cause we register wrong va plugin name. In this case, the
renderD129 will be registered as default plugins such as vah265dec,
while the renderD128 will be registered as varenderD128h265dec.
This conflicts with the non-udev version of gst_va_device_find_devices().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4643>
2023-05-16 08:37:48 +00:00
He Junyan 96e576a818 va: h265enc: map the mbbrc to correct enum value in get_property()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4509>
2023-04-28 16:46:24 +00:00
He Junyan 5d1c35bd16 va: h264enc: map the mbbrc to correct enum value in get_property()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4509>
2023-04-28 16:46:24 +00:00
Nirbheek Chauhan 479f0175b5 meson: Add feature options for optional va deps libdrm and gudev
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4428>
2023-04-28 15:22:31 +05:30
Nicolas Dufresne e709e2d97c meson: Add a wrap file for libgudev
And allow fallback to it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4447>
2023-04-19 22:47:19 +00:00
Víctor Manuel Jáquez Leal 292d6cdbed vaencoder: remove display reference in decode picture
Since it's possible to grab the VA display from the GstBuffer and
GstMemory, there's no need to keep a reference to it in
GstVaEncodePicture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3066>
2023-03-24 14:05:15 +00:00
Víctor Manuel Jáquez Leal 494169aad4 vadecoder: remove display reference in decode picture
Since it's possible to grab the VA display from the GstBuffer and
GstMemory, there's no need to keep a reference to it in
GstVaDecodePicture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3066>
2023-03-24 14:05:15 +00:00
Víctor Manuel Jáquez Leal e794fcaa1c va: add driver description in element metadata
In the same spirit of libva-win32 elements this patch shows the driver of each
element in gst-inspect, giving more information to the user. This driver
description is parsed from vaQueryVendorString from mesa and intel drivers,
while copied as is for others. Also appends the render node for multi gpu
systems.

Fixes #2349

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4204>
2023-03-20 15:27:25 +00:00
Seungha Yang 3bbfab1cf3 va: Return default device from device-path property getter
Otherwise application would not be able to know matching element
for wanted device. Typical use case of the read-only device path
(DXGI Adapter LUID, CUDA device index, etc) property is that
application enumerates physical devices and then selects matching
GStreamer element (in null state) via device path property.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4220>
2023-03-19 17:50:43 +00:00
Seungha Yang fe63034dd4 va: Don't error out on plugin registration
Keep enumerate devices and don't return FALSE on plugin_init()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4149>
2023-03-15 01:37:03 +00:00
Seungha Yang 7624871b00 va: Update "device-path" property description for Windows
DRM does not make sense on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4114>
2023-03-10 13:57:47 +00:00
Seungha Yang 7bc6ba63b2 va: Add Windows specific element type/feature naming support
Adapter LUID will be changed per boot. Use different naming rule on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4114>
2023-03-10 13:57:47 +00:00
Seungha Yang c1946c0209 va: Add support for Win32 backend
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4114>
2023-03-10 13:57:47 +00:00
Seungha Yang bc8db7bc3e va: Drop all GSlice bits
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4114>
2023-03-10 13:57:47 +00:00
Seungha Yang b6e45d0de8 vavp8dec: Fix return type of decode_picture()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:20 +00:00
Seungha Yang c5ae00f58c vajpegdec: Hide gst_jpeg_decoder_get_type() symbol
It's not a public symbol yet

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:20 +00:00
Seungha Yang fbf143b0fd vabaseenc: Fix return type of encode_frame vfunc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:19 +00:00
Seungha Yang 2f98234287 va: Fix struct empty initialization syntax
"struct Foo bar; bar = {};" is not a valid syntax. Also remove use
of __typeof__ which is GCC specific

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4113>
2023-03-06 13:39:19 +00:00
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