Commit graph

125 commits

Author SHA1 Message Date
Matthew Waters
634fc913a6 vulkan/format: don't assign an uneeded boolean
We don't actually need the basics_primary/secondary boolean.  The
returned format is decided by the requested usage with fallbacks as
necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters
420548a6c6 vulkan/format: there is no current need to use the 64-bit feature flags
All of our feature flags are currently covered by the first
VkFormatFeatureFlag enum so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters
080b25cbfe vulkan/format: correct fallback features in from_video_info_2
The features were not actually used and were written into a boolean
value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Chris Spencer
2388932767 vkmemory: don't map memory more than once
vkMapMemory may not be called on a memory object that is already
host-mapped. If the gstreamer memory object is mapped more than once then
reuse the existing Vulkan mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5917>
2024-01-16 17:44:48 +01:00
Chris Spencer
865227b750 vkimagebufferpool: allow specifying initial image layout
The pool currently defaults to performing a layout transition to
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, with some special exceptions for
video usages. This may not be a legal transition depending on the usage.
Provide an API to explicitly control the initial image layout.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5881>
2024-01-13 05:54:00 +00:00
Scott Moreau
f0d15f335d gst-launch: accept option to set program name
The option --prog-name="PROGRAM-NAME" can be passed to set the program name.
The program name is used by gtk and gstreamer to set the class or app-id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5263>
2024-01-12 17:11:11 +00:00
Stéphane Cerveau
476c7efcb7 vulkan: decoder: create union for profile usage
As a profile can include a VkVideoDecodeUsageInfoKHR
or VkVideoEncodeUsageInfoKHR, use union to separate the both.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5701>
2024-01-10 17:15:12 +00:00
Stéphane Cerveau
15b719d7f6 vkbufferpool: add support for video encoded buffers
Add support for non video raw  buffers to allocate memory
such as in encoded content scenario.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5645>
2023-11-21 19:16:37 +00:00
Stéphane Cerveau
c6a5437e0d vkbufferpool: allow to set allocation params
Add the possibility to change the vulkan usage and mem properties from
external source.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5645>
2023-11-21 19:16:37 +00:00
Stéphane Cerveau
159f24c07f vulkan: use gst_vulkan_device_select_queue
Use gst_vulkan_device_select_queue api to retrieve a valid queue
in vkupload, vkdownload, vkimagebufferpool, and vkvideofilter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5656>
2023-11-21 13:51:21 +00:00
Stéphane Cerveau
74c6298eb7 vkdevice: select queue with expected flags
Allow to select a queue with the given flags
such as compute bit etc from a given device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5656>
2023-11-21 13:51:21 +00:00
Víctor Manuel Jáquez Leal
5bece78ca2 vkqueue: add decoder factory
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
4f475732bd vkdecoder: add gstvkdecoder helper object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
8ee3ec105c vkvideo-private: video structures and session handle
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Stéphane Cerveau
96daac8ac7 vkvideoutils: add GstVulkanVideoOperation enum
To differentiate a video/x-h264 caps use with a decoder or an encoder
and get the correct video profile, the API expects an enum
GstVulkanVideoOperation to handle this difference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
8ee0f04d8d vkvideoutils: add dec postfix to profiles
So it the future don't collide with encoding profiles.

Original-patch-by: Stéphane Cerveau <scerveau@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
bf7a01f3fd vkvideoutils: add video capabilities structure
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
8023e3c19a vkvideoutils: add gst_vulkan_video_profile_is_equal()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
13d78652b7 vkvideoutils: add gst_vulkan_video_profile_is_valid()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
f896e2a347 vkvideoutils: add VkVideoDecodeUsageInfoKHR in profile
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
fd1b1332b7 vkvideoutils: if unknown codec nullify pNext
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
d5036e4429 vkvideoutils: mark as private members of profile structure
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
e3054056ff vkimagebufferpool: set image's number of layers
Handle the image's number of layers as configuration so it can be set by the
user, still isn't exposed as function since it's very niche.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Stéphane Cerveau
d52d50570e vkmemory: avoid the property flag check
During the video session memory allocation, the property flags can
be different from the expected ones, so do not expect all the
property flags and test it with G_MAXUINT32

It's failing with driver 525.47.26 and NVidia HW NVIDIA GeForce
RTX 3050 and 2060

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
43ce583460 vulkan/operation: wait for pending objects at reset
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Víctor Manuel Jáquez Leal
0296c8a53a vulkan/operation: get query only if a operation is submitted
To avoid a validation error if get query is performed before.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Víctor Manuel Jáquez Leal
3464710bf0 vulkan/operation: remove stored fences at the end
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Víctor Manuel Jáquez Leal
405ae91ed7 vulkan/operation: don't fail if extension isn't available
gst_vulkan_operation_add_dependency_frame() is a noop if the required extensions
aren't available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Matthew Waters
d20d94cc48 vkformat: also use the correct srgb vs unorm when using older
gst_video_info_from_video_info()

Fixes sRGB colorspace chosen by GstVulkanSwapper and therefore used for
display.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5316>
2023-10-27 09:13:18 +00:00
Víctor Manuel Jáquez Leal
a2f875251f vkimagebufferpool: use GstVulkanOperation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:23 +00:00
Víctor Manuel Jáquez Leal
265f1274dc vkoperation: synchronization helper object
An operation is an arbitrary amount of work to be executed on the host, a
device, or an external entity such as a presentation engine.

The purpose of this object is to help on the operation's synchronization
through declaring explicit execution dependencies, and memory dependencies
between two sets of operations defined by the command’s two synchronization
scopes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal
c83c508c5e vulkan: add a timeline semaphore per image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal
964aec54b4 vkbarrier: Use guint64 for VkFlags and VkFlags2
While VkPipelineStageFlags is an enum (arguably backed as uint32 in 32bit
platforms), VkPipelineStageFlags2 is a redefinition of guint64; likewise for
VkAccessFlags and VkAccessFlags2.

This patch types both members in GstVulkanBarrierMemoryInfo as guint64 for
compatibility, so it could be used with or without synchronization2 vulkan
extension.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal
8809ce5648 vkmemory: unref queue in barriers
Queue might be assigned for queue transfers, so we need to unref it if the
memory has been assigned to a specific queue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal
5acd6c23b8 vkdevice: use macro VK_KHR_synchronization2 as guard
Instead of (defined(VK_VERSION_1_3) || (defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 170))

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Matthew Waters
48ab457d79 vulkan/physical-device: don't assume that queue_family_ops is filled
On old enough vulkan (< 1.2), we will never retrieve the family operations and
will perform a NULL pointer dereference when dumping the queue family op
properties.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5547>
2023-10-25 16:38:06 +11:00
Jordan Petridis
9f3b8c9366 vkwindow_xcb: Make the visible private field a guint
This field is used to store gbooleans (which are ints) but if it's
a :1 bit depth assigning ints to it changes it's value as the only
valid values are -1 and 0.

Make it a guint instead so the cast would be correct.

```
../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c:151:25: error:
implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
[-Werror,-Wsingle-bit-bitfield-constant-conversion]
    window_xcb->visible = TRUE;
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5432>
2023-10-23 10:43:52 +05:30
Víctor Manuel Jáquez Leal
b7ded81f7b vkbufferimagepool: short circuit usage for decoding
NVIDIA & RADV drivers don't report decoding features for color format. Setting
requested usage to zero to short circuit validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 18:11:55 +02:00
Matthew Waters
9d79852890 vkformat: assume that unknown rgb transfer is sRGB
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
b82a402bf1 vkformat: also check configured usage flags
This does also mean that if the primary format fails this check, we need
to try the secondary format before returning an error

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2957
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
4d3b03e8e8 vkformat: invert srgb and multiplane && planes > 1 checks
The primary format for RGB includes sRGB transfer but was not actually
being used.

The !(no_multiplane && planes > 1) check for YUV resulted in those
formats never being used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
8a9d630e3b vkformat: FORMAT_FEATURE_COLOR_ATTACHMENT also includes INPUT_ATTACHMENT
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
6c534655d4 vkformat: reorder RGBA formats before RGBx formats
Fixes gst_vulkan_format_to_video_format to use the RGBA formats instead
of RGBx formats.

Fixes vulkansink exposing a RGBx/BGRx format instead of the more
relevant RGBA/BGRA formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Stéphane Cerveau
c98f5c2bf4 vkvideoutils: fix memory leak in structure's string
Retrieve a const char* from structure for "chromat-format" and
avoid extra mem copy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Stéphane Cerveau
fc0ee45fb5 vkdevice: fix beta extensions symbol
Missing 's' to VK_ENABLE_BETA_EXTENSIONS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Stéphane Cerveau
c1149d60c1 vkphysicaldevice: fix leak with queue_family_query_props
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Stéphane Cerveau
6920166af4 vulkan: fix C2099 error with VS2019
As VK_FORMAT_FEATURE_2_xxx are defined as static const variable, the
vscoce C compiler prevents the initialization of the  vk_usage_map
structure with error "C2099: initializer is not a constant".

Init the structure separately.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Víctor Manuel Jáquez Leal
06d793033d vulkan/format: use basic features (v1) as fallback
if vkGetPhysicalDeviceFormatProperties2 isn't available.

This approach assumes that, for basic features flags symbols,
VkFormatFeatureFlagBits and VkFormatFeatureFlagBits2 are binary equivalent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4746>
2023-06-01 13:58:47 +00:00
Matthew Waters
0a74a967e3 vulkan/format: don't rely on vulkan header version for function availability
e.g. android will have update vulkan.h headers but old platforms will
not contain the function and will result in a link error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4746>
2023-06-01 13:58:47 +00:00
Víctor Manuel Jáquez Leal
8b75e5fb57 vkvideoutils: fix code-style
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4716>
2023-05-26 10:08:27 +02:00