306 Commits

Author SHA1 Message Date
Stéphane Cerveau
0b26bebe35 vkdecoder-private: manage existing dpb pool
When the decoder wants to recreate the dpb pool
on resize event for example, an existing dpb pool
might exist, so it should be kept if the caps
are equal or destroy for new caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9614>
2025-08-28 08:35:57 +00:00
Stéphane Cerveau
167e41c343 vulkan: add basic AV1 encode support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8841>
2025-08-21 17:42:47 +00:00
Víctor Manuel Jáquez Leal
fc647552fa vulkan: enable video maintenance2 for inline session parameters
.. in decoders.

Inline session parameters allows to not create session parameters handlers for
every new stream parameters (such as SPS and PPS for H.264, for example), but
instead to pass them as a chained structure in the decoding main structure. This
is completely align with GStreamer decoder base classes.

Even that the previous approach is kept, if the devices doesn't support video
maintenance2, it shows a lot of validation errors.

Also it was required to add another parameter when enabling extension to verify
if the extension is linked with a device feature and if it is enabled.

Bump Vulkan API (and driver version for both decoders and encoders) to 1.4.306

Also bumped the ABI_CHECK_TAG because the CI finally catches up with the vulkan
video symbols that are not exposed by a public header (tough they are binary
public).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9585>
2025-08-21 05:22:19 +00:00
Víctor Manuel Jáquez Leal
8ce2ed05ac vkvideo-private: remove unused guards
Since this file is compiled only if vulkan video support is enabled with the
proper vulkan headers version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9585>
2025-08-21 05:22:19 +00:00
Víctor Manuel Jáquez Leal
1d60643a1a vkdevice: check for features when enabling extensions
Some extensions need to have enabled certain feature in the device. This patch
does that check by adding a new field in the extension list which is a function
that can be mapped to gst_vulkan_physical_device_has_feature_*() functions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9585>
2025-08-21 05:22:18 +00:00
Víctor Manuel Jáquez Leal
caae3b07e1 vkimagesbufferpool: another usage for non-independent profile flag
Fix validation issue VUID-VkImageCreateInfo-flags-08329 on old RADV hardwware.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9591>
2025-08-20 20:11:24 +02:00
Víctor Manuel Jáquez Leal
6d53576194 vkimagebufferpool: don't use independent profile flag for some usage
VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR, among others, needs the video profile
to use.

The patch clears the validation issue  VUID-VkImageCreateInfo-flags-08331

This is a continuation of !9550

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9570>
2025-08-20 06:37:03 +00:00
Víctor Manuel Jáquez Leal
101722d477 vkimagebufferpool: support video profile independent images
With video_maintenance1 extension is possible to create images independent of a
the video profile list, under that image will be processed.

With that extension is possible to share the same image for dynamic transcoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9550>
2025-08-16 15:36:02 +02:00
Víctor Manuel Jáquez Leal
71b787a39f vkdecoder-private: fix mistake from !9531
This was a very silent mistake.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9552>
2025-08-13 19:59:52 +02:00
Víctor Manuel Jáquez Leal
36b8b87b18 vk{decoder,encoder}-private: use API to check device version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9552>
2025-08-13 19:59:52 +02:00
Víctor Manuel Jáquez Leal
9be96a7a88 vkphysicaldevice: silence validation for features
With merge request !9438 the validation layer started to complain with
VUID-VkDeviceCreateInfo-pNext-02829

This patch fixes this ill-usage of Vulkan API, by removing the feature enabling
of sampler ycbcr conversion, since it was promoted since Vulkan 1.1, and in
GStreamer is only used in Vulkan Video operations, which are only enabled in
Vulkan 1.3+.

Also, these features detection and enabling were moved to a function called when
filling the physical device data, in order to check the API version of the
device driver before adding the enabling of the feature.

Finally, the getters were adapted to use the version feature structure if the
device driver version matches.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9544>
2025-08-13 15:24:05 +03:00
Víctor Manuel Jáquez Leal
9f8885c19c vkimagebufferpool: fix regression from !9492
On commit 1a7f0f162726f07f5723e0c1f43f2c6725d07c80 a regression were introduced
by omitting to initialize the profileCount field.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9545>
2025-08-12 20:15:49 +02:00
Víctor Manuel Jáquez Leal
f7c1eae481 vkencoder-private: remove duplicated definition
They are already declared in gstvkvideo-private.h

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9531>
2025-08-12 09:37:08 +00:00
Víctor Manuel Jáquez Leal
8b5c83696b vulkan: remove spurious video extension checking
Since they are expected dependencies. If the specific codec extension is loaded,
that means that dependencies are loaded too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9531>
2025-08-12 09:37:08 +00:00
Víctor Manuel Jáquez Leal
a62fa5d66e vkphysicaldevice: detect and dump Vulkan 1.4 properties and features
In order to link videomaintenance1, and others to come, without knowing if
Vulkan 1.4 features are chained in the device properties structure, a static and
inlined function was added in gstvkphysicaldevice-private.h. It was added in a
header file to avoid compiler warnings if it's not used because of old Vulkan
headers.

Also the value dump videomaintenance1 was moved to another function to pack
there all the future features to query which aren't part of a Vulkan release
yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9492>
2025-08-08 11:48:25 +00:00
Víctor Manuel Jáquez Leal
c84982b5c9 vulkan: fine grained access to API
This patch is the payment to my technical debt.

The symbol GST_VULKAN_HAVE_VIDEO_EXTENSIONS is defined at compilation-time if
the user requests for the usage of the Vulkan Video extensions. And we used this
symbol for anything related with Vulkan Video. But this is not the smartest
approach.

The rule should be:

- If the code allocates Vulkan Video resources, use
  GST_VULKAN_HAVE_VIDEO_EXTENSIONS

- Otherwise, use the Vulkan's guard for the used API

In this way, API version bumps will be easier.

Also, this commit marks the end of GST_VULKAN_HAVE_VIDEO_EXTENSIONS guarded code
for readability.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9492>
2025-08-08 11:48:25 +00:00
Víctor Manuel Jáquez Leal
92e2c5b29d vkoperation: refactor for fine grained guards and clean ups
Added a static inlined function in gstvkphysicaldevice-private.h for looking up
a specific vulkan structure in a chain.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9492>
2025-08-08 11:48:25 +00:00
Víctor Manuel Jáquez Leal
1a7f0f1627 vkimagebufferpool: refactor common code
Both gst_vulkan_image_buffer_pool_set_config() and
gst_vulkan_image_buffer_pool_alloc() functions share the same code to create
Vulkan images for different purposes.

This patch refactor them in a new helper function that creates the images and
stores them in a buffer if it's passed as output parameters, such as the
offsets.

This patch also adds specifics guards for Vulkan's symbols for better grained
API usage, but also for prepare_buffer() the guard is set where the symbol is
used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9492>
2025-08-08 11:48:25 +00:00
Víctor Manuel Jáquez Leal
f3f319a630 vkdevice: fine grained vulkan video extensions detection
The Vulkan Video extensions can be available, according to the specification,
since Vulkan 1.1, but with other extensions dependencies. That's why this patch
adds a field in the extension structure, which represents the extension
dependency that the specified extension requires. And they are specified by
Vulkan Video extensions.

This allow to have a single function to check if the extension can be enabled
both by optional extensions and video extensions.

Regardless that video extension can be loaded since Vulkan 1.1, they are rather
loaded since Vulkan 1.3, when synchronization2 was promoted, so it isn't
checked as video_queue dependency.

Finally, this patch checks for each guard symbol.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9492>
2025-08-08 11:48:24 +00:00
Víctor Manuel Jáquez Leal
80da022590 vulkan: private functions for physical device features
This is a continuation of !9483, but without back-porting.

Instead of checking the driver's API version to figure out if a physical device
feature is available and enabled, or even more, instead of checking for enabled
extensions in the driver, this patch adds private functions in the physical
driver to get the availability and enabling of features such as sampler ycbrc
conversion, synchronization2, timeline semaphore and video maintenance1.

And these new functions are used internally in the GstVulkanOperation object,
and the private object GstVulkanDecoder.

This approach is computationally cheaper, simpler and precise.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9492>
2025-08-08 11:48:24 +00:00
Víctor Manuel Jáquez Leal
573f401e58 vkvideoutils-private: make it private
Since we moved the GstVulkan generic decoder and encoder to private objects in
the library, there was not need to keep vkvideoutils public.

This patch turns it private and reduces the public API surface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9493>
2025-08-05 19:44:36 +00:00
Víctor Manuel Jáquez Leal
829de89122 vkphysicaldevice: enable sampler ycbcr, sync2 and timeline semaphore features
For the features VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR,
VkPhysicalDeviceSynchronization2Features and
VkPhisicalDeviceTimelineSemaphoreFeatures

The Vulkan specification states:

  If the `VkPhysicalDeviceXXXFeatures` structure is included in the `pNext`
  chain of the `VkPhysicalDeviceFeatures2` structure passed to
  `vkGetPhysicalDeviceFeatures2`, it is filled in to indicate whether each
  corresponding feature is supported. If the application wishes to use a
  `VkDevice` with any features described by `VkPhysicalDeviceXXXFeatures`,
  it **must** add an instance of the structure, with the desired feature members
  set to `VK_TRUE`, to the `pNext` chain of `VkDeviceCreateInfo` when creating
  the `VkDevice`.

And that was missing in the code.

Strangely, that functionality doesn't have a Valid-Usage ID assigned, so it
isn't caught by the validation layer.

This patch adds the structures in the physical devices to get them and later set
them in the device creation.

In order to link these features, videomaintenance1, and others to come, without
knowing if Vulkan 1.3 features are chained in the device properties structure, a
static and inlined function was added in gstvkphysicaldevice-private.h. It was
added in a header file to avoid compiler warnings if it's not used because of
old Vulkan headers.

Also the value dump videomaintenance1 was moved to another function to pack
there all these queried features.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9483>
2025-08-04 09:31:14 +00:00
Matthew Waters
4ed83e5973 vulkanfullscreenquad: add locks for synchronisation
Now all API can be accessed from any thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9337>
2025-07-08 11:43:13 +00:00
Hanna Weiß
3232e7a948 vulkan: Fix drawing too many triangles in fullscreenquad
was using a index buffer for triangle list but drawn as strip

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9338>
2025-07-07 21:56:50 +00:00
Víctor Manuel Jáquez Leal
c09cc64a5e vkencoder-private: free data on error
Co-authored-by: Stéphane Cerveau <scerveau@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7197>
2025-07-03 13:41:19 +02:00
Víctor Manuel Jáquez Leal
678affaa2f vkencoder-private: add gst_vulkan_encoder_rc_mode()
To get the updated rate control mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7197>
2025-07-03 13:41:19 +02:00
Víctor Manuel Jáquez Leal
0af329d505 vkencoder-private: fix array layer for layered DPB
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7197>
2025-07-03 13:41:19 +02:00
Víctor Manuel Jáquez Leal
88a302a3c9 vkencoder-private: free err when bailing
And log out the error message from the Vulkan call.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7197>
2025-07-03 13:41:15 +02:00
Víctor Manuel Jáquez Leal
7001d48483 vulkan: ycbcr conversion extension got promoted in 1.1.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7197>
2025-07-03 10:29:41 +02:00
Víctor Manuel Jáquez Leal
44acc0bfb1 vkimagebufferpool: set video meta to buffers if requested
This patch adds the possibility to attach video metas to allocated buffers if
API users request that option.

The main reason to add this meta is for the future usage of
gst_buffer_find_memory(), where the requested offset determines the memory
index.

In the case of multi-memory Vulkan images the offset of every component is
larger than the default offset determined by the format and frame size, because
of the buffer minimum size and memory alignment determined by the used driver.
Then, the offset is set in the buffer video meta.

In the case of single memory Vulkan images, the default offset is set in the
video meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9219>
2025-06-18 09:06:55 +00:00
Víctor Manuel Jáquez Leal
bbd8fbb023 vkimagebufferpool: remove unused variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9219>
2025-06-18 09:06:55 +00:00
Stéphane Cerveau
e82b80a74a vkerror: add invalid_video_std_parameters message
Add string to handle error related to the
codec standard parameters.

<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9212>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9212>
2025-06-17 23:44:18 +00:00
Víctor Manuel Jáquez Leal
72b7410511 vulkan: add best practices validation feature
It can be disabled in run-time via the environment variable
VK_KHRONOS_VALIDATION_VALIDATE_BEST_PRACTICES=false

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9119>
2025-05-30 00:36:40 +00:00
Víctor Manuel Jáquez Leal
b463d2b1da vulkan: remove vkDebugReportMessage() loading
Since it's not used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9119>
2025-05-30 00:36:40 +00:00
Víctor Manuel Jáquez Leal
8eae5e95b7 vulkan: use VK_EXT_debug_utils if available
Nowadays VK_EXT_debug_report is considered deprecated and it's recommended to
replace it it VK_EXT_debug_utils, which offer a way to ignore messages
considered false positives.

The approach is to try the extension first, if available at compilation time, if
not or if it fails to load, VK_EXT_debug_report fallbacks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9119>
2025-05-30 00:36:40 +00:00
Doug Nazar
9d91e4cfc2 vulkan: Free various props before being set
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8978>
2025-05-13 19:34:59 -04:00
Doug Nazar
5867c7900a all: Annotate *_set_property() contructor only props without free
Properties that are marked constructor only aren't required to be freed
before g_value_dup_*() as they can only be called once during construction.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8978>
2025-05-13 19:15:21 -04:00
Stéphane Cerveau
ba44f0c9e0 vkformat: add NV12 10 bits support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8282>
2025-04-10 19:58:47 +00:00
Doug Nazar
6e5937f9b5 vulkan/wayland: Init debug category before usage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8738>
2025-03-31 13:20:31 +00:00
Dongyun Seo
bbc6535a6b vkformat: fix build error
fix build error when VK_KHR_format_feature_flags2 is not defined.

Co-authored-by: Victor Jaquez vjaquez@igalia.com
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8655>
2025-03-26 00:26:02 +00:00
Stéphane Cerveau
93364189d0 vulkan/operation: fix timeline semaphore extension detection
As for synchronization2, the timeline semaphore has been
been promoted in 1.2 and does not have to be enabled explicitely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:21 +00:00
Matthew Waters
b9bbcf9202 vulkan/operation: fix synchronization2 extension detection
The synchronization2 extension is a core part of Vulkan 1.3.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:21 +00:00
Matthew Waters
e23bc6ed77 vulkan/device: only enable relevant extensions
Extensions can have a minimum set of dependencies (e.g. API version) and may
also be promoted to core in a later version.  Don't explicitly enable extensions
that fail to meet their requirements or that have been promoted to the core API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:21 +00:00
Matthew Waters
e7b8ac099f vulkan/operation: retrieve function pointers directly from the device
The instance API version supported may not be of the same version supported by
the device. It is possible that the function that is returned may be non-0
but not functional due to the requested API version of the instance limiting the
availability of calling the returned function.

Can be reproduced by running a pipeline with GST_VULKAN_INSTANCE_API_VERSION=1.1

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:21 +00:00
Matthew Waters
7452589ff8 vulkan/instance: allow the requested api version to be larger than the supported
Since Vulkan 1.1, the requested API version is the maximum API version that the
application is expecting to use. It is also possible for individual devices
(backed by potentially different drivers) may support a higher or lower API
version than the instance.  Both cases (higher and lower) should be supported
and as such, it is not an error to request an API version that is larger than
the instance supported API version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:21 +00:00
Matthew Waters
4692a45dea vkformat: fix format_from_video_info_2 to actually runtime check versions and extensions
If the vulkan plugin was compiled against a newer version than the supported
vulkan runtime instance or device, then it was possible for format retrieval to
fail.  Failure was due to unconditionally using newer extensions and features
without runtime checking them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:20 +00:00
Matthew Waters
51dda24a88 vulkan: fix device related API version checks
The API version exposed by a particular device can be completely different from
what is exported by the parent instance.  Since Vulkan 1.1 it is also possible
to use newer device API than supported by the instance API version (with the
appropriate version checks).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:20 +00:00
Matthew Waters
72860a20bf vulkan/physicaldevice: add methods for retrieving and checking against an API version
Most version checks should actually be done against the device API version and
not the instance API version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8554>
2025-03-06 12:14:20 +00:00
Matthew Waters
a2320509b4 vkfencecache: call parent release() only after resources have been removed
The parent class will allow the handle to be reused at the end of the function.
If we are still modifying the released fence, then another thread can acquire
the fence while we are still clearing some of its data and produce a data race
or a leaked fence depending on which thread wins.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8491>
2025-02-17 23:28:56 +00:00
Alexander Slobodeniuk
5a14de805e vkphysicaldevice: fix chaining up GObject's constructed virtual method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8416>
2025-02-10 17:49:29 +00:00