1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00
Commit Graph

38 Commits

Author SHA1 Message Date
Lynne
a9b2c10eee hwcontext_vulkan: use host image copy 2025-06-11 01:20:18 +09:00
Lynne
435db9bb49 vulkan: enable VK_KHR_shader_subgroup_rotate
Yet another thing that should've been always present.
2025-05-20 19:53:02 +09:00
Lynne
e040c087c7 vulkan: add support for expect/assume
This commit adds support for compiler hints.
While on AMD these are not used/needed, Nvidia benefits from them, and gives
a sizeable 10% speedup on 4k.
2025-04-14 06:10:43 +02:00
Lynne
66b8c92df2 vulkan_ffv1: cache only 2 lines when decoding RGB
This reduces the intermediate VRAM used for RGB decoding by a
factor of 100x for 6k video.
This also speeds the decoder up by 16% for 4k RGB24 and 31% for 6k video.

This is equivalent to what the software decoder does, but with less pointers.
2025-04-14 06:10:42 +02:00
Lynne
8804ae158b vulkan_functions: add note to update ff_vk_extensions_to_mask
Otherwise, the extension looks like its enabled, but isn't
actually used by anything.
2025-03-27 17:22:12 +01:00
Lynne
67eb01b458 hwcontext_vulkan: enable VK_KHR_video_maintenance2
Enables some fixes for the video specifications, and a new feature.
2025-03-17 08:49:12 +01:00
Lynne
851a84650e hwcontext_vulkan: check if semaphores are exportable before enabling exporting
lavapipe recently added support for external_semaphore_fd, but only for syncfiles,
not for opaque file descriptors.

The code is written to allow using syncfiles later on.

Ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12422
2025-01-13 10:44:30 +09:00
Lynne
d8f301cdf2 ffv1enc_vulkan: switch to receive_packet
This allows the encoder to fully saturate all queues the GPU
has, giving a good 10% in certain cases and resolutions.

This also improves error resilience if an allocation fails,
and properly cleans up after itself if it does.
2024-11-26 14:14:15 +01:00
Lynne
e3676d96cb hwcontext_vulkan: move device feature struct setup to a new function 2024-10-04 10:10:43 +02:00
Lynne
535e5eb7f3 hwcontext_vulkan: enable VK_KHR_shader_relaxed_extended_instruction 2024-10-04 10:10:43 +02:00
Lynne
0d5bfd0b21 vulkan_functions: change extension type to a typedef uint64_t
We were getting a bit too close for comfort to the 32-bit limit
on enums.
2024-10-04 10:10:42 +02:00
Lynne
37d5cb84e8 vulkan: check if current buffer has finished execution before picking another
This saves resources, as dependencies are freed/reclaimed with a lower latency,
and provies a speedup.
2024-10-04 10:10:42 +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
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
46c13834b6 hwcontext_vulkan: enable VK_KHR_video_maintenance1
We require it for encoding.
2024-08-16 01:22:15 +02:00
Lynne
2ce0e51503 hwcontext_vulkan: add support for Vulkan encoding 2024-08-11 05:13:14 +02:00
Lynne
55adcb4fc5 hwcontext_vulkan: add support for VK_EXT_shader_object
We'd like to use it eventually, and its already covered by
the minimum version of the headers we require.
2024-08-11 05:13:13 +02:00
Lynne
a30b7c0158 hwcontext_vulkan: initialize optical flow queues if available
Lets us implement FPS conversion.
2024-08-11 05:13:10 +02:00
Lynne
ecdc94b97f vulkan_av1: port to the new stable API
Co-Authored-by: Dave Airlie <airlied@redhat.com>
2024-03-25 08:54:40 +01:00
Lynne
358919506d vulkan: enable VK_KHR_cooperative_matrix
It's of interest to API users, and of interest to us,
as a DCT/DST can be implemented via matrix multiplies.
2023-08-26 23:14:53 +02:00
Lynne
160a415e22 lavfi: add nlmeans_vulkan filter 2023-05-29 00:42:01 +02:00
Lynne
dfff3877b7 vulkan: add support for the atomic float ops extension 2023-05-29 00:42:01 +02:00
Lynne
77478f6793 av1dec: add Vulkan hwaccel 2023-05-29 00:42:00 +02:00
Lynne
b5eaeb1f13 vulkan: rewrite to support all necessary features
This commit rewrites the majority of vulkan.c to enable its use
as a general-purpose high-level utility code, usable for decoding,
encoding, and filtering of video frames.

The dependency system was rewritten to simplify management of
execution.

The image handling system was rewritten to accomodate multiplane
images.

Due to how related all the new features were, this is a single
commit.
2023-05-29 00:41:48 +02:00
Lynne
b15104ed97 vulkan: add support for retrieving queue, query and video properties 2023-05-29 00:41:47 +02:00
Lynne
e5e12c5078 hwcontext_vulkan: load query-related functions
Needed for both encoding and decoding.
2023-05-29 00:41:41 +02:00
Lynne
6dfa29a58d hwcontext_vulkan: add functions for video decoding 2023-05-29 00:41:40 +02:00
Lynne
571756bf2f hwcontext_vulkan: use VK_EXT_physical_device_drm to derive DRM to Vulkan
Finally, a way to directly identify a Vulkan device from a DRM device!
2023-05-29 00:41:40 +02:00
Lynne
f50bc930a4 hwcontext_vulkan: add support for descriptor buffers 2023-05-29 00:41:39 +02:00
Lynne
74b202b839 hwcontext_vulkan: enable VK_KHR_synchronization2 if supported 2023-05-29 00:41:36 +02:00
Lynne
fddfb0ebf8 hwcontext_vulkan: enable support for YCbCr samplers 2023-05-29 00:41:36 +02:00
Lynne
3c831847a8 hwcontext_vulkan: avoid using 64-bit enums
MSVC (2016, but possibly more) still force enums to be basic ints.
2022-01-27 10:27:09 +01:00
Wu Jianhua
b3624069f0 avutil/hwcontext_vulkan: fully support customizable validation layers
Validation layer is an indispensable part of developing on Vulkan.

The following commands is on how to enable validation layers:

ffmpeg -init_hw_device vulkan=0,debug=1,validation_layers=VK_LAYER_LUNARG_monitor+VK_LAYER_LUNARG_api_dump

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-26 10:36:39 +01:00
Lynne
1d06084171 vulkan: fix checkheaders 2021-11-19 16:47:28 +01:00
Timo Rothenpieler
fedf4ff85c avutil/vulkan: load win32 external memory functions 2021-11-14 12:50:32 +01:00
Lynne
57e11321ea hwcontext_vulkan: use vkDeviceWaitIdle instead of vkWaitSemaphores on uninit
To silence a possible validation layer bug, switch the function. It only gets
triggered by vf_libplacebo, which is odd.
2021-11-12 14:45:17 +01:00
Lynne
d05a18cdc7 lavu: move hwcontext_vulkan's function loader into separate files
This allows for the loader to be shared with libavcodec and libavfilter.
2021-11-12 05:23:40 +01:00