Commit Graph

6414 Commits

Author SHA1 Message Date
Anton Khirnov
6940a6de2f lavu/frame: add side data storing view ID for multi-view video 2024-09-23 17:11:38 +02:00
Lynne
bc36fe6f1f
vulkan: use push descriptors where possible
Push descriptors are in theory slightly faster, but come with
limitations for which we have to check.

Either way, they're not difficult to implement, so even though
no one should be using peasant-tier descriptors, do it anyway.
2024-09-23 13:41:07 +02:00
Lynne
8a7af4aa49
vulkan: add support for regular descriptor pools
This permits:
 - The use of Vulkan filtering on many more devices
 - Better debugging due to lack of descriptor buffer support in layers

Much of the changes here are due to a requirement that updates to
descriptors must happen between the command buffer being waited on,
and the pipeline not being bound.

We routinely did it the other way around, by updating only after
we bind the pipeline.
2024-09-23 13:40:38 +02:00
Lynne
3d75ba7495
vulkan: separate out descriptor layouts from sets
Just avoids a single temporary allocation.
2024-09-23 13:40:38 +02:00
Lynne
2942ca802a
hwcontext_vulkan: forward debug_mode to check_extensions() for devices
This allows disabling of certain extensions when debug mode is turned on.
2024-09-23 13:40:37 +02:00
Lynne
b5184c5d45
hwcontext_vulkan: add the PROFILE_INDEPENDENT only when needed 2024-09-23 13:40:36 +02:00
Lynne
a577d313b2
hwcontext_vulkan: add support for implicit DRM synchronization
More recent kernel versions allow for users to extract a sync_file
handle from a DMA-BUF, which can then be imported into Vulkan as a
binary semaphore.

This finally allows for synchronization between Vulkan and DMA-BUF
images, such as those from screen capture software, or VAAPI,
avoiding any corruption artifacts.

This is done fully asynchronously, where we use the kernel's
given binary semaphores as a dependency to increment the image's
usual VkSemaphores we allocate. The old imported binary semaphores
are cleaned up after execution as usual.

In the future, hwcontext_drm should receive support for explicitly
synchronized images as well, which would make the synchronization
more robust and portable.
2024-09-22 02:11:08 +02:00
Lynne
2395444c80
vulkan: add ff_vk_exec_add_dep_bool_sem
This function simply takes in a binary semaphore as a dependency
to an execution.
2024-09-22 02:11:08 +02:00
Lynne
c4048013e5
vulkan: flexibly allocate temporary imageviews
No reason to allocate 16 when 3 will do.
2024-09-22 02:11:07 +02:00
Lynne
1445102e68
hwcontext_vulkan: fix VUID-VkPhysicalDeviceImageFormatInfo2-usage-requiredbitmask
fmt_props.usage was initialized to 0 as create_info.usage was set later.
2024-09-22 02:11:04 +02:00
Brad Smith
2bf588f273 libavutil/ppc: Make use of getauxval() and elf_aux_info() on ppc
Modern Linux has getauxval() and FreeBSD/OpenBSD ppc have elf_aux_info().

Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-21 03:11:22 -04:00
James Almer
90d12c24c5 avutil/frame: add an LCEVC enhancement data payload side data type
Signed-off-by: James Almer <jamrial@gmail.com>
2024-09-19 08:45:48 -03:00
Lynne
8875da347a
hwcontext_vulkan: consider encode DBPs as always independent 2024-09-18 05:59:46 +02:00
Lynne
32d47166c8
hwcontext_vulkan: fix p->img_qfs
The array was tied to our old queue API, which meant that if users
set it, it was never set.
2024-09-18 05:59:41 +02:00
Lynne
0fa6f33875
hwcontext_vulkan: add support for x2bgr10 and proper DRM mappings for 10-bit images
This allows mapping of 10-bit DRM images.
2024-09-16 14:03:56 +02:00
Marvin Scholz
5dfc547f25 avutil/file: use av_err2str to simplify code
No need to explicitly specify the buffer here as it is only
ever passed to av_log, so av_err2str can be used.
2024-09-13 00:29:10 +02:00
Brad Smith
a3f79fd22a aarch64: Implement support for elf_aux_info(3) on FreeBSD and OpenBSD
FreeBSD 12.0+, OpenBSD -current and what will be OpenBSD 7.6 support
elf_aux_info(3).

Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-09 07:17:49 -04:00
Brad Smith
fe4b9ef69f avutil/cpu_internal: Provide ff_getauxval() wrapper for getauxvaul()
Initially used for getauxval() but will be used to add support for
other API, such as elf_aux_info().

Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-09 06:20:11 -04:00
Lynne
5e9845f11e
vulkan(_decode): fix, simplify and improve queries
The old query code never worked properly, and did some hideous
heuristics to read the status bit, and work that into a return
code.
This is all best left to callers to do, which simplifies
our code a lot.

This also fixes minor validation errors regarding calling queries
which are not in their active state.
2024-09-09 07:05:46 +02:00
Lynne
3415e0533f
hwcontext_vulkan: disable more false positive validation checks
Both of these are fundamentally incompatible with video decoding.

The third one can be tracked in the following validation layer issue:
https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/6627
2024-09-09 07:05:46 +02:00
Lynne
620822c0c5
vulkan: add a ff_vk_init function
This function sets the class correctly, and calls functions
that all users have to call anyway.
2024-09-09 07:05:45 +02:00
Lynne
0ffa967170
hwcontext_vulkan: ask for storage images by default
The issue is that we ask for storage images by default if
available, but because that is gated by the format supporting
storage images, and the check for the format supporting storage
images is gated by the usage, this resulted in a catch-22.
2024-09-09 07:05:45 +02:00
Lynne
c41ef7f2ff
hwcontext_vulkan: add PREP_MODE_GENERAL for non-transfer_dst images
Vulkan filters don't need images which can be transferred into.
2024-09-09 07:05:44 +02:00
Lynne
06483d039a
vulkan: error out if query is called without being initialized 2024-09-09 07:05:43 +02:00
Lynne
fd86c373c2
vulkan: use correct return codes for query errors 2024-09-09 07:05:43 +02:00
Marvin Scholz
8a314e3f11 lavu/opt: Fix return of uninitialised value
In one of the failure paths of av_opt_get_array, the ret variable
was accidentally declared again, shadowing the outer one and once when
jumping to the fail label would return the still uninitialised outer
one.

To fix this simply remove the local declaration of ret that shadowed
the outer one.

Introduced in d89930f866

Fixes: CID1618663 Uninitialized scalar variable
2024-09-07 20:42:26 +02:00
Marvin Scholz
b4e64b86ad lavu/opt: av_opt_set_array: fix uninitialised return
In one failure path for av_opt_set_array, the ret variable
was declared again, shadowing the outer one and writing the
return value to the wrong one and then after the goto returning
the uninitialized one instead.

Introduced in 450a3f58ed

Fixes: CID1619242 Uninitialized scalar variable
2024-09-07 20:39:42 +02:00
Timo Rothenpieler
7e35aeda03 lavu/opt: properly initialize av_opt_set_array return value 2024-09-07 20:21:01 +02:00
Anton Khirnov
4ef149249a lavu/opt: handle UINT options as the POD they are
Fixes operations on array UINT options.
2024-09-06 13:59:04 +02:00
Anton Khirnov
450a3f58ed lavu/opt: add API for setting array-type option values
Previously one could only replace the entire array with a new one
deserialized from a string. The new API allows inserting, replacing, and
removing arbitrary element ranges.
2024-09-06 13:59:04 +02:00
Anton Khirnov
d89930f866 lavu/opt: add API for retrieving array-type option values
Previously one could only convert the entire array to a string, not
access individual elements.
2024-08-27 16:53:16 +02:00
Anton Khirnov
4a5bb84515 lavu/opt: forward av_opt_get_video_rate() to av_opt_get_q()
The two functions are exactly the same.
2024-08-27 16:53:16 +02:00
Anton Khirnov
efe38286d1 lavu/opt: document underlying C types for enum AVOptionType 2024-08-27 16:53:16 +02:00
Ramiro Polla
abb4e13a0a avutil/aarch64: add AV_COPY128 and AV_ZERO128 macros 2024-08-26 10:26:59 +02:00
Niklas Haas
2a2e0aced2 avutil/dovi_meta: document static vs dynamic ext blocks 2024-08-16 11:48:02 +02:00
Lynne
604dfdb44c
hwcontext_vulkan: align host mapping size to minImportedHostPointerAlignment
This was left out of the recent rewrite of the system.
2024-08-16 01:22:16 +02:00
Lynne
18d964fc2c
vulkan: enable encoding of images if video_maintenance1 is enabled
Vulkan encoding was designed in a very... consolidated way.
You had to know the exact codec and profile that the image was going to
eventually be encoded as at... image creation time. Unfortunately, as good
as our code is, glimpsing into the exact future isn't what its capable of.

video_maintenance1 removed that requirement, which only then made encoding
images practically possible.
2024-08-16 01:22:16 +02:00
Lynne
46c13834b6
hwcontext_vulkan: enable VK_KHR_video_maintenance1
We require it for encoding.
2024-08-16 01:22:15 +02:00
Lynne
97e947a2a7
hwcontext_vulkan: setup extensions before features
The issue is that enabling features requires that the device
extension is supported. The extensions bitfield was set later,
so it was always 0, leading to no features being added.
2024-08-16 01:22:15 +02:00
Lynne
c3cbaf39bb
hwcontext_vulkan: don't enable deprecated VK_KHR_sampler_ycbcr_conversion extension
It was added to Vulkan 1.1 a long time ago.
Validation layer will warn if this is enabled.
2024-08-16 01:22:15 +02:00
Lynne
3f65d24075
hwcontext_vulkan: fix user layers, add support for different debug modes
The validation layer option only supported GPU-assisted validation.
This is mutually exclusive with shader debug printfs, so we need to
differentiate between the two.

This also fixes issues with user-given layers, and leaks in case of
errors.
2024-08-16 01:22:14 +02:00
gnattu
a1976e963f avutil/hwcontext_videotoolbox: silence warning for RGB
Hardware frames with RGB colorspace will not have a YCbCrMatrixKey.
Currently, it will spam the console with warning if rgb frame is
uploaded.

Signed-off-by: Gnattu OC <gnattuoc@me.com>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-08-15 20:10:33 +08:00
Lynne
d138d7a595
vulkan: make sure descriptor buffers are always DEVICE_LOCAL
Implementations are required to list memory heaps in the most optimal
order. But its better to be explicit for this particular allocation.
2024-08-13 19:05:20 +02:00
Lynne
e25667f9f1
hwcontext_vulkan: ignore false positive validation errors
Issue ref:
https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/6627
2024-08-11 05:13:18 +02:00
Lynne
ef11a6456d
hwcontext_vulkan: do not chain structs of unsupported extensions in vkCreateDevice
Fixes:

vkCreateDevice(): pCreateInfo->pNext<VkPhysicalDeviceOpticalFlowFeaturesNV> includes a
pointer to a VkPhysicalDeviceOpticalFlowFeaturesNV, but when creating VkDevice, the
parent extension (VK_NV_optical_flow) was not included in ppEnabledExtensionNames.
The Vulkan spec states: Each pNext member of any structure (including this one) in
the pNext chain must be either NULL or a pointer to a valid struct for extending
VkDeviceCreateInfo.
2024-08-11 05:13:17 +02:00
Lynne
d6c08a41cb
vulkan: load queue families upon loading properties
Avoids the need to call ff_vk_qf_init if manually filling in
a queue family structure.
2024-08-11 05:13:16 +02:00
Lynne
0b25f0bc1d
hwcontext_vulkan: correct comment in header 2024-08-11 05:13:16 +02:00
Lynne
5f0f1f7b7a
libavutil: deprecate the old Vulkan queue API, add doc/APIchanges entries 2024-08-11 05:13:15 +02:00
Lynne
83cd77563f
vulkan: add support for encode feedback queries 2024-08-11 05:13:15 +02:00
Lynne
2ce0e51503
hwcontext_vulkan: add support for Vulkan encoding 2024-08-11 05:13:14 +02:00