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

149 Commits

Author SHA1 Message Date
Lynne
f39884b3fd vulkan: fix driver warning for unrecognized structure
VkQueueFamilyQueryResultStatusPropertiesKHR was added with the
VK_KHR_video_queue extension, which NVK does not support yet.
Correctly classify it as part of the video extensions.
2025-11-12 10:36:48 +01:00
Lynne
dd32bb8855 vulkan: allow arrays of buffers
Could be useful.
2025-11-12 00:37:25 +01:00
Lynne
22cc958c58 Revert "hwcontext_vulkan: fix grayscale 10 and 12-bit formats using the new MSB formats"
This reverts commit 471acedec2.
2025-11-06 21:44:13 +01:00
Lynne
2c7732a676 Revert "hwcontext_vulkan: fix 3-plane 444 10 and 12-bit formats using the new MSB formats"
This reverts commit 41ecb203c5.
2025-11-06 21:44:13 +01:00
Lynne
38df9ba71b Revert "hwcontext_vulkan: fix planar 10 and 12-bit RGB formats using the new MSB formats"
This reverts commit 98ee3f6718.
2025-11-06 21:44:13 +01:00
Lynne
15e82dc452 Revert "hwcontext_vulkan: remove unsupported/broken pixel formats"
This reverts commit 5b388f2838.
2025-11-06 21:44:13 +01:00
Lynne
5b388f2838 hwcontext_vulkan: remove unsupported/broken pixel formats
We have no use for 14-bit pixel formats for now, so remove support for gray14,
which was broken due to the LSB padding issue.

Similarly YUVA at 10/12 bit was broken for the same reason.
2025-10-27 22:59:41 -03:00
Lynne
98ee3f6718 hwcontext_vulkan: fix planar 10 and 12-bit RGB formats using the new MSB formats 2025-10-27 22:59:41 -03:00
Lynne
41ecb203c5 hwcontext_vulkan: fix 3-plane 444 10 and 12-bit formats using the new MSB formats
We previously tried to fudge this somehow, but the pixel formats
are simply broken and we cannot use them without declaring them as MSB.
2025-10-27 22:59:41 -03:00
Lynne
471acedec2 hwcontext_vulkan: fix grayscale 10 and 12-bit formats using the new MSB formats 2025-10-27 22:59:41 -03:00
Lynne
1f72bf5ec8 vulkan: add support for 16-bit RGGB Bayer pixfmt 2025-08-08 01:06:11 +09:00
Timo Rothenpieler
262d41c804 all: fix typos found by codespell 2025-08-03 13:48:47 +02:00
Niklas Haas
053a113ad8 avutil/hwcontext_vulkan: don't over-map buffers with prior padding
If the image data is not at the start of the buffer allocation, such as
when the buffer has padding before the image data, this function maps too
much memory, since src_data + src_buf->size exceeds the buffer size.

Fix this by subtracting the difference between the buffer start and the
provided image data pointer from the size of the memory range to map.

An easy way to reproduce this issue is using the vf_pad filter, which
allocates image data buffers with a nonzero offset whenever padding is
requested before the start of the image data.
2025-07-15 12:46:11 +02:00
Lynne
e5bb448543 vulkan: maintain compatibility with old headers
Previous patch to fix these issues was incomplete.
2025-06-17 13:26:13 +09:00
Lynne
922a1ca989 vulkan: maintain compatibility with older headers 2025-06-12 00:17:29 +09:00
Lynne
3ac7d70291 hwcontext_vulkan: fix image copy
The patch was applied by mistake in an unfinished form.
This fixes the build and lets the code run.
2025-06-11 14:33:01 +09:00
averne
ba52d7802e vulkan: fix leak in FFVkExecPool 2025-06-11 13:30:07 +09:00
Lynne
a9b2c10eee hwcontext_vulkan: use host image copy 2025-06-11 01:20:18 +09:00
Niklas Haas
0a4cdf8822 avutil/vulkan: automatically enable shader device address usage bit
We require this internally when using descriptor buffers, so it makes sense
to enable it internally, also.
2025-05-28 12:21:20 +02:00
Niklas Haas
c2521c0cd2 avutil/vulkan: add YUVA pixel formats support
Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: nxtedition
2025-05-28 12:14:54 +02:00
Lynne
33a4d36101 hwcontext_vulkan: support AV_PIX_FMT_GBRP
Support was partially added previously in vulkan.c, but now it's fully
supported.
2025-05-01 09:34:44 +02:00
Lynne
37bd915042 vulkan: use _KHR suffix for push descriptor properties struct ID 2025-04-23 01:46:37 +02:00
Lynne
96ddce1b3c vulkan: move OPT_CHAIN out of hwcontext_vulkan
This allows for it to be shared.
Technically, implementations should not give drivers structs
that the drivers are not familiar with.
2025-04-22 13:43:19 +02:00
Lynne
cee34e0a55 vulkan: check that the max number of push descriptors is not exceeded
Just correctness. We don't exceed this on any known hardware, but
its better to check.
If we do, we simply fall back to regular descriptors.
2025-04-22 13:43:19 +02:00
Lynne
5098b1a345 vulkan: move feature<->usage mapping code outside of hwcontext_vulkan.c
Allows for it to be reused. In particular, for a future patch to make
vulkan hwaccels output DMABUF-backed VkImages.
2025-04-22 13:43:17 +02:00
Lynne
7cd1edeaa4 vulkan: drop bgr_workaround
Vulkan's main issue around using BGR is simple.
The letters in the shader don't match up (rgba in shader, bgra in format).
So of course, rather than allowing "bgra" or other permutations of
formats in the shader, they went the nuclear option and spent months writing
an extension to get rid of the need to have a format in the shader to begin
with.

All this to solve a problem that should never have existed to begin with.
This fixes BGRA images since enabling WithoutFormat, as the GPU now remaps
without your involvement.
2025-04-19 18:45:13 +02:00
Lynne
ca6392e0a7 vulkan: always enable ReadWithoutFormat/WriteWithoutFormat
This implements support for reading and writing storage images with
no format.
The issue is that we define our images as arrays, and arrays can
only have a single type, which means that f.ex. NV12 needs two
different images, R8 and RG8.

The only driver known not to advertise support for the extension
as a whole is Intel, because they have parial support for odd formats
we never use. Therefore, just always enable it by default.
2025-04-19 10:59:11 +02:00
Lynne
bb3ce284d7 vulkan: use a single command buffer per command buffer pool
We violated the spec, which, despite the actual command buffer pool
*not* being involved in any functions which require external synchronization
of the pool, *require* external synchronization even if only the
command buffers are used.

This also has the effect of *significantly* speeding up execution
in case command buffers are contended.
2025-04-16 23:38:16 +02: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
7b0156201b vulkan: fix logging level when erroring upon creating shader module 2025-04-14 06:10:34 +02:00
Lynne
4dadf71dce lavu/vulkan: skip adding NULL buffers as deps in ff_vk_exec_add_dep_buf
Allows for cleaner code.
2025-03-27 17:22:07 +01:00
Lynne
53ff9005b5 vulkan: add support for AV_PIX_FMT_GBRAP32 2025-03-17 08:49:15 +01:00
Lynne
4de023f953 vulkan: add ff_vk_exec_add_dep_wait_sem()
This adds a function which adds a regular timeline semaphore
as a wait-only dependency.
2025-03-17 08:49:15 +01:00
Lynne
f2a0bdd6b1 vulkan: unify handling of BGR and simplify ffv1_rct 2025-03-17 08:49:15 +01:00
Lynne
bbb06f1ffc vulkan: workaround BGR storage image undefined behaviour 2025-03-17 08:49:10 +01:00
Lynne
a5b90caacd vulkan: copy host-mapping buffer code from hwcontext
This is useful elsewhere.
2025-03-17 08:49:09 +01:00
Lynne
ed6ee32846 vulkan: add ff_vk_create_imageview 2025-03-17 08:49:09 +01:00
Lynne
7046e65e37 vulkan: rename ff_vk_set_descriptor_image to ff_vk_shader_update_img 2025-03-17 08:49:08 +01:00
Andreas Rheinhardt
27c82af2fe avutil/vulkan: Remove unused ff_vk_create_avbuf()
Unused since aea4d4b423.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-11 04:35:53 +01:00
Lynne
8631990f22 vulkan: take refs of frames using the regular buffer ref path
This simplifies the code, reduces allocations, and critically, does
not store references of frames, along with references to hw_frames_ctx.
The issue was that storing refs to frames while transferring stored
refs to hw_frames_ctx of frames, and so created a circular dependency,
which caused the Vulkan device to never be terminated.

This only stores what it strictly needs as a dependency, and enables
the frames context to be freed, even while doing asynchronous transfers.
2025-03-03 19:43:57 +01:00
Lynne
629e8a2425 vulkan: add support for AV_PIX_FMT_GRAY32 2025-03-01 13:11:13 +01:00
IndecisiveTurtle
b37ce9b016 libavutil/vulkan: Expose ff_vk_set_descriptor_image
Useful when creating a descriptor array of separate images
2025-02-28 13:44:49 +01:00
Lynne
f774a9376a vulkan: add .buf_elems to FFVulkanDescriptorSet
This enables users to specify a number that would be appended to
the buf_content string.
Saves users from needing to manually print to a string.

An earlier commit tried doing this via .elems, but it was
faulty, as this also incremented the total number of descriptors
in the descriptor set.
2025-02-21 03:19:20 +01:00
Lynne
b6bf568a44 vulkan: don't query video queue properties unless the extension is enabled
Fixes validation errors.
2025-02-21 03:19:19 +01:00
Lynne
1029f51285 vulkan: fix crash in ff_vk_shader_free
The issue is if a shader fails to compile, shd->desc_layout would
not exist, but nb_descriptor_sets would.
2025-02-18 10:44:49 +01:00
Lynne
5c59e6ce19 vulkan: enable using .elems field for buffer content definitions
This avoids needing to snprintf when the buffer only contains an array of a struct,
while letting the validation layers detect errors more reliably.
2025-01-22 00:09:32 +09:00
Lynne
2e06b84e27 vulkan: do not reinvent a queue context struct
We recently introduced a public field which was a superset
of the queue context we used to have.

Switch to using it entirely.

This also allows us to get rid of the NIH function which was
valid only for video queues.
2024-12-23 04:25:09 +09:00
Lynne
157cd820ad vulkan: remove pointless mutex locks
This code was simply incorrect through and through. It did not
protect what actually has to be protected in a multi-threaded setup.
Perhaps it was used to silence threading errors?

Either way, remove it, and document the correct way to use execution
pools in a threaded environment.
2024-12-23 04:25:09 +09:00
Lynne
187fd52864 vulkan: fix use of atomics for the current context index
The code used to use atomic, but over time, this got broken.
This commit also remmoves the is-the-last-submission-ready
shortcut, which rarely did anything.
There's also value in relying on the fact that contexts
always carry their frames in a strictly incremental order
with no gaps.
2024-11-28 01:29:21 +09:00
Lynne
ce8a070cf3 vulkan: only wait for fences on uninit if the context had a submission
This fixes a potential deadlock on exit.
2024-11-26 14:14:14 +01:00