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

285 Commits

Author SHA1 Message Date
Niklas Haas
203c6a93d7 avutil/hwcontext_vulkan: actually limit number of queues
This option is parsed after it is used.
2025-11-12 15:25:07 +00: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
Kacper Michajłow
3eb0cb3b0b avutil/hwcontext_vulkan: use correct bitmask types
Vulkan headers define *FlagBits enum with individual bit values, and
coresponding *Flags typedef to be used to store the bitmask of
coresponding bits.

In practice those two types map to the same type, but for consistency
*Flags should be used.

Fixes MSVC warnings about type mismatch.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-11-05 19:04:09 +01:00
Lynne
964e9cc63b hwcontext_vulkan: add support for VK_EXT_zero_initialize_device_memory 2025-10-28 07:11:21 +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
Niklas Haas
a45d30a675 avutil/hwcontext_vulkan: always enable baseline usage flags
The documentation states that this field is for enabling "extra" usage
flags. This conflicts with the implementation, and the rest of the comment,
though.

In resolving this ambiguity, I think it's better to lean towards the first
sentence and treat this field purely as specifying *extra* usage flags to
enable. Otherwise, this may break vulkan encoding or subsequent hwdownload
if the upstream filter did not specifically advertise this.

Change the default behavior and update the documentation slightly to more
clearly document the semantics.
2025-10-16 17:40:25 +00:00
Baptiste Coudurier
ef60d5ac32 general: fix warning 'av_malloc_array' sizes specified with 'sizeof'
in the earlier argument and not in the later argument [-Wcalloc-transposed-args]

Fixes trac ticket #11620
2025-10-07 14:51:46 -07:00
Niklas Haas
67c15cf541 avutil/hwcontext_vulkan: add debug option to avoid host ptr imports
In some environments, these are prohibitively slow. Add a debug option
to prefer memcpy instead of importing host pointers.
2025-08-20 15:05:41 +00:00
Niklas Haas
a7efcbd0e3 avutil/hwcontext_vulkan: check driver ID instead of hard-coded vendor check 2025-08-20 15:05:41 +00:00
Niklas Haas
78beb4f5f4 avutil/hwcontext_vulkan: don't re-query driver props in qf setup
This is already queried when the device is selected, so there's no need
to re-query the exact same struct.
2025-08-20 15:05:41 +00:00
Niklas Haas
881224b213 avutil/hwcontext_vulkan: also re-query dprops in device_init()
This can be unset if using an externally provided device, as in this case
device_create() never gets called.
2025-08-20 15:05:41 +00:00
vytskalt
a6b5a382dd hwcontext_vulkan: transfer EXCLUSIVE images to correct queue families 2025-08-19 14:34:17 +00:00
Mark Thompson
19473362fc hwcontext_vulkan: Fix build 2025-08-09 22:46:08 +00:00
Mark Thompson
4a42e5a1e2 hwcontext_vulkan: Fix build with older Vulkan headers 2025-08-09 22:46:08 +00:00
James Almer
1cde49ed82 avutil/hwcontext_vulkan: use uint64_t specifier in an av_log() call
Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-08 15:24:57 +00:00
Lynne
b2928971e8 lavc: add an av1_vulkan encoder
This commit adds a Vulkan AV1 encoder, using the native acceleration API.
2025-08-08 18:29:40 +09:00
Lynne
2caf23e7c4 vp9: add Vulkan VP9 hwaccel 2025-08-08 18:29:40 +09:00
Lynne
1f72bf5ec8 vulkan: add support for 16-bit RGGB Bayer pixfmt 2025-08-08 01:06:11 +09:00
Russell Greene
e0440eb392 hwcontext_vulkan: fix exporting multi-plane DRM modifiers
Previously, it was assumed that `drmFormatModifierPlaneCount` was one
for all modifiers when exporting, which is not always the case, in
particular for AMD GPUs and maybe others.

Fetch the number of memory planes and fill the structs appropriately in this situation.

The encoded stream is still bad in the case whre modifers are involved,
but I think this patch still stands on its own and I suspect that may be a driver bug.

A potential improvement that could be make is to cache the format
information, so we can avoid the two GetPhysicalDeviceFormatProperties2
calls for each export, as well as the allocation. I doubt this is very
expensive, but seemed worth noting.

v2 changes: query the format properties with the test image created in
`vulkan_frames_init` to avoid allocating space for the query during
export

Signed-off-by: Russell Greene <russellgreene8@gmail.com>
2025-08-05 23:53:58 +09:00
Lynne
50756b88d5 hwcontext_vulkan: enable uniformBufferStandardLayout 2025-08-05 23:51:21 +09:00
Lynne
53826f1815 hwcontext_vulkan: temporarily disable host_image_copy
NVIDIA's support for it is a disaster.
Of no benefit to other vendors.

NVIDIA are working on fixing it, but it may take time.
2025-08-05 23:51:21 +09:00
Timo Rothenpieler
262d41c804 all: fix typos found by codespell 2025-08-03 13:48:47 +02:00
vytskalt
2e19e74a29 hwcontext_vulkan: transfer exclusive images to correct queue family in drm->vulkan mapping 2025-08-02 11:02:59 +03:00
Lynne
bd75fad85f hwcontext_vulkan: fix issues with importing a device
The previous fix just used a local variable for the memory properties,
which did not fix this issue.
2025-06-27 03:09:27 +09:00
Lynne
60fc0288ae hwcontext_vulkan: fix 85c0364b70
The issue is that by moving the mprops loading later, we inadvertently
broke some earlier dependencies.
2025-06-24 16:42:43 +09:00
Lynne
11428896db hwcontext_vulkan: add workaround for broken Nvidia drivers 2025-06-24 02:30:01 +09:00
Lynne
85c0364b70 hwcontext_vulkan: move ReBAR check into a new function and use it later
The issue is that vulkan_device_create_internal() is only called for
devices that lavu creates by itself.
For external devices, this was never done.

This also solves some mid-function declaration warnings.
2025-06-24 02:30:01 +09:00
Niklas Haas
27590d8653 avutil/hwcontext_vulkan: disable host transfers if ReBAR is disabled
This feature fundamentally relies on host-visible VRAM, which restricts the
set of available memory types to (typically) host-visible device-local ones.

When resizable BAR is disabled, this memory type is usually limited to
e.g. 256 MiB in size, which is just plain insufficient for allocation of
general purpose GPU images, causing OOM errors on even the simplest of
commands.

The easiest solution is to disable host transfers entirely on machines
without host-addressable VRAM. In theory, we could try and recover the use
of host transfers for images which are *not* restricted to device-local
memory types, but this is rarely the case in practice, and the effort
required would exceed the benefit, especially since ReBAR is a standard
feature on all platforms recent enough to have Vulkan drivers, and only
occasionally disabled in the UEFI for by default for some hare-brained
notion of "backwards compatibiility" with ancient software.
2025-06-22 12:13:09 +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
Lynne
a9b2c10eee hwcontext_vulkan: use host image copy 2025-06-11 01:20:18 +09:00
Lynne
f531c91170 hwcontext_vulkan: add a setting to limit queues
If its a problem, you'll likely want to set it to 1 than more fine-grained
control, which you can already do via the API.
2025-06-10 22:26:14 +09:00
Lynne
26d17709e7 hwcontext_vulkan: minimize queue allocation on NVIDIA
On NVIDIA, there's a global maximum limit of approximately 112 queues,
which means it takes ONLY 7 total programs using the maximum amount of
queues to cause the driver to error out/*segfault* during initialization.

Also, each queue takes about 30ms to allocate, which quickly adds up.

This reduces the queues allocate to the minimum that we would be happy
with. Its not worth limiting decode/encode queues as they're generally
not a lot, and do help.
2025-06-10 22:26:14 +09:00
Lynne
b5262bccdb hwcontext_vulkan: do not use optical flow queueus by default
We don't use them, and on NVIDIA, each queue takes around 30ms
to allocate, and the driver has a global limit of ONLY 112 queues.
2025-06-10 22:26:09 +09: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
842fa198e9 hwcontext_vulkan: fix build with old Vulkan header versions 2025-05-21 03:11:07 +09:00
Lynne
eabb62813e hwcontext_vulkan: only try exporting DMABUF memory on !WIN32 and only for DMABUF tiling 2025-05-20 19:53:02 +09:00
Lynne
7c3c5c8052 hwcontext_vulkan: correct image transfer usage flags
By pure coincidence, BUFFER and IMAGE flags were equal for those
two usage types.
2025-05-20 19:53:02 +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
Link Mauve
d5f4a55123 avutil/hwcontext_vulkan: Query the correct format
In the call to vkGetPhysicalDeviceImageFormatProperties2(), we were
previously requesting the properties of the first fallback format (e.g.
VK_FORMAT_R8_UNORM for VK_FORMAT_G8_B8R8_2PLANE_420_UNORM) instead of
the actual format in use.

We don’t do anything with it afterwards, but there is no reason to keep
querying the wrong format.
2025-05-07 15:16:58 +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
3bb2b8aff4 hwcontext_vulkan: enable subgroupSizeControl
We already use this feature for setting the subgroup size,
but this feature was not enabled.

Fixes a validation warning.
2025-04-22 13:43:20 +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